import axios from 'axios'; import { ReactNode, useEffect, useState } from 'react'; import { ruleset, userPreferences } from '../api/api'; import { DialogBox } from './dialogBox'; import { Button, CheckBox, Input, Vierkant } from './ui'; import BuildOutlinedIcon from '@material-ui/icons/BuildOutlined'; export function CurrentGameSettings() { var [editGameRulesDialogVisible, setEditGameRulesDialogVisible] = useState(false); var [ruleset, setRuleset] = useState({ timelimit: { enabled: false, shared: false, minutes: 0, seconds: 0, addmove: 0, }, ranked: false, }); useEffect(() => { axios.request<{ preferences: userPreferences; }>({ method: 'get', url: `/api/user/preferences`, headers: { 'content-type': 'application/json' }, }) .then(request => setRuleset(request.data.preferences.ruleset)) .catch(() => {}); }, []); var timelimit_str = ruleset.timelimit.enabled ? `${ruleset.timelimit.minutes}m${ruleset.timelimit.seconds}s plus ${ruleset.timelimit.addmove}` : 'Geen tijdslimiet'; var ranked_str = ruleset.ranked ? 'Gerangschikt' : 'Niet gerangschikt'; return

{timelimit_str}
{ranked_str}

setEditGameRulesDialogVisible(false)} setGameRules={setRuleset} ruleset={ruleset} visible={editGameRulesDialogVisible} />
; } function GameSettingsSection(props: { children?: ReactNode; title: string; state: boolean; noMarginBottom?: boolean; id: string; }) { return {props.title}
{props.children}
; } function GameRule(props: { title: string; description: string; }) { return

{props.title}

{props.description}

; } type editGameSettingsProps = { visible: boolean; ruleset: ruleset; hideEditGameRules: () => void; setGameRules: (newRules: ruleset) => void; }; export function EditGameSettings(props: editGameSettingsProps) { return ; }