Skip to content

Commit a26d96c

Browse files
committed
feat: adding an ad
1 parent 90dc2fc commit a26d96c

File tree

16 files changed

+115
-29
lines changed

16 files changed

+115
-29
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@
3535
"dlogo",
3636
"dompurify",
3737
"dups",
38+
"DZMM",
3839
"esbenp",
3940
"esno",
4041
"extlinks",
4142
"formulahendry",
4243
"frontmatter",
4344
"Frontwing",
4445
"Galgame",
46+
"Galgamer",
4547
"galgames",
4648
"ggbases",
4749
"GIGA",
@@ -83,6 +85,7 @@
8385
"moemoepoint",
8486
"Moemoepoints",
8587
"moyu",
88+
"moyumoe",
8689
"mtxr",
8790
"nextui",
8891
"nocheck",

app/api/resource/detail/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export const getPatchResourceDetail = async (
134134
}
135135
}
136136
})
137-
138137
if (!resource || !resource.patch) {
139138
return '未找到对应的资源'
140139
}

app/patch/[id]/resource/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ export const kunGetActions = async (params: z.infer<typeof patchIdSchema>) => {
1717
const payload = await verifyHeaderCookie()
1818

1919
const response = await getPatchResource(input, payload?.uid ?? 0)
20-
return response
20+
return { response, payload }
2121
}

app/patch/[id]/resource/page.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { Alert } from '@heroui/alert'
2-
import { Card, CardBody, CardHeader } from '@heroui/card'
31
import { Link } from '@heroui/link'
42
import { Resources } from '~/components/patch/resource/Resource'
53
import { generateKunMetadataTemplate } from './metadata'
64
import { kunGetPatchActions } from '../actions'
75
import { kunGetActions } from './actions'
86
import { ErrorComponent } from '~/components/error/ErrorComponent'
7+
import { Image } from '@heroui/image'
8+
import { kunMoyuMoe } from '~/config/moyu-moe'
99
import type { Metadata } from 'next'
1010

1111
export const revalidate = 5
@@ -25,7 +25,7 @@ export const generateMetadata = async ({
2525
return {}
2626
}
2727

28-
return generateKunMetadataTemplate(patch, response)
28+
return generateKunMetadataTemplate(patch, response.response)
2929
}
3030

