feat(admin) : persist drafts and add constellation conditions
This commit is contained in:
@@ -47,7 +47,7 @@ function hasSection(guide: PublicGuide, slug: string): boolean {
|
||||
guide.artifactProfile.circlet.length),
|
||||
)
|
||||
);
|
||||
if (slug === "constellations") return guide.constellations.length > 0;
|
||||
if (slug === "constellations") return guide.constellationGroups.some((group) => group.rows.length > 0);
|
||||
if (slug === "team") return guide.teams.length > 0;
|
||||
return guide.extras.some(
|
||||
(extra) => extra.slug === slug && extra.rows.length > 0,
|
||||
@@ -718,39 +718,45 @@ function ConstellationSection({ guide }: { guide: PublicGuide }) {
|
||||
</p>
|
||||
) : null}
|
||||
</header>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{guide.constellations.map((row) => (
|
||||
<Card key={row.level}>
|
||||
<CardHeader className="flex flex-row items-center gap-4">
|
||||
{row.iconUrl ? (
|
||||
<Image
|
||||
src={row.iconUrl}
|
||||
alt=""
|
||||
width={64}
|
||||
height={64}
|
||||
className="size-16 shrink-0 rounded-lg bg-muted object-contain"
|
||||
/>
|
||||
) : null}
|
||||
<div className="min-w-0">
|
||||
<CardTitle
|
||||
className={cn(
|
||||
"text-3xl text-white",
|
||||
row.isGreat && "text-warning",
|
||||
)}
|
||||
>
|
||||
{metric(row.cumulativePercent)}
|
||||
</CardTitle>
|
||||
<CardDescription className="text-base font-medium text-white">
|
||||
C{row.level} · {row.name}
|
||||
</CardDescription>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="whitespace-pre-line leading-7">{row.detail}</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
{guide.constellationGroups.filter((group) => group.rows.length > 0).map((group, groupIndex, groups) => (
|
||||
<div key={group.id} className="flex flex-col gap-4">
|
||||
{groups.length > 1 ? <h2 className="font-heading text-2xl font-semibold">Condition {groupIndex + 1}</h2> : null}
|
||||
{group.note ? <p className="whitespace-pre-wrap text-muted-foreground">{group.note}</p> : null}
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{group.rows.map((row) => (
|
||||
<Card key={row.level}>
|
||||
<CardHeader className="flex flex-row items-center gap-4">
|
||||
{row.iconUrl ? (
|
||||
<Image
|
||||
src={row.iconUrl}
|
||||
alt=""
|
||||
width={64}
|
||||
height={64}
|
||||
className="size-16 shrink-0 rounded-lg bg-muted object-contain"
|
||||
/>
|
||||
) : null}
|
||||
<div className="min-w-0">
|
||||
<CardTitle
|
||||
className={cn(
|
||||
"text-3xl text-white",
|
||||
row.isGreat && "text-warning",
|
||||
)}
|
||||
>
|
||||
{metric(row.cumulativePercent)}
|
||||
</CardTitle>
|
||||
<CardDescription className="text-base font-medium text-white">
|
||||
C{row.level} · {row.name}
|
||||
</CardDescription>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="whitespace-pre-line leading-7">{row.detail}</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user