From d3fb065da39b574d1266340aa0efcc3be1aa990e Mon Sep 17 00:00:00 2001 From: gunshiz Date: Sun, 6 Sep 2026 20:00:46 +0700 Subject: [PATCH] feat : update --- components/public/material-poster.tsx | 23 ++++++++++++++++++----- next.config.ts | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/components/public/material-poster.tsx b/components/public/material-poster.tsx index 7c261fc..86fc6f6 100644 --- a/components/public/material-poster.tsx +++ b/components/public/material-poster.tsx @@ -21,6 +21,10 @@ type PosterCharacter = { leveling: Array & { items: PosterMaterial[] }>; }; +const POSTER_EXPORT_WIDTH = 1600; +const POSTER_IMAGE_QUALITY = 100; +const MAX_OPTIMIZED_IMAGE_WIDTH = 3840; + const statLabels: Record = { hp: "HP", atk: "ATK", @@ -77,6 +81,10 @@ export function MaterialPoster({ const materials = mergePosterMaterials( [...character.ascension, ...character.leveling].flatMap((group) => group.items), ); + const artworkImageSize = Math.min( + MAX_OPTIMIZED_IMAGE_WIDTH, + Math.max(POSTER_EXPORT_WIDTH, Math.ceil(POSTER_EXPORT_WIDTH * artworkScale / 100)), + ); const background = `linear-gradient(180deg, ${topColors[0]} 0%, ${topColors[1]} 22%, rgba(0,0,0,0) 42%, rgba(0,0,0,0) 62%, ${bottomColors[0]} 88%, ${bottomColors[1]} 100%)`; function handlePointerDown(event: PointerEvent) { @@ -120,7 +128,8 @@ export function MaterialPoster({ src={character.nameCardImageUrl} alt="" fill - sizes="(min-width: 1024px) 800px, 100vw" + sizes={`${POSTER_EXPORT_WIDTH}px`} + quality={POSTER_IMAGE_QUALITY} className="object-cover opacity-75" priority={!interactive} /> @@ -135,7 +144,8 @@ export function MaterialPoster({ src={characterArtUrl} alt={character.name} fill - sizes="(min-width: 1024px) 800px, 100vw" + sizes={`${artworkImageSize}px`} + quality={POSTER_IMAGE_QUALITY} className="object-contain object-center" priority={!interactive} /> @@ -145,7 +155,8 @@ export function MaterialPoster({ src={characterArtUrl} alt="" fill - sizes="(min-width: 1024px) 800px, 100vw" + sizes={`${artworkImageSize}px`} + quality={POSTER_IMAGE_QUALITY} className="object-contain object-center" style={{ opacity: Math.max(0, Math.min(100, layer.amount)) / 100, mixBlendMode: layer.blendMode }} /> @@ -156,7 +167,8 @@ export function MaterialPoster({ src="/img/mat/fade.png" alt="" fill - sizes="(min-width: 1024px) 800px, 100vw" + sizes={`${POSTER_EXPORT_WIDTH}px`} + quality={POSTER_IMAGE_QUALITY} className="pointer-events-none object-cover opacity-50" priority={!interactive} /> @@ -185,6 +197,7 @@ export function MaterialPoster({ alt="" width={64} height={64} + quality={POSTER_IMAGE_QUALITY} className="size-[3.5cqw] shrink-0 object-contain brightness-0 invert" /> ) : null} @@ -204,7 +217,7 @@ export function MaterialPoster({ {materials.map((material, index) => (
- {material.imageUrl ? : null} + {material.imageUrl ? : null}
×{material.amount.toLocaleString("en-US")} diff --git a/next.config.ts b/next.config.ts index 7cf718c..35acedf 100644 --- a/next.config.ts +++ b/next.config.ts @@ -14,6 +14,7 @@ const nextConfig: NextConfig = { allowedDevOrigins: ["astral"], output: "standalone", images: { + qualities: [75, 100], remotePatterns: [ { protocol: "https", hostname: "buzz-cdn.astrxl.dev", pathname: "/**" }, ],