From 7d8d4b561e053fda76bffdd9d807cdee6b8a12a6 Mon Sep 17 00:00:00 2001 From: gunshiz Date: Sun, 30 Aug 2026 15:15:55 +0000 Subject: [PATCH] style : readble img --- .../[guideId]/artifacts/image/route.tsx | 18 +++++++++------ components/public/structured-guide.tsx | 22 ++++++++++--------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/app/api/guides/[guideId]/artifacts/image/route.tsx b/app/api/guides/[guideId]/artifacts/image/route.tsx index c07e87c..d1df9bf 100644 --- a/app/api/guides/[guideId]/artifacts/image/route.tsx +++ b/app/api/guides/[guideId]/artifacts/image/route.tsx @@ -56,8 +56,9 @@ async function pngDataUrl(url: string): Promise { } } -async function localPngDataUrl(fileName: string, size: number | null = 96): Promise { - const image = sharp(join(process.cwd(), "public", "icon", fileName)); +async function localPngDataUrl(fileName: string, size: number | null = 96, white = false): Promise { + let image = sharp(join(process.cwd(), "public", "icon", fileName)); + if (white) image = image.negate(); const png = await (size === null ? image : image.resize(size, size, { fit: "contain" })) .png() .toBuffer(); @@ -94,7 +95,7 @@ export async function GET( const catalogTalent = guide.character.talents.find((item) => item.type === talent.type); return catalogTalent?.iconUrl ? pngDataUrl(catalogTalent.iconUrl) : null; })), - Promise.all(targetStatOptions.map((stat) => localPngDataUrl(`stats/${targetStatIconName(stat)}.webp`))), + Promise.all(targetStatOptions.map((stat) => localPngDataUrl(`stats/${targetStatIconName(stat)}.webp`, 96, true))), localPngDataUrl("Watermark.png", null), ]); @@ -105,7 +106,7 @@ export async function GET( ? 60 + profile.targets.length * 40 + (profile.talents.length ? 82 : 0) + (profile.note ? Math.max(48, Math.ceil(profile.note.length / 58) * 24) : 0) : 0; const rightHeight = profile - ? 242 + (profile.substats.length ? 76 : 0) + (detailHeight > 60 ? detailHeight + 16 : 0) + 32 + ? 242 + (profile.substats.length ? 76 + profile.substats.length * 18 : 0) + (detailHeight > 60 ? detailHeight + 16 : 0) + 32 : 0; const height = Math.max(520, 190 + Math.max(leftHeight, rightHeight)); @@ -200,7 +201,7 @@ export async function GET(
{stat.label}
- {stat.values.length ? stat.values.map((value, index) => {statLabel(value)}) : "—"} + {stat.values.length ? stat.values.map((value, index) => {statLabel(value)}) : "—"}
))} @@ -208,8 +209,11 @@ export async function GET( {profile.substats.length ? ( -
- Stat Priority: {profile.substats.map((stat, index) => {index ? " > " : ""}{statLabel(stat)})} +
+ Stat Priority: +
+ {profile.substats.map((stat, index) => {statLabel(stat)})} +
) : null} diff --git a/components/public/structured-guide.tsx b/components/public/structured-guide.tsx index eb6cdb3..f31c95c 100644 --- a/components/public/structured-guide.tsx +++ b/components/public/structured-guide.tsx @@ -370,13 +370,15 @@ function ArtifactSection({ guide }: { guide: PublicGuide }) { {profile.substats.length ? ( - - Stat Priority:{" "} - {profile.substats.map((stat, index) => ( - - {index ? " > " : ""}{statLabel(stat)} - - ))} + + Stat Priority: +
+ {profile.substats.map((stat, index) => ( + + {statLabel(stat)} + + ))} +
) : null} @@ -396,7 +398,7 @@ function ArtifactSection({ guide }: { guide: PublicGuide }) { )} > - {targetStatIconName(target.stat) ? : null} + {targetStatIconName(target.stat) ? : null} {normalizeTargetStat(target.stat) ?? target.stat} {target.value} @@ -460,10 +462,10 @@ function ArtifactStat({ iconSrc, label, values }: { iconSrc: string; label: stri

{label}

-
+
{values.length ? values.map((value, index) => ( - + {statLabel(value)} ))