feat : fix bug
CI / Verify (push) Successful in 1m0s
CI / Build immutable images and deploy (push) Successful in 1m40s

This commit is contained in:
2026-08-30 12:30:12 +00:00 Unverified
parent 811678fd52
commit 4335b54d49
13 changed files with 7161 additions and 49 deletions
@@ -70,8 +70,9 @@ export async function GET(
const { guideId } = await context.params;
const guide = await getPublicArtifactExport(guideId);
if (!guide) return new Response("Guide not found", { status: 404 });
const talents = normalizeTalentPriorities(guide.profile?.talents ?? []);
const [fonts, groupAssets, statIconAssets] = await Promise.all([
const [fonts, groupAssets, statIconAssets, talentAssets] = await Promise.all([
anuphanFonts,
Promise.all(
guide.groups.map((group) =>
@@ -88,18 +89,22 @@ export async function GET(
localPngDataUrl("Icon_Goblet_of_Eonothem.webp"),
localPngDataUrl("Icon_Circlet_of_Logos.webp"),
]),
Promise.all(talents.map((talent) => {
const catalogTalent = guide.character.talents.find((item) => item.type === talent.type);
return catalogTalent?.iconUrl ? pngDataUrl(catalogTalent.iconUrl) : null;
})),
]);
const profile = guide.profile;
const leftHeight = guide.groups.reduce((sum, group) => sum + 68 + group.rows.length * 76, 0) + Math.max(0, guide.groups.length - 1) * 16;
const groupRowHeights = guide.groups.map((group) => group.rows.map((row) => Math.max(76, 76 + (row.note ? Math.ceil(row.note.length / 58) * 22 : 0))));
const leftHeight = guide.groups.reduce((sum, _group, groupIndex) => sum + 68 + groupRowHeights[groupIndex].reduce((groupSum, rowHeight) => groupSum + rowHeight, 0), 0) + Math.max(0, guide.groups.length - 1) * 16;
const detailHeight = profile
? 60 + profile.targets.length * 30 + (profile.talents.length ? 58 : 0) + (profile.note ? Math.max(48, Math.ceil(profile.note.length / 58) * 24) : 0)
? 60 + profile.targets.length * 30 + (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
: 0;
const height = Math.max(520, 190 + Math.max(leftHeight, rightHeight));
const talents = normalizeTalentPriorities(profile?.talents ?? []);
return new ImageResponse(
<div
@@ -143,7 +148,7 @@ export async function GET(
</div>
<div style={{ display: "flex", flexDirection: "column", padding: "0 20px 14px" }}>
{group.rows.map((row, rowIndex) => (
<div key={row.id} style={{ display: "flex", minHeight: 76, alignItems: "center", gap: 14 }}>
<div key={row.id} style={{ display: "flex", minHeight: groupRowHeights[groupIndex][rowIndex], alignItems: "center", gap: 14 }}>
<div style={{ display: "flex", width: row.second ? 94 : 58 }}>
{groupAssets[groupIndex][rowIndex].first ? (
<div style={{ display: "flex", width: 58, height: 58, overflow: "hidden", border: "1px solid #ffffff2a", borderRadius: 10, background: rarityGradient(row.first.rarity) }}>
@@ -156,8 +161,11 @@ export async function GET(
</div>
) : null}
</div>
<div style={{ display: "flex", flex: 1, fontSize: 18, fontWeight: 700 }}>
{rowIndex + 1}. {row.first.name}{row.second ? ` + ${row.second.name}` : ""}
<div style={{ display: "flex", flex: 1, flexDirection: "column", gap: 5 }}>
<div style={{ display: "flex", fontSize: 18, fontWeight: 700 }}>
{rowIndex + 1}. {row.first.name}{row.second ? ` + ${row.second.name}` : ""}
</div>
{row.note ? <div style={{ display: "flex", color: "#b9b9c2", fontSize: 14, lineHeight: 1.55 }}>{row.note}</div> : null}
</div>
<div style={{ display: "flex", fontSize: 26, fontWeight: 700 }}>
{metric(row.percent)}
@@ -215,9 +223,10 @@ export async function GET(
{talents.length ? (
<div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
<div style={{ display: "flex", color: "#b9b9c2", fontSize: 14, fontWeight: 700 }}>ลำดับการอัพพรสวรรค์</div>
<div style={{ display: "flex", gap: 10, fontSize: 17, fontWeight: 700 }}>
<div style={{ display: "flex", alignItems: "center", gap: 10, fontSize: 17, fontWeight: 700 }}>
{talents.map((talent, index) => (
<div key={talent.type} style={{ display: "flex", gap: 10 }}>
<div key={talent.type} style={{ display: "flex", alignItems: "center", gap: 8 }}>
{talentAssets[index] ? <img src={talentAssets[index]!} alt="" width={42} height={42} style={{ objectFit: "contain" }} /> : null}
<span>{talent.type}{talent.level ? ` Lv.${talent.level}+` : ""}</span>
{index < talents.length - 1 ? <span>{talent.relationToNext === "gte" ? ">=" : ">"}</span> : null}
</div>