From 90d3ac6ee10bfb374c88d0f0b0decc7d463b1f7d Mon Sep 17 00:00:00 2001 From: AzenKain Date: Mon, 6 Oct 2025 00:08:56 +0700 Subject: [PATCH] UPDATE: substats count --- src/components/quickView/index.tsx | 4 +-- src/components/showcaseCard/index.tsx | 25 ++++++++++++++++--- src/components/showcaseCard/relicShowcase.tsx | 9 ++++--- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/components/quickView/index.tsx b/src/components/quickView/index.tsx index ffceb03..ee2afb8 100644 --- a/src/components/quickView/index.tsx +++ b/src/components/quickView/index.tsx @@ -443,9 +443,9 @@ export default function QuickView() {
{relicStats?.map((relic, index) => { - if (!relic) return null + if (!relic || !avatarInfo) return null return ( - + ) })} diff --git a/src/components/showcaseCard/index.tsx b/src/components/showcaseCard/index.tsx index 80a1201..99839cb 100644 --- a/src/components/showcaseCard/index.tsx +++ b/src/components/showcaseCard/index.tsx @@ -173,6 +173,20 @@ export default function ShowCaseInfo() { }) }, [avatarSelected, avatarProfile, mapMainAffix, mapSubAffix]) + const totalSubStats = useMemo(() => { + if (!relicStats?.length) return 0 + return (relicStats ?? []).reduce((acc, relic) => { + const subAffixList = relic?.subAffix ?? [] + return acc + subAffixList.reduce((subAcc, subAffix) => { + if (avatarInfo?.Relics?.SubAffixPropertyList.findIndex(it => it === subAffix.property) !== -1) { + return subAcc + (subAffix?.count ?? 0) + } + return subAcc + }, 0) + }, 0) + }, [relicStats, avatarInfo]) + + const characterStats = useMemo(() => { if (!avatarSelected || !avatarData) return const charPromotion = calcPromotion(avatarData.level) @@ -588,12 +602,17 @@ export default function ShowCaseInfo() {
-
+
Lv. {avatarData?.level}/80
+ + {totalSubStats} + + {avatarSelected && (
+
)} @@ -886,9 +905,9 @@ export default function ShowCaseInfo() {
{relicStats?.map((relic, index) => { - if (!relic) return null + if (!relic || !avatarInfo) return null return ( - + ) })} diff --git a/src/components/showcaseCard/relicShowcase.tsx b/src/components/showcaseCard/relicShowcase.tsx index 6760e2a..96029ac 100644 --- a/src/components/showcaseCard/relicShowcase.tsx +++ b/src/components/showcaseCard/relicShowcase.tsx @@ -2,12 +2,14 @@ "use client" import NextImage from "next/image" -import { RelicShowcaseType } from "@/types"; +import { CharacterDetail, RelicShowcaseType } from "@/types"; export default function RelicShowcase({ relic, + avatarInfo, }: { relic: RelicShowcaseType; + avatarInfo: CharacterDetail; }) { return ( <> @@ -83,9 +85,10 @@ export default function RelicShowcase({ +{subAffix?.valueAffix + subAffix?.detail?.unit} - {subAffix.count > 1 && ( + { + (avatarInfo?.Relics?.SubAffixPropertyList.findIndex((item) => item === subAffix?.property) !== -1) && ( - {subAffix?.count-1} + {subAffix?.count} )}