chore: formatting

This commit is contained in:
2024-03-06 16:32:21 +00:00
parent a385ca3271
commit 5e58af119d
29 changed files with 264 additions and 224 deletions

View File

@ -76,7 +76,9 @@ export default function Category() {
const cat = AllCategories.find(a => a.id === id);
const rb = new RequestBuilder(`category:${id}`);
rb.withFilter().kinds([EventKind.LiveEvent]).tag("t", cat?.tags ?? [id]);
rb.withFilter()
.kinds([EventKind.LiveEvent])
.tag("t", cat?.tags ?? [id]);
return rb;
}, [id]);
@ -92,11 +94,13 @@ export default function Category() {
{game?.cover && <img src={game?.cover} className="h-[250px]" />}
<div className="flex flex-col gap-4">
<h1>{game?.name}</h1>
{game?.genres && <div className="flex gap-2">
{game?.genres?.map(a => <Pill>
{a}
</Pill>)}
</div>}
{game?.genres && (
<div className="flex gap-2">
{game?.genres?.map(a => (
<Pill>{a}</Pill>
))}
</div>
)}
</div>
</div>
<VideoGridSorted evs={results} showAll={true} />

View File

@ -5,7 +5,7 @@ import { DashboardRaidMenu } from "./raid-menu";
import { DefaultButton } from "@/element/buttons";
import Modal from "@/element/modal";
export function DashboardRaidButton({ link }: { link: NostrLink; }) {
export function DashboardRaidButton({ link }: { link: NostrLink }) {
const [show, setShow] = useState(false);
return (
<>

View File

@ -6,7 +6,7 @@ import { useMemo } from "react";
import { FormattedMessage } from "react-intl";
import { DefaultButton } from "@/element/buttons";
export function DashboardChatList({ feed }: { feed: Array<TaggedNostrEvent>; }) {
export function DashboardChatList({ feed }: { feed: Array<TaggedNostrEvent> }) {
const pubkeys = useMemo(() => {
return dedupe(feed.map(a => a.pubkey));
}, [feed]);
@ -16,7 +16,7 @@ export function DashboardChatList({ feed }: { feed: Array<TaggedNostrEvent>; })
<Profile pubkey={a} avatarSize={32} gap={4} />
<div className="flex gap-2">
<MuteButton pubkey={a} />
<DefaultButton onClick={() => { }} className="font-bold">
<DefaultButton onClick={() => {}} className="font-bold">
<FormattedMessage defaultMessage="Zap" id="fBI91o" />
</DefaultButton>
</div>

View File

@ -6,7 +6,7 @@ import { FormattedMessage } from "react-intl";
import { DashboardCard } from "./card";
import { DashboardHighlightZap } from "./zap-highlight";
export function DashboardZapColumn({ link, feed }: { link: NostrLink; feed: Array<TaggedNostrEvent>; }) {
export function DashboardZapColumn({ link, feed }: { link: NostrLink; feed: Array<TaggedNostrEvent> }) {
const reactions = useEventReactions(link, feed);
const sortedZaps = useMemo(

View File

@ -17,7 +17,7 @@ import { NewStreamDialog } from "@/element/new-stream";
import { DashboardSettingsButton } from "./button-settings";
import DashboardIntro from "./intro";
export function DashboardForLink({ link }: { link: NostrLink; }) {
export function DashboardForLink({ link }: { link: NostrLink }) {
const streamEvent = useCurrentStreamFeed(link, true);
const streamLink = streamEvent ? NostrLink.fromEvent(streamEvent) : undefined;
const { stream, status, image, participants } = extractStreamInfo(streamEvent);
@ -34,9 +34,7 @@ export function DashboardForLink({ link }: { link: NostrLink; }) {
streamLink ? [streamLink] : [],
rb => {
if (streamLink) {
rb.withFilter()
.kinds([LIVE_STREAM_CHAT, LIVE_STREAM_RAID, LIVE_STREAM_CLIP])
.replyToLink([streamLink]);
rb.withFilter().kinds([LIVE_STREAM_CHAT, LIVE_STREAM_RAID, LIVE_STREAM_CLIP]).replyToLink([streamLink]);
}
},
true
@ -54,11 +52,13 @@ export function DashboardForLink({ link }: { link: NostrLink; }) {
<div className="flex gap-4">
<DashboardStatsCard
name={<FormattedMessage defaultMessage="Stream Time" id="miQKuZ" />}
value={<StreamTimer ev={streamEvent} />} />
value={<StreamTimer ev={streamEvent} />}
/>
<DashboardStatsCard name={<FormattedMessage defaultMessage="Viewers" id="37mth/" />} value={participants} />
<DashboardStatsCard
name={<FormattedMessage defaultMessage="Highest Viewers" id="jctiUc" />}
value={maxParticipants} />
value={maxParticipants}
/>
</div>
<div className="grid gap-2 grid-cols-3">
<DashboardRaidButton link={streamLink} />

View File

@ -7,4 +7,4 @@ export default function DashboardPage() {
if (!login) return;
return <DashboardForLink link={new NostrLink(NostrPrefix.PublicKey, login.pubkey)} />;
}
}

View File

@ -1,9 +1,11 @@
import { FormattedMessage } from "react-intl";
export default function DashboardIntro() {
return <>
<h1>
<FormattedMessage defaultMessage="Welcome to zap.stream!" />
</h1>
return (
<>
<h1>
<FormattedMessage defaultMessage="Welcome to zap.stream!" />
</h1>
</>
}
);
}

View File

@ -2,8 +2,10 @@ import classNames from "classnames";
import { HTMLProps, ReactNode } from "react";
export function DashboardStatsCard({
name, value, ...props
}: { name: ReactNode; value: ReactNode; } & Omit<HTMLProps<HTMLDivElement>, "children" | "name" | "value">) {
name,
value,
...props
}: { name: ReactNode; value: ReactNode } & Omit<HTMLProps<HTMLDivElement>, "children" | "name" | "value">) {
return (
<div
{...props}

View File

@ -3,7 +3,7 @@ import { ParsedZap } from "@snort/system";
import { FormattedMessage, FormattedNumber } from "react-intl";
import { Text } from "@/element/text";
export function DashboardHighlightZap({ zap }: { zap: ParsedZap; }) {
export function DashboardHighlightZap({ zap }: { zap: ParsedZap }) {
return (
<div className="px-4 py-6 bg-layer-1 flex flex-col gap-4 rounded-xl animate-flash">
<div className="flex justify-between items-center text-zap text-2xl font-semibold">
@ -11,14 +11,16 @@ export function DashboardHighlightZap({ zap }: { zap: ParsedZap; }) {
pubkey={zap.sender ?? "anon"}
options={{
showAvatar: false,
}} />
}}
/>
<span>
<FormattedMessage
defaultMessage="{n} sats"
id="CsCUYo"
values={{
n: <FormattedNumber value={zap.amount} />,
}} />
}}
/>
</span>
</div>
{zap.content && (