'use client'; import { useState } from 'react'; import { Settings as Gear, X } from 'lucide-react'; import CopyButton from '@/components/CopyButton'; import Scrim from '@/components/Scrim'; import Switch from '@/components/Switch'; import { CardStyle, GameUpdate } from '@/types'; 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 Permissions = () => ( <> {Object.entries(gameData.settings) .filter(([_key, value]) => typeof value === 'boolean') .map(([key, value]) => ( togglePermission(key)} /> ))} ); const CardStyle = () => (
Card style:
{cardStyleOptions.map((option, index) => ( ))}
); return open ? ( setOpen((prev) => !prev)}>
) : (
); }