Skip to content

Commit 2ea3ad5

Browse files
committed
mod: remove NSFW indicator
1 parent 7761c7b commit 2ea3ad5

File tree

13 files changed

+225
-243
lines changed

13 files changed

+225
-243
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
"turbopack",
124124
"turbotrace",
125125
"Tyranor",
126+
"UMAMI",
126127
"unfollow",
127128
"unnest",
128129
"unrs",

app/layout.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import { KunFooter } from '~/components/kun/Footer'
55
import { KunNavigationBreadcrumb } from '~/components/kun/NavigationBreadcrumb'
66
import { kunMetadata, kunViewport } from './metadata'
77
import { KunBackToTop } from '~/components/kun/BackToTop'
8-
import { NSFWIndicator } from '~/components/kun/NSFWIndicator'
98
import Script from 'next/script'
10-
import { getNSFWHeader } from '~/utils/actions/getNSFWHeader'
119
import type { Metadata, Viewport } from 'next'
10+
// @ts-expect-error kun love ren forever~
1211
import '~/styles/index.css'
1312

1413
export const viewport: Viewport = kunViewport
@@ -19,19 +18,14 @@ export default async function RootLayout({
1918
}: {
2019
children: React.ReactNode
2120
}) {
22-
const nsfwHeader = await getNSFWHeader()
23-
const isNSFWEnable =
24-
nsfwHeader.content_limit === 'nsfw' ||
25-
nsfwHeader.content_limit === undefined
26-
2721
return (
2822
<html lang="zh-Hans" suppressHydrationWarning>
2923
{process.env.NODE_ENV === 'production' && (
3024
<head>
3125
<Script
3226
defer
3327
src="https://stats.kungal.org/script.js"
34-
data-website-id="4521684c-2b49-46f2-9e88-ce0592c4aecf"
28+
data-website-id={process.env.KUN_VISUAL_NOVEL_UMAMI_ID}
3529
/>
3630
</head>
3731
)}
@@ -40,7 +34,7 @@ export default async function RootLayout({
4034
<div className="relative flex flex-col items-center justify-center min-h-screen bg-radial">
4135
<KunTopBar />
4236
<KunNavigationBreadcrumb />
43-
<NSFWIndicator isNSFWEnable={isNSFWEnable} />
37+
4438
<div className="flex min-h-[calc(100dvh-24rem)] w-full max-w-7xl grow px-3">
4539
{children}
4640
<Toaster />

components/about/BlogHeader.tsx

Lines changed: 71 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,71 @@
1-
import { Alert } from '@heroui/alert'
2-
import { Card, CardBody, CardHeader } from '@heroui/card'
3-
import { Image } from '@heroui/image'
4-
import { CalendarDays } from 'lucide-react'
5-
import { formatDate } from '~/utils/time'
6-
import { KunAvatar } from '~/components/kun/floating-card/KunAvatar'
7-
import type { KunFrontmatter } from '~/lib/mdx/types'
8-
9-
interface BlogHeaderProps {
10-
frontmatter: KunFrontmatter
11-
}
12-
13-
export const BlogHeader = ({ frontmatter }: BlogHeaderProps) => {
14-
return (
15-
<Card className="w-full space-y-4 overflow-visible bg-transparent border-none shadow-none">
16-
<CardHeader className="flex flex-col items-start p-0">
17-
<div className="relative w-full overflow-hidden rounded-xl">
18-
<Image
19-
isZoomed
20-
alt={frontmatter.title}
21-
className="object-cover"
22-
src={frontmatter.banner}
23-
width="100%"
24-
height="100%"
25-
/>
26-
</div>
27-
</CardHeader>
28-
29-
<CardBody className="p-0 overflow-visible">
30-
<div className="flex flex-col space-y-4">
31-
<h1 className="text-2xl font-bold tracking-tight sm:text-4xl">
32-
{frontmatter.title}
33-
</h1>
34-
35-
<div className="flex items-center gap-3">
36-
<KunAvatar
37-
uid={frontmatter.authorUid}
38-
avatarProps={{
39-
isBordered: true,
40-
radius: 'full',
41-
size: 'md',
42-
name: frontmatter.authorName,
43-
src: frontmatter.authorAvatar,
44-
className: 'shrink-0'
45-
}}
46-
/>
47-
<div className="flex flex-col gap-1">
48-
<h2 className="font-semibold leading-none text-small">
49-
{frontmatter.authorName}
50-
</h2>
51-
<div className="flex items-center gap-2">
52-
<CalendarDays className="w-4 h-4 text-default-400" />
53-
<p className="text-small text-default-400">
54-
{formatDate(frontmatter.date, {
55-
isPrecise: true,
56-
isShowYear: true
57-
})}
58-
</p>
59-
</div>
60-
</div>
61-
</div>
62-
63-
<Alert
64-
hideIcon
65-
description={frontmatter.description}
66-
color="primary"
67-
/>
68-
</div>
69-
</CardBody>
70-
</Card>
71-
)
72-
}
1+
import { Alert } from '@heroui/alert'
2+
import { Card, CardBody, CardHeader } from '@heroui/card'
3+
import { Image } from '@heroui/image'
4+
import { CalendarDays } from 'lucide-react'
5+
import { formatDate } from '~/utils/time'
6+
import { KunAvatar } from '~/components/kun/floating-card/KunAvatar'
7+
import type { KunFrontmatter } from '~/lib/mdx/types'
8+
9+
interface BlogHeaderProps {
10+
frontmatter: KunFrontmatter
11+
}
12+
13+
export const BlogHeader = ({ frontmatter }: BlogHeaderProps) => {
14+
return (
15+
<Card className="w-full space-y-4 overflow-visible bg-transparent border-none shadow-none">
16+
<CardHeader className="flex flex-col items-start p-0">
17+
<div className="relative w-full overflow-hidden rounded-xl">
18+
<Image
19+
alt={frontmatter.title}
20+
className="object-cover"
21+
src={frontmatter.banner}
22+
width="100%"
23+
height="100%"
24+
/>
25+
</div>
26+
</CardHeader>
27+
28+
<CardBody className="p-0 overflow-visible">
29+
<div className="flex flex-col space-y-4">
30+
<h1 className="text-2xl mt-8 font-bold tracking-tight sm:text-4xl">
31+
{frontmatter.title}
32+
</h1>
33+
34+
<div className="flex items-center gap-3">
35+
<KunAvatar
36+
uid={frontmatter.authorUid}
37+
avatarProps={{
38+
isBordered: true,
39+
radius: 'full',
40+
size: 'md',
41+
name: frontmatter.authorName,
42+
src: frontmatter.authorAvatar,
43+
className: 'shrink-0'
44+
}}
45+
/>
46+
<div className="flex flex-col gap-1">
47+
<h2 className="font-semibold leading-none text-small">
48+
{frontmatter.authorName}
49+
</h2>
50+
<div className="flex items-center gap-2">
51+
<CalendarDays className="w-4 h-4 text-default-400" />
52+
<p className="text-small text-default-400">
53+
{formatDate(frontmatter.date, {
54+
isPrecise: true,
55+
isShowYear: true
56+
})}
57+
</p>
58+
</div>
59+
</div>
60+
</div>
61+
62+
<Alert
63+
hideIcon
64+
description={frontmatter.description}
65+
color="primary"
66+
/>
67+
</div>
68+
</CardBody>
69+
</Card>
70+
)
71+
}

components/about/Sidebar.tsx

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
'use client'
2-
3-
import {
4-
Drawer,
5-
DrawerContent,
6-
DrawerHeader,
7-
DrawerBody,
8-
useDisclosure,
9-
Link
10-
} from '@heroui/react'
11-
import { KunTreeNode } from '~/lib/mdx/types'
12-
import { ChevronRight } from 'lucide-react'
13-
import { SidebarContent } from './SidebarContent'
14-
15-
interface Props {
16-
tree: KunTreeNode
17-
}
18-
19-
export const KunSidebar = ({ tree }: Props) => {
20-
const { isOpen, onOpen, onOpenChange } = useDisclosure()
21-
22-
return (
23-
<div className="kun-scroll-nav">
24-
<aside className="fixed hidden md:block top-48 h-[calc(100dvh-296px)] w-64 bg-background">
25-
<div className="flex flex-col h-full px-4 overflow-scroll border-r border-default-200 scrollbar-hide bg-background">
26-
<Link color="foreground" href="/about" className="my-3 text-xl">
27-
目录
28-
</Link>
29-
{SidebarContent({ tree })}
30-
</div>
31-
</aside>
32-
33-
<div
34-
className="fixed top-0 left-0 flex items-center h-full cursor-pointer text-default-500 md:hidden"
35-
onClick={() => onOpen()}
36-
>
37-
<ChevronRight size={24} />
38-
</div>
39-
40-
<Drawer
41-
isOpen={isOpen}
42-
onOpenChange={onOpenChange}
43-
placement="left"
44-
size="xs"
45-
>
46-
<DrawerContent>
47-
<DrawerHeader className="flex flex-col gap-1">目录</DrawerHeader>
48-
<DrawerBody>{SidebarContent({ tree })}</DrawerBody>
49-
</DrawerContent>
50-
</Drawer>
51-
</div>
52-
)
53-
}
1+
'use client'
2+
3+
import {
4+
Drawer,
5+
DrawerContent,
6+
DrawerHeader,
7+
DrawerBody,
8+
useDisclosure,
9+
Link
10+
} from '@heroui/react'
11+
import { KunTreeNode } from '~/lib/mdx/types'
12+
import { ChevronRight } from 'lucide-react'
13+
import { SidebarContent } from './SidebarContent'
14+
15+
interface Props {
16+
tree: KunTreeNode
17+
}
18+
19+
export const KunSidebar = ({ tree }: Props) => {
20+
const { isOpen, onOpen, onOpenChange } = useDisclosure()
21+
22+
return (
23+
<div className="kun-scroll-nav">
24+
<aside className="fixed hidden md:block top-32 h-[calc(100dvh-256px)] w-64 bg-background">
25+
<div className="flex flex-col h-full px-4 overflow-scroll border-r border-default-200 scrollbar-hide bg-background">
26+
<Link color="foreground" href="/about" className="my-3 text-xl">
27+
目录
28+
</Link>
29+
{SidebarContent({ tree })}
30+
</div>
31+
</aside>
32+
33+
<div
34+
className="fixed top-0 left-0 flex items-center h-full cursor-pointer text-default-500 md:hidden"
35+
onClick={() => onOpen()}
36+
>
37+
<ChevronRight size={24} />
38+
</div>
39+
40+
<Drawer
41+
isOpen={isOpen}
42+
onOpenChange={onOpenChange}
43+
placement="left"
44+
size="xs"
45+
>
46+
<DrawerContent>
47+
<DrawerHeader className="flex flex-col gap-1">目录</DrawerHeader>
48+
<DrawerBody>{SidebarContent({ tree })}</DrawerBody>
49+
</DrawerContent>
50+
</Drawer>
51+
</div>
52+
)
53+
}

components/kun/PatchAttribute.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const KunPatchAttribute = ({
4747
{modelName}
4848
</Chip>
4949
)}
50-
{downloadCount && (
50+
{!!downloadCount && (
5151
<Chip variant="flat" color="default" size={size}>
5252
{`${downloadCount} 人下载`}
5353
</Chip>

components/kun/top-bar/Brand.tsx

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
import { NavbarBrand } from '@heroui/navbar'
2-
import { Tooltip } from '@heroui/tooltip'
3-
import { Chip } from '@heroui/chip'
4-
import { kunMoyuMoe } from '~/config/moyu-moe'
5-
import Image from 'next/image'
6-
import Link from 'next/link'
7-
8-
export const KunTopBarBrand = () => {
9-
return (
10-
<Tooltip
11-
disableAnimation
12-
showArrow
13-
closeDelay={0}
14-
placement="bottom-start"
15-
content={
16-
<div className="px-1 py-2 space-y-1">
17-
<div className="font-bold text-small">如何记住本站的域名?</div>
18-
<div className="text-tiny">{`鲲喜欢摸鱼 -> 摸鱼(moyu) . 萌(moe)`}</div>
19-
<div className="text-tiny">当然您也可以 Ctrl + D 收藏本站网址</div>
20-
</div>
21-
}
22-
>
23-
<NavbarBrand className="hidden mr-16 grow-0 md:flex">
24-
<Link className="flex items-center" href="/">
25-
<Image
26-
src="/favicon.webp"
27-
alt={kunMoyuMoe.titleShort}
28-
width={50}
29-
height={50}
30-
priority
31-
/>
32-
<p className="ml-4 mr-2 font-bold text-inherit">
33-
{kunMoyuMoe.creator.name}
34-
</p>
35-
<Chip size="sm" variant="flat" color="primary">
36-
补丁
37-
</Chip>
38-
</Link>
39-
</NavbarBrand>
40-
</Tooltip>
41-
)
42-
}
1+
import { NavbarBrand } from '@heroui/navbar'
2+
import { Tooltip } from '@heroui/tooltip'
3+
import { Chip } from '@heroui/chip'
4+
import { kunMoyuMoe } from '~/config/moyu-moe'
5+
import Image from 'next/image'
6+
import Link from 'next/link'
7+
8+
export const KunTopBarBrand = () => {
9+
return (
10+
<Tooltip
11+
disableAnimation
12+
showArrow
13+
closeDelay={0}
14+
placement="bottom-start"
15+
content={
16+
<div className="px-1 py-2 space-y-1">
17+
<div className="font-bold text-small">如何记住本站的域名?</div>
18+
<div className="text-tiny">{`鲲喜欢摸鱼 -> 摸鱼(moyu) . 萌(moe)`}</div>
19+
<div className="text-tiny">当然您也可以 Ctrl + D 收藏本站网址</div>
20+
</div>
21+
}
22+
>
23+
<NavbarBrand className="hidden mr-16 grow-0 md:flex">
24+
<Link className="flex items-center" href="/">
25+
<Image
26+
src="/favicon.webp"
27+
alt={kunMoyuMoe.titleShort}
28+
width={50}
29+
height={50}
30+
priority
31+
/>
32+
<p className="ml-4 mr-2 font-bold text-inherit">
33+
{kunMoyuMoe.creator.name}
34+
</p>
35+
<Chip size="sm" variant="flat" color="primary">
36+
补丁
37+
</Chip>
38+
</Link>
39+
</NavbarBrand>
40+
</Tooltip>
41+
)
42+
}

0 commit comments

Comments
 (0)