mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-04-12 21:59:16 +02:00
fix bug with not all streams showing
This commit is contained in:
parent
5a20698f87
commit
a119b7582e
@ -6,7 +6,7 @@ import { NostrRequest } from "./nostr-request";
|
||||
import { NostrMultiSubscription } from "./nostr-multi-subscription";
|
||||
import Subject, { PersistentSubject } from "./subject";
|
||||
|
||||
const BLOCK_SIZE = 10;
|
||||
const BLOCK_SIZE = 20;
|
||||
|
||||
type EventFilter = (event: NostrEvent) => boolean;
|
||||
|
||||
|
@ -55,6 +55,7 @@ export function LiveVideoPlayer({
|
||||
</Badge>
|
||||
<video
|
||||
ref={video}
|
||||
playsInline={true}
|
||||
controls={status === VideoStatus.Online}
|
||||
autoPlay={autoPlay}
|
||||
poster={poster}
|
||||
|
@ -38,8 +38,9 @@ export function parseStreamEvent(stream: NostrEvent): ParsedStream {
|
||||
if (endTime > dayjs().unix()) {
|
||||
status = "ended";
|
||||
}
|
||||
|
||||
// if the stream has not been updated in a day consider it ended
|
||||
if (stream.created_at < dayjs().subtract(1, "day").unix()) {
|
||||
if (stream.created_at < dayjs().subtract(2, "day").unix()) {
|
||||
status = "ended";
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useMemo } from "react";
|
||||
import { useMemo, useRef } from "react";
|
||||
import { ParsedStream } from "../../../helpers/nostr/stream";
|
||||
import {
|
||||
Badge,
|
||||
@ -34,11 +34,17 @@ import StreamStatusBadge from "./status-badge";
|
||||
import { CodeIcon } from "../../../components/icons";
|
||||
import RawValue from "../../../components/debug-modals/raw-value";
|
||||
import RawJson from "../../../components/debug-modals/raw-json";
|
||||
import { NoteRelays } from "../../../components/note/note-relays";
|
||||
import { useRegisterIntersectionEntity } from "../../../providers/intersection-observer";
|
||||
|
||||
export default function StreamCard({ stream, ...props }: CardProps & { stream: ParsedStream }) {
|
||||
const { title, identifier, image } = stream;
|
||||
const devModal = useDisclosure();
|
||||
|
||||
// if there is a parent intersection observer, register this card
|
||||
const ref = useRef<HTMLDivElement | null>(null);
|
||||
useRegisterIntersectionEntity(ref, stream.event.id);
|
||||
|
||||
const naddr = useMemo(() => {
|
||||
const relays = getEventRelays(stream.event.id).value;
|
||||
const ranked = relayScoreboardService.getRankedRelays(relays);
|
||||
@ -54,7 +60,7 @@ export default function StreamCard({ stream, ...props }: CardProps & { stream: P
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card {...props}>
|
||||
<Card {...props} ref={ref}>
|
||||
<LinkBox as={CardBody} p="2" display="flex" flexDirection="column" gap="2">
|
||||
{image && <Image src={image} alt={title} borderRadius="lg" />}
|
||||
<Flex gap="2" alignItems="center">
|
||||
@ -81,6 +87,7 @@ export default function StreamCard({ stream, ...props }: CardProps & { stream: P
|
||||
<CardFooter p="2" display="flex" gap="2" alignItems="center">
|
||||
<StreamStatusBadge stream={stream} />
|
||||
<Spacer />
|
||||
<NoteRelays event={stream.event} />
|
||||
<IconButton
|
||||
icon={<CodeIcon />}
|
||||
aria-label="show raw event"
|
||||
|
@ -8,9 +8,11 @@ import useSubject from "../../hooks/use-subject";
|
||||
import StreamCard from "./components/stream-card";
|
||||
import { ParsedStream, getATag, parseStreamEvent } from "../../helpers/nostr/stream";
|
||||
import { NostrEvent } from "../../types/nostr-event";
|
||||
import { RelayIconStack } from "../../components/relay-icon-stack";
|
||||
|
||||
export default function LiveStreamsTab() {
|
||||
const readRelays = useReadRelayUrls();
|
||||
// hard code damus and snort relays for finding streams
|
||||
const readRelays = useReadRelayUrls(["wss://relay.damus.io", "wss://relay.snort.social"]);
|
||||
const [filterStatus, setFilterStatus] = useState<string>("live");
|
||||
|
||||
const eventFilter = useCallback(
|
||||
|
@ -19,6 +19,7 @@ import StreamSummaryContent from "../components/stream-summary-content";
|
||||
import { ArrowDownSIcon, ArrowUpSIcon, ExternalLinkIcon } from "../../../components/icons";
|
||||
import useSetColorMode from "../../../hooks/use-set-color-mode";
|
||||
import { CopyIconButton } from "../../../components/copy-icon-button";
|
||||
import { NoteRelays } from "../../../components/note/note-relays";
|
||||
|
||||
function StreamPage({ stream, displayMode }: { stream: ParsedStream; displayMode?: ChatDisplayMode }) {
|
||||
const isMobile = useIsMobile();
|
||||
@ -100,6 +101,7 @@ function StreamPage({ stream, displayMode }: { stream: ParsedStream; displayMode
|
||||
<Text>{stream.title}</Text>
|
||||
</Box>
|
||||
<Spacer />
|
||||
<NoteRelays event={stream.event} />
|
||||
<Button as={RouterLink} to="/streams">
|
||||
Back
|
||||
</Button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user