|
1 | | -import { Button } from '@heroui/button' |
2 | | -import { ChevronRight } from 'lucide-react' |
3 | | -import { GalgameCard } from '~/components/galgame/Card' |
4 | | -import { ResourceCard } from '~/components/resource/ResourceCard' |
5 | | -import { CommentCard } from '~/components/comment/CommentCard' |
6 | | -import Link from 'next/link' |
7 | | -import { HomeHero } from './Hero' |
8 | | -import type { HomeComment, HomeResource } from '~/types/api/home' |
9 | | - |
10 | | -interface Props { |
11 | | - galgames: GalgameCard[] |
12 | | - resources: HomeResource[] |
13 | | - comments: HomeComment[] |
14 | | -} |
15 | | - |
16 | | -export const HomeContainer = ({ galgames, resources, comments }: Props) => { |
17 | | - return ( |
18 | | - <div className="mx-auto space-y-16 max-w-7xl"> |
19 | | - <HomeHero /> |
20 | | - |
21 | | - <section className="space-y-3 sm:space-y-6"> |
22 | | - <div className="flex items-center space-x-4"> |
23 | | - <h2 className="text-2xl font-bold">最新 Galgame</h2> |
24 | | - <Button |
25 | | - variant="light" |
26 | | - as={Link} |
27 | | - color="primary" |
28 | | - endContent={<ChevronRight className="size-4" />} |
29 | | - href="/galgame" |
30 | | - > |
31 | | - 查看更多 |
32 | | - </Button> |
33 | | - </div> |
34 | | - <div className="grid grid-cols-2 gap-2 mx-auto mb-8 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"> |
35 | | - {galgames.map((galgame) => ( |
36 | | - <GalgameCard key={galgame.id} patch={galgame} /> |
37 | | - ))} |
38 | | - </div> |
39 | | - </section> |
40 | | - |
41 | | - <section className="space-y-3 sm:space-y-6"> |
42 | | - <div className="flex items-center space-x-4"> |
43 | | - <h2 className="text-2xl font-bold">最新补丁资源下载</h2> |
44 | | - <Button |
45 | | - variant="light" |
46 | | - as={Link} |
47 | | - color="primary" |
48 | | - endContent={<ChevronRight className="size-4" />} |
49 | | - href="/resource" |
50 | | - > |
51 | | - 查看更多 |
52 | | - </Button> |
53 | | - </div> |
54 | | - |
55 | | - <div className="grid grid-cols-1 gap-3 sm:gap-6 md:grid-cols-2"> |
56 | | - {resources.map((resource) => ( |
57 | | - <ResourceCard key={resource.id} resource={resource} /> |
58 | | - ))} |
59 | | - </div> |
60 | | - </section> |
61 | | - |
62 | | - <section className="space-y-3 sm:space-y-6"> |
63 | | - <div className="flex items-center space-x-4"> |
64 | | - <h2 className="text-2xl font-bold">最新评论</h2> |
65 | | - <Button |
66 | | - variant="light" |
67 | | - as={Link} |
68 | | - color="primary" |
69 | | - endContent={<ChevronRight className="size-4" />} |
70 | | - href="/comment" |
71 | | - > |
72 | | - 查看更多 |
73 | | - </Button> |
74 | | - </div> |
75 | | - |
76 | | - <div className="space-y-4"> |
77 | | - {comments.map((comment) => ( |
78 | | - <CommentCard key={comment.id} comment={comment} /> |
79 | | - ))} |
80 | | - </div> |
81 | | - </section> |
82 | | - </div> |
83 | | - ) |
84 | | -} |
| 1 | +import { Button } from '@heroui/button' |
| 2 | +import { Image } from '@heroui/image' |
| 3 | +import { ChevronRight } from 'lucide-react' |
| 4 | +import { GalgameCard } from '~/components/galgame/Card' |
| 5 | +import { ResourceCard } from '~/components/resource/ResourceCard' |
| 6 | +import { CommentCard } from '~/components/comment/CommentCard' |
| 7 | +import Link from 'next/link' |
| 8 | +import { HomeHero } from './Hero' |
| 9 | +import { kunMoyuMoe } from '~/config/moyu-moe' |
| 10 | +import type { HomeComment, HomeResource } from '~/types/api/home' |
| 11 | +import type { KunGalgamePayload } from '~/app/api/utils/jwt' |
| 12 | + |
| 13 | +interface Props { |
| 14 | + galgames: GalgameCard[] |
| 15 | + resources: HomeResource[] |
| 16 | + comments: HomeComment[] |
| 17 | + payload: KunGalgamePayload | null |
| 18 | +} |
| 19 | + |
| 20 | +export const HomeContainer = ({ |
| 21 | + galgames, |
| 22 | + resources, |
| 23 | + comments, |
| 24 | + payload |
| 25 | +}: Props) => { |
| 26 | + return ( |
| 27 | + <div className="mx-auto space-y-8 max-w-7xl"> |
| 28 | + <HomeHero /> |
| 29 | + |
| 30 | + {(!payload || payload.role < 2) && ( |
| 31 | + <div className="shadow-xl rounded-2xl"> |
| 32 | + <a |
| 33 | + target="_blank" |
| 34 | + className="h-full w-full" |
| 35 | + href={kunMoyuMoe.ad[0].url} |
| 36 | + > |
| 37 | + <Image |
| 38 | + className="pointer-events-none select-none" |
| 39 | + src="/a/moyumoe1.avif" |
| 40 | + /> |
| 41 | + </a> |
| 42 | + </div> |
| 43 | + )} |
| 44 | + |
| 45 | + <section className="space-y-3 sm:space-y-6"> |
| 46 | + <div className="flex items-center space-x-4"> |
| 47 | + <h2 className="text-2xl font-bold">最新 Galgame</h2> |
| 48 | + <Button |
| 49 | + variant="light" |
| 50 | + as={Link} |
| 51 | + color="primary" |
| 52 | + endContent={<ChevronRight className="size-4" />} |
| 53 | + href="/galgame" |
| 54 | + > |
| 55 | + 查看更多 |
| 56 | + </Button> |
| 57 | + </div> |
| 58 | + <div className="grid grid-cols-2 gap-2 mx-auto mb-8 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"> |
| 59 | + {galgames.map((galgame) => ( |
| 60 | + <GalgameCard key={galgame.id} patch={galgame} /> |
| 61 | + ))} |
| 62 | + </div> |
| 63 | + </section> |
| 64 | + |
| 65 | + <section className="space-y-3 sm:space-y-6"> |
| 66 | + <div className="flex items-center space-x-4"> |
| 67 | + <h2 className="text-2xl font-bold">最新补丁资源下载</h2> |
| 68 | + <Button |
| 69 | + variant="light" |
| 70 | + as={Link} |
| 71 | + color="primary" |
| 72 | + endContent={<ChevronRight className="size-4" />} |
| 73 | + href="/resource" |
| 74 | + > |
| 75 | + 查看更多 |
| 76 | + </Button> |
| 77 | + </div> |
| 78 | + |
| 79 | + <div className="grid grid-cols-1 gap-3 sm:gap-6 md:grid-cols-2"> |
| 80 | + {resources.map((resource) => ( |
| 81 | + <ResourceCard key={resource.id} resource={resource} /> |
| 82 | + ))} |
| 83 | + </div> |
| 84 | + </section> |
| 85 | + |
| 86 | + <section className="space-y-3 sm:space-y-6"> |
| 87 | + <div className="flex items-center space-x-4"> |
| 88 | + <h2 className="text-2xl font-bold">最新评论</h2> |
| 89 | + <Button |
| 90 | + variant="light" |
| 91 | + as={Link} |
| 92 | + color="primary" |
| 93 | + endContent={<ChevronRight className="size-4" />} |
| 94 | + href="/comment" |
| 95 | + > |
| 96 | + 查看更多 |
| 97 | + </Button> |
| 98 | + </div> |
| 99 | + |
| 100 | + <div className="space-y-4"> |
| 101 | + {comments.map((comment) => ( |
| 102 | + <CommentCard key={comment.id} comment={comment} /> |
| 103 | + ))} |
| 104 | + </div> |
| 105 | + </section> |
| 106 | + </div> |
| 107 | + ) |
| 108 | +} |
0 commit comments