WIP: feat(frontend): overhaul styling with warm and editorial look #12
@@ -109,7 +109,9 @@ const Home = () => {
|
|||||||
// Fetch Markers & Stream information
|
// Fetch Markers & Stream information
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getCurrentStream()
|
getCurrentStream()
|
||||||
.then(setStreamStatus)
|
.then(data => {
|
||||||
|
setStreamStatus(data);
|
||||||
|
});
|
||||||
|
|
||||||
getMarkers()
|
getMarkers()
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@@ -152,12 +154,12 @@ const Home = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (streamStatus?.startDate == null) {
|
if (streamStatus?.startTime == null) {
|
||||||
setElapsed('00:00:00');
|
setElapsed('00:00:00');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const startMs = new Date(streamStatus?.startDate).getTime();
|
const startMs = new Date(streamStatus?.startTime).getTime();
|
||||||
|
|
||||||
const tick = () => {
|
const tick = () => {
|
||||||
const diffSec = Math.floor((Date.now() - startMs) / 1000);
|
const diffSec = Math.floor((Date.now() - startMs) / 1000);
|
||||||
@@ -170,7 +172,7 @@ const Home = () => {
|
|||||||
tick();
|
tick();
|
||||||
const interval = setInterval(tick, 1000);
|
const interval = setInterval(tick, 1000);
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, [streamStatus?.startDate]);
|
}, [streamStatus?.startTime]);
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return (<Landing />)
|
return (<Landing />)
|
||||||
@@ -189,7 +191,6 @@ const Home = () => {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Live status — always present, so the page has the same shape either way. */}
|
|
||||||
<Card className={clsx("p-8 mb-8", isStreaming ? "bg-live-card" : "bg-card")}>
|
<Card className={clsx("p-8 mb-8", isStreaming ? "bg-live-card" : "bg-card")}>
|
||||||
<div className={"flex flex-row items-center gap-2"}>
|
<div className={"flex flex-row items-center gap-2"}>
|
||||||
{isStreaming
|
{isStreaming
|
||||||
@@ -209,7 +210,7 @@ const Home = () => {
|
|||||||
<>
|
<>
|
||||||
<h2 className={"font-heading text-3xl"}>
|
<h2 className={"font-heading text-3xl"}>
|
||||||
Session {String(streamStatus?.id).padStart(5, '0')} {' '}
|
Session {String(streamStatus?.id).padStart(5, '0')} {' '}
|
||||||
recording since {getTimeFromISOString(streamStatus?.startDate ?? null)}.</h2>
|
recording since {getTimeFromISOString(streamStatus?.startTime ?? null)}.</h2>
|
||||||
|
|
||||||
<div className={"flex flex-row items-center gap-10 pt-4"}>
|
<div className={"flex flex-row items-center gap-10 pt-4"}>
|
||||||
<div className={"flex flex-col"}>
|
<div className={"flex flex-col"}>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const StreamControl = () => {
|
|||||||
const [jobs, setJobs] = useState<TrackedJob[]>([]);
|
const [jobs, setJobs] = useState<TrackedJob[]>([]);
|
||||||
|
|
||||||
const isStreaming = streamStatus?.isStreaming ?? false;
|
const isStreaming = streamStatus?.isStreaming ?? false;
|
||||||
const startMs = streamStatus?.startDate ? stringToDate(streamStatus.startDate).getTime() : null;
|
const startMs = streamStatus?.startTime ? stringToDate(streamStatus.startTime).getTime() : null;
|
||||||
const elapsedSeconds = startMs === null ? 0 : Math.max(0, (now - startMs) / 1000);
|
const elapsedSeconds = startMs === null ? 0 : Math.max(0, (now - startMs) / 1000);
|
||||||
const elapsed = formatTimecode(elapsedSeconds);
|
const elapsed = formatTimecode(elapsedSeconds);
|
||||||
|
|
||||||
@@ -127,12 +127,10 @@ const StreamControl = () => {
|
|||||||
const offsetOf = (marker: Marker) =>
|
const offsetOf = (marker: Marker) =>
|
||||||
startMs === null ? 0 : (stringToDate(marker.timestamp).getTime() - startMs) / 1000;
|
startMs === null ? 0 : (stringToDate(marker.timestamp).getTime() - startMs) / 1000;
|
||||||
|
|
||||||
// Ticking two markers fills the range. Done here rather than in an effect so a
|
|
||||||
// marker poll can't stomp on timecodes the user has since typed over.
|
|
||||||
const toggleMarker = (id: number) => {
|
const toggleMarker = (id: number) => {
|
||||||
const next = selected.includes(id)
|
const next = selected.includes(id)
|
||||||
? selected.filter((current) => current !== id)
|
? selected.filter((current) => current !== id)
|
||||||
// Third tick replaces the older of the two.
|
|
||||||
: selected.length < 2 ? [...selected, id] : [selected[1], id];
|
: selected.length < 2 ? [...selected, id] : [selected[1], id];
|
||||||
|
|
||||||
setSelected(next);
|
setSelected(next);
|
||||||
@@ -173,8 +171,6 @@ const StreamControl = () => {
|
|||||||
setMarkerBusy(true);
|
setMarkerBusy(true);
|
||||||
setMarkerError(null);
|
setMarkerError(null);
|
||||||
try {
|
try {
|
||||||
// Dropping first and naming later isn't possible — markers have no PATCH —
|
|
||||||
// so an unnamed marker keeps the timecode it landed on.
|
|
||||||
await createMarker(markerMessage.trim() || `Marker at ${elapsed}`);
|
await createMarker(markerMessage.trim() || `Marker at ${elapsed}`);
|
||||||
setMarkerMessage("");
|
setMarkerMessage("");
|
||||||
refreshMarkers();
|
refreshMarkers();
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ type JobResponse = {
|
|||||||
type StreamStatus = {
|
type StreamStatus = {
|
||||||
isStreaming: boolean,
|
isStreaming: boolean,
|
||||||
id: number | null,
|
id: number | null,
|
||||||
startDate: string | null
|
startTime: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
type StreamHistoryItem = {
|
type StreamHistoryItem = {
|
||||||
|
|||||||
Reference in New Issue
Block a user