/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React, { useContext, useState } from 'react'; import List from '@material-ui/core/List'; import InboxIcon from '@material-ui/icons/Inbox'; import Brightness6Icon from '@material-ui/icons/Brightness6'; import DnsIcon from '@material-ui/icons/Dns'; import EditIcon from '@material-ui/icons/Edit'; import { Button, Dialog, DialogActions, DialogContent, DialogContentText, IconButton, ListItemSecondaryAction, Switch, TextField, ListItemIcon, ListItemText, } from '@material-ui/core'; import ListItem, { ListItemProps } from '@material-ui/core/ListItem'; import NavBarTitle from '../context/NavbarTitle'; import DarkTheme from '../context/DarkTheme'; import useLocalStorage from '../util/useLocalStorage'; function ListItemLink(props: ListItemProps<'a', { button?: true }>) { // eslint-disable-next-line react/jsx-props-no-spreading return ; } export default function Settings() { const { setTitle } = useContext(NavBarTitle); setTitle('Settings'); const { darkTheme, setDarkTheme } = useContext(DarkTheme); const [serverAddress, setServerAddress] = useLocalStorage('serverBaseURL', ''); const [dialogOpen, setDialogOpen] = useState(false); const [dialogValue, setDialogValue] = useState(serverAddress); const handleDialogOpen = () => { setDialogValue(serverAddress); setDialogOpen(true); }; const handleDialogCancel = () => { setDialogOpen(false); }; const handleDialogSubmit = () => { setDialogOpen(false); setServerAddress(dialogValue); }; return ( <> setDarkTheme(!darkTheme)} /> { handleDialogOpen(); }} > Enter new category name. setDialogValue(e.target.value)} /> ); }