feat: add following title

This commit is contained in:
verbiricha 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
const hasEnded = findTag(a, "status") === StreamState.Ended; .filter((a) => {
const recording = findTag(a, "recording") ?? ""; const hasEnded = findTag(a, "status") === StreamState.Ended;
return hasEnded && recording?.length > 0; const recording = findTag(a, "recording") ?? "";
}).sort(sortCreatedAt); return hasEnded && recording?.length > 0;
})
.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 && (
<div className="video-grid"> <>
{following.map((e) => ( <h2 className="divider line one-line">Following</h2>
<VideoTile ev={e} key={e.id} /> <div className="video-grid">
))} {following.map((e) => (
</div> <VideoTile ev={e} key={e.id} />
))}
</div>
</>
)} )}
{!hasFollowingLive && ( {!hasFollowingLive && (
<div className="video-grid"> <div className="video-grid">