'use client' import { motion } from "framer-motion" import { EyeOff, Eye, Hammer, RefreshCw, ShieldBan, User, Swords, SkipForward, BowArrow, Info, RouteIcon, Search, CupSoda } 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" 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 [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 && ( <> )}
)} {/*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-[300px]" style={{ background: "#1e1e1e", color: "#fff", }} />
)}
) }