fix: Hide followed hashtags when no streams are live
Some checks reported errors
continuous-integration/drone/pr Build encountered an error
Some checks reported errors
continuous-integration/drone/pr Build encountered an error
This commit is contained in:
parent
296789978c
commit
20f5554a48
@ -1,6 +1,6 @@
|
|||||||
import "./root.css";
|
import "./root.css";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
import { useCallback } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import type { NostrEvent } from "@snort/system";
|
import type { NostrEvent } from "@snort/system";
|
||||||
|
|
||||||
import { VideoTile } from "@/element/video-tile";
|
import { VideoTile } from "@/element/video-tile";
|
||||||
@ -28,6 +28,20 @@ export function RootPage() {
|
|||||||
const plannedEvents = planned.filter(e => !mutedHosts.has(getHost(e))).filter(followsHost);
|
const plannedEvents = planned.filter(e => !mutedHosts.has(getHost(e))).filter(followsHost);
|
||||||
const endedEvents = ended.filter(e => !mutedHosts.has(getHost(e)));
|
const endedEvents = ended.filter(e => !mutedHosts.has(getHost(e)));
|
||||||
|
|
||||||
|
const liveByHashtag = useMemo(() => {
|
||||||
|
return hashtags
|
||||||
|
.map(t => ({
|
||||||
|
tag: t,
|
||||||
|
live: live
|
||||||
|
.filter(e => !mutedHosts.has(getHost(e)))
|
||||||
|
.filter(e => {
|
||||||
|
const evTags = getTagValues(e.tags, "t");
|
||||||
|
return evTags.includes(t);
|
||||||
|
}),
|
||||||
|
}))
|
||||||
|
.filter(t => t.live.length > 0);
|
||||||
|
}, [live, hashtags]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="homepage">
|
<div className="homepage">
|
||||||
{hasFollowingLive && (
|
{hasFollowingLive && (
|
||||||
@ -51,19 +65,13 @@ export function RootPage() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{hashtags.map(t => (
|
{liveByHashtag.map(t => (
|
||||||
<>
|
<>
|
||||||
<h2 className="divider line one-line">#{t}</h2>
|
<h2 className="divider line one-line">#{t.tag}</h2>
|
||||||
<div className="video-grid">
|
<div className="video-grid">
|
||||||
{live
|
{t.live.map(e => (
|
||||||
.filter(e => !mutedHosts.has(getHost(e)))
|
<VideoTile ev={e} key={e.id} />
|
||||||
.filter(e => {
|
))}
|
||||||
const evTags = getTagValues(e.tags, "t");
|
|
||||||
return evTags.includes(t);
|
|
||||||
})
|
|
||||||
.map(e => (
|
|
||||||
<VideoTile ev={e} key={e.id} />
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
))}
|
))}
|
||||||
|
Loading…
Reference in New Issue
Block a user