import SettingsIcon from '@mui/icons-material/Settings' import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, IconButton, MenuItem, Stack, TextField, Tooltip } from '@mui/material' import { useState } from 'react' import { DEFAULT_SETTINGS, REFRESH_CHOICES, refreshLabel, saveBrowserSettings, useBrowserSettings } from './settings.ts' /** * An icon button that opens the settings of this browser: how often the Overview and the Metrics tab read the router on * their own, or manual, when they read only when opened and on Refresh. A change applies at once and is kept in the * browser; Defaults sets every setting back. */ export default function SettingsButton() { const [open, setOpen] = useState(false) const settings = useBrowserSettings() return ( <> setOpen(true)}> setOpen(false)} maxWidth="xs" fullWidth> Settings Kept in this browser; other browsers keep their own. saveBrowserSettings({ ...settings, routerRefresh: Number(event.target.value) })} > {REFRESH_CHOICES.map((seconds) => {refreshLabel(seconds)})} saveBrowserSettings({ ...settings, metricsRefresh: Number(event.target.value) })} > {REFRESH_CHOICES.map((seconds) => {refreshLabel(seconds)})} ) }