From 8fa651684f3b00c505620fe350d6a89890d24a3d Mon Sep 17 00:00:00 2001 From: gunshiz Date: Tue, 1 Sep 2026 16:03:34 +0700 Subject: [PATCH] fix artifact export layout --- .../[guideId]/artifacts/image/route.tsx | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/app/api/guides/[guideId]/artifacts/image/route.tsx b/app/api/guides/[guideId]/artifacts/image/route.tsx index 8173b7f..3f0d342 100644 --- a/app/api/guides/[guideId]/artifacts/image/route.tsx +++ b/app/api/guides/[guideId]/artifacts/image/route.tsx @@ -119,13 +119,15 @@ export async function GET( const profile = guide.profile; 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 tierListHeight = 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 * 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 + profile.substats.length * 18 : 0) + (detailHeight > 60 ? detailHeight + 16 : 0) + 32 + const profileHeight = profile + ? 242 + (profile.substats.length ? 92 + profile.substats.length * 18 : 0) : 0; + const leftHeight = tierListHeight + (profile ? profileHeight + 16 : 0); + const rightHeight = detailHeight > 60 ? detailHeight : 0; const height = Math.max(520, 190 + Math.max(leftHeight, rightHeight)); return new ImageResponse( @@ -154,7 +156,7 @@ export async function GET(
-
+
60 ? 1.2 : 1, flexDirection: "column", gap: 16 }}> {guide.groups.map((group, groupIndex) => (
))} -
- {profile ? ( -
+ {profile ? (
ออฟหลัก @@ -225,18 +225,21 @@ export async function GET( ))}
+ ) : null} - {profile.substats.length ? ( -
- ลำดับค่าสถานะ: -
- {profile.substats.map((stat, index) => {statLabel(stat)})} -
+ {profile?.substats.length ? ( +
+ ลำดับค่าสถานะ: +
+ {profile.substats.map((stat, index) => {statLabel(stat)})}
- ) : null} +
+ ) : null} +
- {detailHeight > 60 ? ( -
+ {profile && detailHeight > 60 ? ( +
+
รายละเอียดเพิ่มเติม
{profile.targets.length ? (
@@ -274,8 +277,7 @@ export async function GET(
{profile.note}
) : null} -
- ) : null} +
) : null}