import { ActionIcon, Group, Modal, Switch, Title, Text, Tooltip, SegmentedControl, } from '@mantine/core'; import { useColorScheme } from '@mantine/hooks'; import { useState } from 'react'; import { Settings as SettingsIcon } from 'tabler-icons-react'; import { useConfig } from '../../tools/state'; import { ColorSchemeSwitch } from '../ColorSchemeToggle/ColorSchemeSwitch'; import SaveConfigComponent from '../Config/SaveConfig'; import ModuleEnabler from './ModuleEnabler'; function SettingsMenu(props: any) { const { config, setConfig } = useConfig(); const colorScheme = useColorScheme(); const matches = [ { label: 'Google', value: 'https://google.com/search?q=' }, { label: 'DuckDuckGo', value: 'https://duckduckgo.com/?q=' }, { label: 'Bing', value: 'https://bing.com/search?q=' }, ]; return ( match.value === config.settings.searchUrl)?.value || 'Google' } onChange={ // Set config.settings.searchUrl to the value of the selected item (e) => setConfig({ ...config, settings: { ...config.settings, searchUrl: e, }, }) } data={matches} /> Search engine setConfig({ ...config, settings: { ...config.settings, searchBar: e.currentTarget.checked, }, }) } checked={config.settings.searchBar} label="Enable search bar" /> tip: You can upload your config file by dragging and dropping it onto the page ); } export function SettingsMenuButton(props: any) { const [opened, setOpened] = useState(false); return ( <> Settings} opened={props.opened || opened} onClose={() => setOpened(false)} > setOpened(true)} > ); }