From b69a5261ec36afc6c37d78c64d62f58b60dbbc6f Mon Sep 17 00:00:00 2001 From: AzenKain Date: Thu, 19 Mar 2026 14:30:05 +0700 Subject: [PATCH] UPDATE: New ui --- src/components/eidolonsInfo/index.tsx | 80 +++++++-------- src/components/extraInfo/index.tsx | 98 +++++++++++++++++++ .../skillsInfo/skillDescription.tsx | 30 ++---- 3 files changed, 137 insertions(+), 71 deletions(-) create mode 100644 src/components/extraInfo/index.tsx diff --git a/src/components/eidolonsInfo/index.tsx b/src/components/eidolonsInfo/index.tsx index 0d047f4..512bd8d 100644 --- a/src/components/eidolonsInfo/index.tsx +++ b/src/components/eidolonsInfo/index.tsx @@ -7,6 +7,7 @@ import useUserDataStore from "@/stores/userDataStore"; import { useMemo } from "react"; import { useTranslations } from "next-intl"; import useCurrentDataStore from "@/stores/currentDataStore"; +import ExtraEffectList from '../extraInfo'; export default function EidolonsInfo() { @@ -35,58 +36,43 @@ export default function EidolonsInfo() {
{Object.entries(charRank || {}).map(([key, rank]) => (
{ - let newRank = Number(key) - if (avatars[avatarSelected?.ID || ""]?.data?.rank == Number(key)) { - newRank = Number(key) - 1 - } - setAvatars({ ...avatars, [avatarSelected?.ID || ""]: { ...avatars[avatarSelected?.ID || ""], data: { ...avatars[avatarSelected?.ID || ""].data, rank: newRank } } }) - }} - > - {`Rank + className="flex flex-col items-center" -
- {key}. - +
{ + let newRank = Number(key) + if (avatars[avatarSelected?.ID || ""]?.data?.rank == Number(key)) { + newRank = Number(key) - 1 + } + setAvatars({ ...avatars, [avatarSelected?.ID || ""]: { ...avatars[avatarSelected?.ID || ""], data: { ...avatars[avatarSelected?.ID || ""].data, rank: newRank } } }) + }} + > + {`Rank + +
+ {key}. + +
+
- {Object.values(rank?.Extra || {}).map((extra) => ( -
-
- - Extra Effect - - - {getLocaleName(locale, extra.Name)} - -
- -
-
- ))} +
))} diff --git a/src/components/extraInfo/index.tsx b/src/components/extraInfo/index.tsx new file mode 100644 index 0000000..f6527b3 --- /dev/null +++ b/src/components/extraInfo/index.tsx @@ -0,0 +1,98 @@ +"use client" + +import { useState } from "react" +import { replaceByParam, getLocaleName } from "@/helper" +import { ExtraEffect } from "@/types" + +type Props = { + extras: Record | undefined + locale: string +} + +export default function ExtraEffectList({ extras, locale }: Props) { + const [openList, setOpenList] = useState(false) + const [openId, setOpenId] = useState(null) + + if (!extras || Object.keys(extras).length === 0) return null + + return ( +
+
setOpenList(!openList)} + > + + List Extra Effect ({Object.keys(extras).length}) + + + + ▶ + +
+ +
+
+ {Object.values(extras).map((extra) => { + const isOpen = openId === extra.ID + + return ( +
+
+ setOpenId(isOpen ? null : extra.ID) + } + > +
+ + Extra + + + + {getLocaleName(locale, extra.Name)} + +
+ + + ▶ + +
+ +
+
+
+
+ ) + })} +
+
+
+ ) +} \ No newline at end of file diff --git a/src/components/skillsInfo/skillDescription.tsx b/src/components/skillsInfo/skillDescription.tsx index f61af7d..8abc2ac 100644 --- a/src/components/skillsInfo/skillDescription.tsx +++ b/src/components/skillsInfo/skillDescription.tsx @@ -1,5 +1,6 @@ import { getLocaleName, replaceByParam } from "@/helper"; import { AvatarStore, SkillDetail, SkillTreePoint } from "@/types"; +import ExtraEffectList from "../extraInfo"; export const SkillDescription = ({ skill, locale, avatarData, skillInfo }: { skill: SkillDetail, @@ -12,8 +13,8 @@ export const SkillDescription = ({ skill, locale, avatarData, skillInfo }: { const descHtml = getLocaleName(locale, skill.Desc) || getLocaleName(locale, skill.SimpleDesc); const extraList = Object.values(skill.Extra).length > 0 - ? Object.values(skill.Extra) - : Object.values(skill?.SimpleExtra || {}); + ? skill.Extra + : skill?.SimpleExtra || {}; return (
@@ -32,28 +33,9 @@ export const SkillDescription = ({ skill, locale, avatarData, skillInfo }: { />
- {extraList.map((extra) => ( -
-
- - Extra Effect - - - {getLocaleName(locale, extra.Name)} - -
- -
-
- ))} + {Object.keys(extraList).length > 0 && ( + + )}
); }; \ No newline at end of file