From 3d3cb7a45e801de470607ae6e1f4eaf30e9b2c55 Mon Sep 17 00:00:00 2001 From: Gavin McDonald Date: Wed, 23 Apr 2025 15:50:21 -0400 Subject: [PATCH] update Settings --- components/Settings.tsx | 121 +++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 58 deletions(-) diff --git a/components/Settings.tsx b/components/Settings.tsx index f05bc33..4d604d4 100644 --- a/components/Settings.tsx +++ b/components/Settings.tsx @@ -4,20 +4,18 @@ 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 PermissionTogglePanelProps = { +type SettingsProps = { gameData: GameUpdate; changeAction: (updatedSettings: GameUpdate) => void; }; const cardStyleOptions: CardStyle[] = ['standard', 'color', 'grayscale']; -export default function PermissionTogglePanel({ - gameData, - changeAction, -}: PermissionTogglePanelProps) { +export default function Settings({ gameData, changeAction }: SettingsProps) { const [open, setOpen] = useState(false); const togglePermission = (key: string) => { @@ -40,66 +38,73 @@ export default function PermissionTogglePanel({ }); }; - return ( -
- {!open && ( - - )} + const Permissions = () => ( + <> + {Object.entries(gameData.settings) + .filter(([_key, value]) => typeof value === 'boolean') + .map(([key, value]) => ( + togglePermission(key)} /> + ))} + + ); - {open && ( -
- - - - {Object.entries(gameData.settings) - .filter(([_key, value]) => typeof value === 'boolean') - .map(([key, value]) => ( - togglePermission(key)} - /> - ))} -
-
Card style:
-
- {cardStyleOptions.map((option, index) => ( -
- )} + > + tuneRadio(option)} + className="sr-only" + /> + {option} + + ))} +
+ + ); + + return open ? ( + setOpen((prev) => !prev)}> +
+ + + + +
+
+ ) : ( +
+
); }