crush-level-web/src/app/(main)/character/[id]/page.tsx

42 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-12-17 10:13:47 +00:00
import ChatButton from './ChatButton';
2025-12-18 10:14:12 +00:00
import { fetchCharacter } from './service';
import { Chip } from '@/components/ui/chip';
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
2025-12-15 11:31:18 +00:00
2025-12-09 09:13:46 +00:00
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
2025-12-15 11:31:18 +00:00
const { id } = await params;
2025-12-18 10:14:12 +00:00
const character = await fetchCharacter(id);
2025-12-15 11:31:18 +00:00
2025-12-09 09:13:46 +00:00
return (
2025-12-15 11:31:18 +00:00
<div className="flex px-4 pt-10">
<div className="mx-auto w-full max-w-[752px]">
2025-12-18 10:14:12 +00:00
<header className="flex items-end gap-10 justify-between">
2025-12-15 11:31:18 +00:00
<div className="flex gap-6 items-end">
2025-12-18 10:14:12 +00:00
<Avatar className="size-32">
<AvatarImage src={character?.headPortrait} />
<AvatarFallback>{character?.name?.slice(0, 2)}</AvatarFallback>
2025-12-15 11:31:18 +00:00
</Avatar>
<div>
2025-12-18 10:14:12 +00:00
<div className="txt-headline-s">{character?.name}</div>
<div className="flex flex-wrap mt-4 gap-2">
{character?.tags?.map((tag: any) => (
<Chip className="rounded-xs" key={tag.tagId}>
{tag.name}
</Chip>
))}
</div>
2025-12-15 11:31:18 +00:00
</div>
</div>
<div>
2025-12-17 10:13:47 +00:00
<ChatButton id={id}></ChatButton>
2025-12-15 11:31:18 +00:00
</div>
</header>
<div className="mt-12 rounded-2xl bg-white/10 p-6">
<div className="txt-headline-s">Introduction</div>
2025-12-18 10:14:12 +00:00
<div className="mt-4">{character?.description}</div>
2025-12-15 11:31:18 +00:00
</div>
</div>
2025-12-09 09:13:46 +00:00
</div>
2025-12-15 11:31:18 +00:00
);
2025-12-09 09:13:46 +00:00
}