feat: update
This commit is contained in:
@@ -8,8 +8,8 @@ import { rarityGradient } from "@/lib/catalog/rarity";
|
||||
import { artifactTierCount } from "@/lib/guides/artifacts";
|
||||
import { getCachedPublicArtifactExport } from "@/lib/cache/public";
|
||||
import { imageContentDisposition } from "@/lib/guides/export-image";
|
||||
import { normalizeTargetStat, statPriorityColor, targetStatIconName, targetStatOptions } from "@/lib/guides/stats";
|
||||
import { normalizeTalentPriorities, talentTypeLabel } from "@/lib/guides/talents";
|
||||
import { normalizeTargetStat, recommendedStatIconName, statPriorityColor, targetStatIconName, targetStatOptions } from "@/lib/guides/stats";
|
||||
import { normalizeTalentPriorities, talentRelationSymbol, talentTypeLabel } from "@/lib/guides/talents";
|
||||
|
||||
const anuphanFonts = Promise.all(
|
||||
[
|
||||
@@ -118,13 +118,21 @@ export async function GET(
|
||||
]);
|
||||
|
||||
const profile = guide.profile;
|
||||
const recommendedStatAsset = (value: string) => {
|
||||
const iconName = recommendedStatIconName(value);
|
||||
const iconIndex = targetStatOptions.findIndex((stat) => targetStatIconName(stat) === iconName);
|
||||
return iconIndex >= 0 ? targetStatAssets[iconIndex] : null;
|
||||
};
|
||||
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 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 mainStatExtraHeight = profile
|
||||
? Math.max(0, Math.max(profile.sands.length, profile.goblet.length, profile.circlet.length) - 2) * 24
|
||||
: 0;
|
||||
const profileHeight = profile
|
||||
? 242 + (profile.substats.length ? 92 + profile.substats.length * 18 : 0)
|
||||
? 242 + mainStatExtraHeight + (profile.substats.length ? 92 + profile.substats.length * 18 : 0)
|
||||
: 0;
|
||||
const leftHeight = tierListHeight + (profile ? profileHeight + 16 : 0);
|
||||
const rightHeight = detailHeight > 60 ? detailHeight : 0;
|
||||
@@ -219,7 +227,7 @@ export async function GET(
|
||||
<div style={{ display: "flex", fontSize: 17, fontWeight: 700 }}>{stat.label}</div>
|
||||
<div style={{ display: "flex", width: "100%", borderTop: "1px solid #34343d" }} />
|
||||
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: 4, fontSize: 14, lineHeight: 1.45 }}>
|
||||
{stat.values.length ? stat.values.map((value, index) => <span key={`${value}-${index}`} style={{ color: statPriorityColor(index), whiteSpace: "normal", wordBreak: "break-word" }}>{statLabel(value)}</span>) : "—"}
|
||||
{stat.values.length ? stat.values.map((value, index) => <span key={`${value}-${index}`} style={{ display: "flex", alignItems: "center", justifyContent: "center", gap: 5, color: statPriorityColor(index), whiteSpace: "normal", wordBreak: "break-word" }}>{recommendedStatAsset(value) ? <img src={recommendedStatAsset(value)!} alt="" width={18} height={18} style={{ objectFit: "contain" }} /> : null}{statLabel(value)}</span>) : "—"}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@@ -229,9 +237,9 @@ export async function GET(
|
||||
|
||||
{profile?.substats.length ? (
|
||||
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: 4, border: "1px solid #34343d", borderRadius: 14, background: "#1d1d25", padding: "16px", fontSize: 14, textAlign: "center" }}>
|
||||
<strong>ลำดับค่าสถานะ:</strong>
|
||||
<strong>ออฟรอง</strong>
|
||||
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: 2 }}>
|
||||
{profile.substats.map((stat, index) => <span key={`${stat}-${index}`} style={{ color: statPriorityColor(index) }}>{statLabel(stat)}</span>)}
|
||||
{profile.substats.map((stat, index) => <span key={`${stat}-${index}`} style={{ display: "flex", alignItems: "center", justifyContent: "center", gap: 5, color: statPriorityColor(index) }}>{recommendedStatAsset(stat) ? <img src={recommendedStatAsset(stat)!} alt="" width={18} height={18} style={{ objectFit: "contain" }} /> : null}{statLabel(stat)}</span>)}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
@@ -248,7 +256,7 @@ export async function GET(
|
||||
const iconIndex = targetStatOptions.findIndex((stat) => stat === normalizeTargetStat(target.stat));
|
||||
return (
|
||||
<div key={`${target.stat}-${target.value}`} style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12, borderRadius: 6, background: index % 2 === 0 ? "#34343d" : "#272730", padding: "5px 8px", fontSize: 15 }}>
|
||||
<span style={{ display: "flex", alignItems: "center", gap: 8 }}>{iconIndex >= 0 ? <img src={targetStatAssets[iconIndex]} alt="" width={28} height={28} style={{ objectFit: "contain" }} /> : null}{normalizeTargetStat(target.stat) ?? target.stat}</span><strong>{target.value}</strong>
|
||||
<span style={{ display: "flex", alignItems: "center", gap: 8 }}>{iconIndex >= 0 ? <img src={targetStatAssets[iconIndex]} alt="" width={14} height={14} style={{ objectFit: "contain" }} /> : null}{normalizeTargetStat(target.stat) ?? target.stat}</span><strong>{target.value}</strong>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
@@ -265,7 +273,7 @@ export async function GET(
|
||||
<span>{talent.type}{talent.level ? ` เลเวล ${talent.level}+` : ""}</span>
|
||||
<span style={{ color: "#b9b9c2", fontSize: 13, fontWeight: 400 }}>{talentTypeLabel(talent.type)}</span>
|
||||
</span>
|
||||
{index < talents.length - 1 ? <span>{talent.relationToNext === "gte" ? ">=" : ">"}</span> : null}
|
||||
{index < talents.length - 1 ? <span>{talentRelationSymbol(talent.relationToNext)}</span> : null}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user