'use client'; import { useState } from 'react'; import { Settings as Gear } from 'lucide-react'; import { Cinzel_Decorative } from 'next/font/google'; import BuyMeACoffee from '@/components/BuyMeACoffee'; import CopyButton from '@/components/CopyButton'; import GitHubButton from '@/components/GitHubButton'; import Scrim from '@/components/Scrim'; import Switch from '@/components/Switch'; import { CardStyle, GameUpdate } from '@/types'; const cinzel = Cinzel_Decorative({ variable: '--font-cinzel', subsets: ['latin'], weight: '400', }); type SettingsProps = { gameData: GameUpdate; changeAction: (updatedSettings: GameUpdate) => void; }; const cardStyleOptions: CardStyle[] = ['standard', 'color', 'grayscale']; export default function Settings({ gameData, changeAction }: SettingsProps) { const [open, setOpen] = useState(false); const togglePermission = (key: string) => { changeAction({ ...gameData, settings: { ...gameData.settings, [key]: !gameData.settings[key], }, }); }; const tuneRadio = (cardStyle: CardStyle) => { changeAction({ ...gameData, settings: { ...gameData.settings, cardStyle, }, }); }; const Links = () => ( <> > ); const Permissions = () => ( <> {Object.entries(gameData.settings) .filter(([_key, value]) => typeof value === 'boolean') .map(([key, value]) => ( togglePermission(key)} /> ))} > ); const CardStyle = () => ( Card style: {cardStyleOptions.map((option, index) => ( tuneRadio(option)} className="sr-only" /> {option} ))} ); return ( setOpen((prev) => !prev)} className={`transition-all duration-250 ${open ? 'pointer-events-auto opacity-100' : 'pointer-events-none opacity-0'}`} > setOpen((prev) => !prev)} > ); }