3131
export default async function Kun({
@@ -65,13 +65,18 @@ export default async function Kun({
6565
御爱同萌
6666
</Link>
6767
</p>
68-
<p>
69-
如果您点赞了游戏资源, 那么将会收到这个游戏下载资源的更新通知
70-
(资源下载链接更新和备注更新)
71-
</p>
7268
</div>
7369

74-
<Resources initialResources={response} id={Number(id)} />
70+
{(!response.payload || response.payload.role < 2) && (
71+
<Link target="_blank" href={kunMoyuMoe.ad[0].url}>
72+
<Image
73+
className="pointer-events-none select-none"
74+
src="/a/moyumoe1.avif"
75+
/>
76+
</Link>
77+
)}
78+
79+
<Resources initialResources={response.response} id={Number(id)} />
7580
</div>
7681
</div>
7782
)

app/resource/[id]/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ export const kunGetResourceDetailActions = cache(
1919
const payload = await verifyHeaderCookie()
2020

2121
const response = await getPatchResourceDetail(input, payload?.uid ?? 0)
22-
return response
22+
return { response, payload }
2323
}
2424
)

app/resource/[id]/page.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ export const generateMetadata = async ({
1717
const detail = await kunGetResourceDetailActions({
1818
resourceId: Number(id)
1919
})
20-
if (typeof detail === 'string') {
20+
if (typeof detail === 'string' || typeof detail.response === 'string') {
2121
return {}
2222
}
2323

24-
return generateKunResourceMetadata(detail)
24+
return generateKunResourceMetadata(detail.response)
2525
}
2626

2727
export default async function Kun({ params }: Props) {
@@ -33,6 +33,9 @@ export default async function Kun({ params }: Props) {
3333
if (typeof detail === 'string') {
3434
return <ErrorComponent error={detail} />
3535
}
36+
if (typeof detail.response === 'string') {
37+
return <ErrorComponent error={detail.response} />
38+
}
3639

37-
return <KunResourceDetail detail={detail} />
40+
return <KunResourceDetail detail={detail.response} payload={detail.payload} />
3841
}

components/about/Header.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { KunHeader } from '../kun/Header'
99
export const KunAboutHeader = () => {
1010
return (
1111
<div className="mb-8 space-y-6">
12-
<KunHeader name="关于我们" description="开源 Galgame 补丁资源下载站" />
12+
<KunHeader
13+
name="关于我们"
14+
description="鲲 Galgame 补丁是一个开源, 免费, 零门槛, 纯手写, 最先进的 Galgame 补丁资源下载站"
15+
/>
1316

1417
{/* <Input
1518
classNames={{

components/kun/top-bar/KunMobileMenu.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import Link from 'next/link'
66
import Image from 'next/image'
77
import { kunMoyuMoe } from '~/config/moyu-moe'
88
import { kunMobileNavItem } from '~/constants/top-bar'
9-
import { RandomGalgameButton } from './RandomGalgameButton'
9+
import { Divider } from '@heroui/react'
10+
import { Heart } from 'lucide-react'
1011

1112
export const KunMobileMenu = () => {
1213
return (
@@ -37,8 +38,25 @@ export const KunMobileMenu = () => {
3738
</NavbarMenuItem>
3839
))}
3940

41+
<Divider className="my-3" />
42+
4043
<NavbarMenuItem>
41-
<RandomGalgameButton variant="flat" color="primary" />
44+
<div className="space-y-2">
45+
<p>为什么现在的 AI 比人还要 H</p>
46+
<Link
47+
className="flex items-center gap-2"
48+
color="secondary"
49+
href="https://s.iloveren.link/s/moyumoe1"
50+
>
51+
<img
52+
src="/a/moyumoe1-button.avif"
53+
className="h-11 dark:opacity-80"
54+
/>
55+
<span className="gap-2 flex items-center text-lg text-secondary px-4 py-2 rounded-2xl bg-secondary/15">
56+
尝试一下 AI 女友
57+
</span>
58+
</Link>
59+
</div>
4260
</NavbarMenuItem>
4361
</NavbarMenu>
4462
)

components/kun/top-bar/TopBar.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use client'
22

3-
import Link from 'next/link'
43
import { KunTopBarBrand } from './Brand'
54
import { KunTopBarUser } from './User'
65
import { usePathname } from 'next/navigation'
@@ -10,22 +9,22 @@ import { useEffect, useState } from 'react'
109
import {
1110
Navbar,
1211
NavbarContent,
13-
NavbarItem,
1412
NavbarMenuToggle,
15-
Button,
13+
Link,
1614
Tooltip
1715
} from '@heroui/react'
1816
import {
19-
ChevronDown,
2017
Building2,
2118
Gamepad2,
2219
Puzzle,
2320
Tags,
2421
BookUser,
2522
Clapperboard,
26-
ChartColumnBig
23+
ChartColumnBig,
24+
Heart
2725
} from 'lucide-react'
2826
import { cn } from '~/utils/cn'
27+
import { kunMoyuMoe } from '~/config/moyu-moe'
2928

3029
export const KunTopBar = () => {
3130
const pathname = usePathname()
@@ -105,7 +104,13 @@ export const KunTopBar = () => {
105104
</nav>
106105
}
107106
>
108-
<Link href="/galgame" className="text-base">
107+
<Link
108+
href="/galgame"
109+
className={cn(
110+
'text-base',
111+
pathname === '/galgame' ? 'text-primary' : 'text-foreground'
112+
)}
113+
>
109114
下载补丁
110115
</Link>
111116
</Tooltip>
@@ -123,6 +128,15 @@ export const KunTopBar = () => {
123128
{item.name}
124129
</Link>
125130
))}
131+
132+
<Tooltip disableAnimation content="为什么现在的 AI 比人还要 H">
133+
<Link color="secondary" className="gap-1" href={kunMoyuMoe.ad[0].url}>
134+
<img
135+
className="h-10 dark:opacity-80"
136+
src="/a/moyumoe1-button.avif"
137+
/>
138+
</Link>
139+
</Tooltip>
126140
</div>
127141

128142
<KunTopBarUser />

components/patch/header/BackgroundImage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const PatchBackgroundImage = ({ patch }: Props) => {
1919
src={patch.banner}
2020
alt={getPreferredLanguageText(patch.name)}
2121
className={`object-cover w-full h-full transition-opacity duration-500 ${
22-
imageLoaded ? 'opacity-20' : 'opacity-0'
22+
imageLoaded ? 'opacity-5' : 'opacity-0'
2323
}`}
2424
fill
2525
sizes="100vw"

0 commit comments

Comments
 (0)