'use client' import { motion } from "framer-motion" import { EyeOff, Eye, Hammer, RefreshCw, ShieldBan, User, Swords, SkipForward, BowArrow, Info, RouteIcon, Search, CupSoda, UsersIcon } from "lucide-react" import useGlobalStore from '@/stores/globalStore' import { useTranslations } from "next-intl" import { getLocaleName, getNameChar } from "@/helper" import useLocaleStore from "@/stores/localeStore" import SelectCustomImage from "../select/customSelectImage" import { useMemo, useState } from "react" import useDetailDataStore from "@/stores/detailDataStore" import Editor from "react-simple-code-editor" import Prism from "prismjs" import "prismjs/components/prism-lua" import "prismjs/themes/prism-tomorrow.css" import { SimpleAvatarCard } from "../card/simpleCharacterCard" export default function ExtraSettingBar() { const { extraData, setExtraData, isEnableChangePath, setIsEnableChangePath, isEnableLua, setIsEnableLua } = useGlobalStore() const transI18n = useTranslations("DataPage") const { mapAvatar, mapPeak, stage, baseType } = useDetailDataStore() const { locale } = useLocaleStore() const [showSearchStage, setShowSearchStage] = useState(false) const [showSearchLineup, setShowSearchLineup] = useState(false) const [isChildClick, setIsChildClick] = useState(false) const [stageSearchTerm, setStageSearchTerm] = useState("") const [stagePage, setStagePage] = useState(1) const pageSize = 30 const stageList = useMemo(() => Object.values(stage), [stage]) const term = stageSearchTerm.toLowerCase() const filteredStages = useMemo(() => stageList.filter((s) => getLocaleName(locale, s.Name).toLowerCase().includes(term) || String(s.ID).toLowerCase().includes(term) ), [stageList, term, locale]) const paginatedStages = useMemo(() => filteredStages.slice( (stagePage - 1) * pageSize, stagePage * pageSize ), [filteredStages, stagePage, pageSize]) const hasMorePages = useMemo(() => stagePage * pageSize < filteredStages.length, [stagePage, filteredStages]) const onChangeSearch = (v: string) => { setStageSearchTerm(v) setStagePage(1) } return (
{extraData?.theory_craft && (

{transI18n("theoryCraft")}

{extraData?.theory_craft?.mode && ( <>
{(extraData?.theory_craft?.custom_lineup || []).length > 0 && ( (extraData?.theory_craft?.custom_lineup || []).map((avatarId) => { const avatarData = mapAvatar[avatarId]; if (!avatarData) return null; return ( { const newLineup = (extraData?.theory_craft?.custom_lineup || []).filter(id => id !== avatarId); setExtraData({ ...extraData, theory_craft: { stage_id: extraData?.theory_craft?.stage_id ?? 30118121, cycle_count: extraData?.theory_craft?.cycle_count ?? 1, mode: extraData?.theory_craft?.mode ?? false, hp: extraData?.theory_craft?.hp ?? {}, custom_lineup: newLineup } }); }} /> ); }) )}
{showSearchLineup && (
e.stopPropagation()} className="mt-2 w-full z-50 border bg-base-200 border-slate-600 rounded-lg p-4 shadow-2xl" >
{transI18n("selectedCharacters")}
{Object.values(mapAvatar).map((avatar) => { const currentLineup = extraData?.theory_craft?.custom_lineup || []; const isSelected = currentLineup.includes(avatar.ID.toString()); return ( { const idStr = avatar.ID.toString(); let newLineup = [...currentLineup]; if (isSelected) { newLineup = newLineup.filter(id => id !== idStr); } else { newLineup.push(idStr); } setExtraData({ ...extraData, theory_craft: { stage_id: extraData?.theory_craft?.stage_id ?? 30118121, cycle_count: extraData?.theory_craft?.cycle_count ?? 1, mode: extraData?.theory_craft?.mode ?? false, hp: extraData?.theory_craft?.hp ?? {}, custom_lineup: newLineup } }); }} /> ); })}
)}
)}
)} {/*MULTIPATH CHAR */}

{transI18n("multipathCharacter")}
setIsEnableChangePath(e.target.checked)} />

{isEnableChangePath && ( <> )}
{/* CHALLENGE */}

{transI18n("challenge")}

{/*EXTRA FEATURES */}

{transI18n("extraFeatures")}

{extraData?.setting?.hide_ui !== undefined && ( )} {extraData?.setting?.censorship !== undefined && ( )}

{"Lua"}
setIsEnableLua(e.target.checked)} />

{isEnableLua && ( <>
setExtraData( { ...extraData, lua: code } ) } highlight={(code) => Prism.highlight(code, Prism.languages.lua, "lua")} padding={16} textareaClassName="outline-none" className="text-sm font-mono min-h-75" style={{ background: "#1e1e1e", color: "#fff", }} />
)}
) }