feat : keep full quatily for overview and material img and hide codtion 1 when no codition
This commit is contained in:
@@ -148,7 +148,6 @@ export function MaterialPoster({
|
||||
src={characterArtUrl}
|
||||
alt={character.name}
|
||||
fill
|
||||
unoptimized
|
||||
sizes={`${artworkImageSize}px`}
|
||||
quality={POSTER_IMAGE_QUALITY}
|
||||
className="object-contain object-center"
|
||||
@@ -160,7 +159,6 @@ export function MaterialPoster({
|
||||
src={characterArtUrl}
|
||||
alt=""
|
||||
fill
|
||||
unoptimized
|
||||
sizes={`${artworkImageSize}px`}
|
||||
quality={POSTER_IMAGE_QUALITY}
|
||||
className="object-contain object-center"
|
||||
|
||||
@@ -217,6 +217,7 @@ function GuideOverview({
|
||||
alt={`ไกด์ ${guide.name}`}
|
||||
fill
|
||||
sizes="(min-width: 1280px) 600px, (min-width: 1024px) calc(50vw - 44px), calc(100vw - 32px)"
|
||||
quality={100}
|
||||
priority
|
||||
className="object-cover"
|
||||
/>
|
||||
|
||||
@@ -32,7 +32,7 @@ function formattedPercent(value: string | null): string {
|
||||
return `${numeric.toLocaleString("en-US", { maximumFractionDigits: 2 })}%`;
|
||||
}
|
||||
|
||||
function WeaponComparisonImage({
|
||||
export function WeaponComparisonImage({
|
||||
guide,
|
||||
group,
|
||||
metric,
|
||||
@@ -60,7 +60,9 @@ function WeaponComparisonImage({
|
||||
<ExportText th="ดาเมจส่วนตัว" en="Personal Damage" />
|
||||
)}
|
||||
</p>
|
||||
<p className="mt-2 text-2xl font-semibold">{conditionLabel}</p>
|
||||
{conditionLabel ? (
|
||||
<p className="mt-2 text-2xl font-semibold">{conditionLabel}</p>
|
||||
) : null}
|
||||
</header>
|
||||
|
||||
<div className="relative z-10 mt-9 flex flex-col gap-3">
|
||||
@@ -121,8 +123,8 @@ export function WeaponImageExport({
|
||||
conditionIndex: number;
|
||||
}) {
|
||||
const [language, setLanguage] = useExportLanguage();
|
||||
const conditionLabel = group.name || `Condition ${conditionIndex + 1}`;
|
||||
const baseName = `${guide.name}-Weapon-${conditionLabel}`;
|
||||
const conditionLabel = group.name;
|
||||
const baseName = `${guide.name}-Weapon-${conditionLabel || `Condition ${conditionIndex + 1}`}`;
|
||||
const metricOptions = ([
|
||||
["overallPercent", "Overall Damage"],
|
||||
["personalPercent", "Personal Damage"],
|
||||
@@ -159,12 +161,7 @@ export function WeaponImageExport({
|
||||
guide={guide}
|
||||
group={group}
|
||||
metric={metric}
|
||||
conditionLabel={group.name ? conditionLabel : (
|
||||
<ExportText
|
||||
th={`เงื่อนไข ${conditionIndex + 1}`}
|
||||
en={`Condition ${conditionIndex + 1}`}
|
||||
/>
|
||||
)}
|
||||
conditionLabel={conditionLabel}
|
||||
/>
|
||||
</GuideImageExport>
|
||||
))}
|
||||
|
||||
@@ -8,9 +8,29 @@ import {
|
||||
} from "@/components/public/guide-image-export";
|
||||
import { MaterialPoster } from "@/components/public/material-poster";
|
||||
import { ConstellationImage } from "@/components/public/constellation-image";
|
||||
import { WeaponComparisonImage } from "@/components/public/weapon-image-export";
|
||||
import type { PublicGuide } from "@/lib/guides/queries";
|
||||
|
||||
describe("image export controls", () => {
|
||||
it("omits the placeholder condition from weapon export images", () => {
|
||||
const guide = {
|
||||
character: { name: "Raiden", splashImageUrl: "/splash.png" },
|
||||
coverUrl: "/cover.png",
|
||||
} as PublicGuide;
|
||||
const group = { rows: [], name: null, note: null } as unknown as PublicGuide["weaponGroups"][number];
|
||||
const html = renderToStaticMarkup(
|
||||
<WeaponComparisonImage
|
||||
guide={guide}
|
||||
group={group}
|
||||
metric="overallPercent"
|
||||
conditionLabel={group.name}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).not.toContain("Condition 1");
|
||||
expect(html).not.toContain("เงื่อนไข 1");
|
||||
});
|
||||
|
||||
it("always offers both export modes even without notes", () => {
|
||||
const html = renderToStaticMarkup(<GuideImageExport fileName="guide.png">No notes</GuideImageExport>);
|
||||
expect(html).toContain("ส่งออกภาพ");
|
||||
@@ -93,4 +113,21 @@ describe("material poster text", () => {
|
||||
expect(html).not.toContain("วัสดุ");
|
||||
expect(html).not.toContain("เลเวล 90");
|
||||
});
|
||||
|
||||
it("optimizes scale-aware character artwork and bleeding layers for export", () => {
|
||||
const characterArtUrl = "https://buzz-cdn.astrxl.dev/posters/raiden.png";
|
||||
const html = renderToStaticMarkup(
|
||||
<MaterialPoster
|
||||
{...props}
|
||||
characterArtUrl={characterArtUrl}
|
||||
artworkScale={200}
|
||||
bleeding={[{ id: "bleed", imageUrl: characterArtUrl, amount: 50, blendMode: "screen" }]}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("/_next/image?url=https%3A%2F%2Fbuzz-cdn.astrxl.dev%2Fposters%2Fraiden.png");
|
||||
expect(html).toContain("w=3840");
|
||||
expect(html).toContain('sizes="3200px"');
|
||||
expect(html).not.toContain(`src="${characterArtUrl}"`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user