feat(admin-images) : add standalone export generators
CI / Verify (push) Successful in 1m29s
CI / Build immutable images and deploy (push) Failing after 1m42s

This commit is contained in:
2026-09-29 17:13:24 +07:00 Unverified
parent 76478fe56d
commit db554228bc
21 changed files with 1179 additions and 64 deletions
+15 -2
View File
@@ -6,6 +6,19 @@ import type { PublicGuide } from "@/lib/guides/queries";
import { constellationChartRows } from "@/lib/guides/export-image";
import { cn } from "@/lib/utils";
export type ConstellationImageGuide = Pick<PublicGuide, "coverUrl"> & {
character: Pick<PublicGuide["character"], "name" | "splashImageUrl">;
};
export interface ConstellationImageGroup {
note: string | null;
rows: Array<{
level: number;
cumulativePercent: string;
isGreat: boolean;
}>;
}
function percentage(value: number): string {
return `${value.toLocaleString("en-US", { maximumFractionDigits: 2 })}%`;
}
@@ -14,8 +27,8 @@ export function ConstellationImage({
guide,
group,
}: {
guide: PublicGuide;
group: PublicGuide["constellationGroups"][number];
guide: ConstellationImageGuide;
group: ConstellationImageGroup;
}) {
const rows = constellationChartRows(group.rows);
const background = guide.character.splashImageUrl ?? guide.coverUrl;
+28 -1
View File
@@ -37,6 +37,33 @@ import {
} from "@/lib/guides/team-search";
import { cn } from "@/lib/utils";
export interface TeamExportData {
title: string;
rotationSeconds: string | number;
combo: string;
members: Array<{
position: number;
constellation: string;
refinement: string;
damage: string | number;
character: {
key: string;
name: string;
imageUrl: string;
element: string | null;
rarity: number | null;
};
weapon: {
key: string;
name: string;
imageUrl: string;
rarity: number | null;
} | null;
artifact: TeamArtifact | null;
secondArtifact: TeamArtifact | null;
}>;
}
type Team = PublicGuide["teams"][number];
const teamSearchTargetLabels: Record<TeamSearchTarget, string> = {
all: "ทั้งหมด",
@@ -179,7 +206,7 @@ export function TeamArtifactIcon({
);
}
function TeamExportImage({ team }: { team: Team }) {
export function TeamExportImage({ team }: { team: TeamExportData }) {
const total = team.members.reduce((sum, member) => sum + Number(member.damage), 0);
const seconds = Number(team.rotationSeconds);
return (
+17 -3
View File
@@ -21,12 +21,26 @@ import {
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import type { PublicGuide } from "@/lib/guides/queries";
type WeaponExportGuide = Pick<PublicGuide, "name" | "coverUrl"> & {
export type WeaponExportGuide = Pick<PublicGuide, "name" | "coverUrl"> & {
character: Pick<PublicGuide["character"], "name" | "splashImageUrl">;
};
type WeaponGroup = PublicGuide["weaponGroups"][number];
type DamageMetric = "overallPercent" | "personalPercent";
export interface WeaponGroup {
name: string | null;
note: string | null;
rows: Array<{
id: string;
refinement: string;
overallPercent: string | null;
personalPercent: string | null;
note: string | null;
weapon: {
name: string;
imageUrl: string;
};
}>;
}
export type DamageMetric = "overallPercent" | "personalPercent";
function formattedPercent(value: string | null): string {
if (value === null) return "-%";