|
1 | | -'use client' |
2 | | - |
3 | | -import { Alert, Button } from '@heroui/react' |
4 | | -import { useState } from 'react' |
5 | | -import { PatchHeaderContainer } from '~/components/patch/header/Container' |
6 | | -import { Patch, PatchIntroduction } from '~/types/api/patch' |
7 | | - |
8 | | -interface Props { |
9 | | - children: React.ReactNode |
10 | | - patch: Patch |
11 | | - intro: PatchIntroduction |
12 | | -} |
13 | | - |
14 | | -export const PatchContainer = ({ children, patch, intro }: Props) => { |
15 | | - const [show, setShow] = useState(false) |
16 | | - |
17 | | - if (patch.content_limit === 'nsfw') { |
18 | | - return ( |
19 | | - <div className="container py-6 mx-auto space-y-6"> |
20 | | - {!show && ( |
21 | | - <div className="flex flex-col items-center"> |
22 | | - <Alert |
23 | | - color="primary" |
24 | | - title="确认显示" |
25 | | - description="网站目前正在索引中, NSFW 的内容请您点击确定后即可显示" |
26 | | - endContent={ |
27 | | - <Button color="primary" onPress={() => setShow(!show)}> |
28 | | - 确定 |
29 | | - </Button> |
30 | | - } |
31 | | - /> |
32 | | - </div> |
33 | | - )} |
34 | | - |
35 | | - {show && ( |
36 | | - <> |
37 | | - <PatchHeaderContainer patch={patch} intro={intro} /> |
38 | | - {children} |
39 | | - </> |
40 | | - )} |
41 | | - </div> |
42 | | - ) |
43 | | - } |
44 | | - |
45 | | - return ( |
46 | | - <div className="container py-6 mx-auto space-y-6"> |
47 | | - <PatchHeaderContainer patch={patch} intro={intro} /> |
48 | | - {children} |
49 | | - </div> |
50 | | - ) |
51 | | -} |
| 1 | +'use client' |
| 2 | + |
| 3 | +import { Alert, Button } from '@heroui/react' |
| 4 | +import { useState } from 'react' |
| 5 | +import { PatchHeaderContainer } from '~/components/patch/header/Container' |
| 6 | +import { Patch, PatchIntroduction } from '~/types/api/patch' |
| 7 | + |
| 8 | +interface Props { |
| 9 | + children: React.ReactNode |
| 10 | + patch: Patch |
| 11 | + intro: PatchIntroduction |
| 12 | + uid?: number |
| 13 | +} |
| 14 | + |
| 15 | +export const PatchContainer = ({ children, patch, intro, uid }: Props) => { |
| 16 | + const [show, setShow] = useState(false) |
| 17 | + |
| 18 | + if (!uid && patch.content_limit === 'nsfw') { |
| 19 | + return ( |
| 20 | + <div className="container py-6 mx-auto space-y-6"> |
| 21 | + {!show && ( |
| 22 | + <div className="flex flex-col items-center"> |
| 23 | + <Alert |
| 24 | + color="primary" |
| 25 | + title="确认显示" |
| 26 | + description="网站目前正在索引中, NSFW 的内容请您点击确定后即可显示" |
| 27 | + endContent={ |
| 28 | + <Button color="primary" onPress={() => setShow(!show)}> |
| 29 | + 确定 |
| 30 | + </Button> |
| 31 | + } |
| 32 | + /> |
| 33 | + </div> |
| 34 | + )} |
| 35 | + |
| 36 | + {show && ( |
| 37 | + <> |
| 38 | + <PatchHeaderContainer patch={patch} intro={intro} /> |
| 39 | + {children} |
| 40 | + </> |
| 41 | + )} |
| 42 | + </div> |
| 43 | + ) |
| 44 | + } |
| 45 | + |
| 46 | + return ( |
| 47 | + <div className="container py-6 mx-auto space-y-6"> |
| 48 | + <PatchHeaderContainer patch={patch} intro={intro} /> |
| 49 | + {children} |
| 50 | + </div> |
| 51 | + ) |
| 52 | +} |
0 commit comments