mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-10-09 20:33:03 +02:00
fix content-warning tag
This commit is contained in:
@@ -9,11 +9,11 @@ export default function NoteContentWithWarning({ event }: { event: NostrEvent })
|
|||||||
const expand = useExpand();
|
const expand = useExpand();
|
||||||
const settings = useAppSettings();
|
const settings = useAppSettings();
|
||||||
|
|
||||||
const contentWarning = event.tags.find((t) => t[0] === "content-warning")?.[1];
|
const contentWarningTag = event.tags.find((t) => t[0] === "content-warning");
|
||||||
const showContentWarning = settings.showContentWarning && contentWarning && !expand?.expanded;
|
const showContentWarning = settings.showContentWarning && contentWarningTag && !expand?.expanded;
|
||||||
|
|
||||||
return showContentWarning ? (
|
return showContentWarning ? (
|
||||||
<SensitiveContentWarning description={contentWarning} />
|
<SensitiveContentWarning description={contentWarningTag?.[1]} />
|
||||||
) : (
|
) : (
|
||||||
<NoteContents px="2" event={event} />
|
<NoteContents px="2" event={event} />
|
||||||
);
|
);
|
||||||
|
@@ -260,7 +260,9 @@ export default function PostModal({
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
<Flex gap="2" direction="column">
|
<Flex gap="2" direction="column">
|
||||||
<Switch {...register("nsfw")}>NSFW</Switch>
|
<Switch {...register("nsfw")}>NSFW</Switch>
|
||||||
{getValues().nsfw && <Input {...register("nsfwReason")} placeholder="Reason" />}
|
{getValues().nsfw && (
|
||||||
|
<Input {...register("nsfwReason", { required: true })} placeholder="Reason" isRequired />
|
||||||
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex direction="column" gap="2" flex={1}>
|
<Flex direction="column" gap="2" flex={1}>
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Alert, AlertDescription, AlertIcon, AlertProps, AlertTitle, Button, Spacer, useModal } from "@chakra-ui/react";
|
import { Alert, AlertDescription, AlertIcon, AlertProps, AlertTitle, Button, Spacer } from "@chakra-ui/react";
|
||||||
|
|
||||||
import { useExpand } from "../providers/expanded";
|
import { useExpand } from "../providers/expanded";
|
||||||
import { useBreakpointValue } from "../providers/breakpoint-provider";
|
import { useBreakpointValue } from "../providers/breakpoint-provider";
|
||||||
|
|
||||||
export default function SensitiveContentWarning({ description }: { description: string } & AlertProps) {
|
export default function SensitiveContentWarning({ description }: { description?: string } & AlertProps) {
|
||||||
const expand = useExpand();
|
const expand = useExpand();
|
||||||
const smallScreen = useBreakpointValue({ base: true, md: false });
|
const smallScreen = useBreakpointValue({ base: true, md: false });
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user