Files
Genarrative/src/components/BackstoryArchive.tsx
高物 fcd8d727b0
Some checks failed
CI / verify (push) Has been cancelled
Split custom world generation into staged lightweight batches
2026-04-05 22:20:30 +08:00

97 lines
3.1 KiB
TypeScript

export type BackstoryUnlockedChapter = {
id: string;
title: string;
content: string;
};
export type BackstoryLockedChapter = {
id: string;
title: string;
teaser: string;
affinityRequired: number;
};
interface BackstoryArchiveProps {
publicSummary?: string | null;
unlockedChapters: BackstoryUnlockedChapter[];
lockedChapters: BackstoryLockedChapter[];
}
export function BackstoryArchive({
publicSummary,
unlockedChapters,
lockedChapters,
}: BackstoryArchiveProps) {
const totalChapters = unlockedChapters.length + lockedChapters.length;
return (
<div className="space-y-3">
<div className="flex flex-wrap items-center justify-between gap-2">
<div className="text-[10px] uppercase tracking-[0.18em] text-zinc-500">
</div>
{totalChapters > 0 ? (
<div className="text-[10px] tracking-[0.14em] text-zinc-500">
{unlockedChapters.length} / {totalChapters}
</div>
) : null}
</div>
{publicSummary ? (
<div className="rounded-xl border border-white/8 bg-black/25 px-4 py-3">
<div className="text-[10px] uppercase tracking-[0.16em] text-zinc-500">
</div>
<div className="mt-2 text-sm leading-relaxed text-zinc-200">
{publicSummary}
</div>
</div>
) : null}
{unlockedChapters.map((chapter) => (
<div
key={`unlocked-backstory-${chapter.id}`}
className="rounded-xl border border-amber-300/18 bg-amber-500/[0.06] px-4 py-3"
>
<div className="flex flex-wrap items-center justify-between gap-2">
<div className="text-sm font-semibold text-white">
{chapter.title}
</div>
<span className="rounded-full border border-amber-300/18 bg-amber-400/10 px-2 py-0.5 text-[10px] tracking-[0.14em] text-amber-100">
</span>
</div>
<div className="mt-2 text-sm leading-relaxed text-zinc-200">
{chapter.content}
</div>
</div>
))}
{lockedChapters.map((chapter) => (
<div
key={`locked-backstory-${chapter.id}`}
className="rounded-xl border border-white/8 bg-black/18 px-4 py-3"
>
<div className="flex flex-wrap items-center justify-between gap-2">
<div className="text-sm font-semibold text-zinc-200">
{chapter.title}
</div>
<span className="rounded-full border border-white/10 bg-black/20 px-2 py-0.5 text-[10px] tracking-[0.14em] text-zinc-400">
{chapter.affinityRequired}
</span>
</div>
<div className="mt-2 text-sm leading-relaxed text-zinc-500">
{chapter.teaser}
</div>
</div>
))}
{!publicSummary && totalChapters === 0 ? (
<div className="rounded-xl border border-white/8 bg-black/18 px-4 py-3 text-sm text-zinc-500">
线
</div>
) : null}
</div>
);
}