feat: add following title

This commit is contained in:
2023-08-04 19:32:00 +02:00
parent 22a799aac7
commit 7a0491f3b7
3 changed files with 27 additions and 16 deletions

View File

@ -42,17 +42,19 @@ export function useStreamsFeed(tag?: string) {
return []; return [];
}, [feed.data]); }, [feed.data]);
const live = feedSorted.filter( const live = feedSorted
(a) => findTag(a, "status") === StreamState.Live .filter((a) => findTag(a, "status") === StreamState.Live)
).sort(sortStarts); .sort(sortStarts);
const planned = feedSorted.filter( const planned = feedSorted
(a) => findTag(a, "status") === StreamState.Planned .filter((a) => findTag(a, "status") === StreamState.Planned)
).sort(sortStarts); .sort(sortStarts);
const ended = feedSorted.filter((a) => { const ended = feedSorted
.filter((a) => {
const hasEnded = findTag(a, "status") === StreamState.Ended; const hasEnded = findTag(a, "status") === StreamState.Ended;
const recording = findTag(a, "recording") ?? ""; const recording = findTag(a, "recording") ?? "";
return hasEnded && recording?.length > 0; return hasEnded && recording?.length > 0;
}).sort(sortCreatedAt); })
.sort(sortCreatedAt);
return { live, planned, ended }; return { live, planned, ended };
} }

View File

@ -38,6 +38,12 @@
display: flex; display: flex;
} }
@media (max-width: 1020px) {
.divider {
padding: 0 8px;
}
}
.divider:after { .divider:after {
content: ""; content: "";
flex: 1; flex: 1;

View File

@ -32,11 +32,14 @@ export function RootPage() {
return ( return (
<div className="homepage"> <div className="homepage">
{hasFollowingLive && ( {hasFollowingLive && (
<>
<h2 className="divider line one-line">Following</h2>
<div className="video-grid"> <div className="video-grid">
{following.map((e) => ( {following.map((e) => (
<VideoTile ev={e} key={e.id} /> <VideoTile ev={e} key={e.id} />
))} ))}
</div> </div>
</>
)} )}
{!hasFollowingLive && ( {!hasFollowingLive && (
<div className="video-grid"> <div className="video-grid">