"use client" import { useState } from "react" import { replaceByParam, getLocaleName } from "@/helper" import { ExtraEffect } from "@/types" import { useTranslations } from "next-intl" type Props = { extras: Record | undefined locale: string } export default function ExtraEffectList({ extras, locale }: Props) { const [openList, setOpenList] = useState(false) const [openId, setOpenId] = useState(null) const transI18n = useTranslations("DataPage") if (!extras || Object.keys(extras).length === 0) return null return (
setOpenList(!openList)} > {transI18n("listExtraEffect")} ({Object.keys(extras).length})
{Object.values(extras).map((extra) => { const isOpen = openId === extra.ID return (
setOpenId(isOpen ? null : extra.ID) } >
{transI18n("extra")} {getLocaleName(locale, extra.Name)}
) })}
) }