import { Text, SegmentedControl, TextInput, Stack } from '@mantine/core'; import { useState } from 'react'; import { useConfig } from '../../tools/state'; import { ColorSchemeSwitch } from '../ColorSchemeToggle/ColorSchemeSwitch'; import { WidgetsPositionSwitch } from '../WidgetsPositionSwitch/WidgetsPositionSwitch'; import ConfigChanger from '../Config/ConfigChanger'; import SaveConfigComponent from '../Config/SaveConfig'; import ModuleEnabler from './ModuleEnabler'; import Tip from '../layout/Tip'; export default function CommonSettings(args: any) { const { config, setConfig } = useConfig(); 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=' }, { label: 'Custom', value: 'Custom' }, ]; const [customSearchUrl, setCustomSearchUrl] = useState(config.settings.searchUrl); const [searchUrl, setSearchUrl] = useState( matches.find((match) => match.value === config.settings.searchUrl)?.value ?? 'Custom' ); return ( Search engine Use the prefixes !yt and !t in front of your query to search on YouTube or for a Torrent respectively. { setSearchUrl(e); setConfig({ ...config, settings: { ...config.settings, searchUrl: e, }, }); } } data={matches} /> {searchUrl === 'Custom' && ( <> %s can be used as a placeholder for the query. { setCustomSearchUrl(event.currentTarget.value); setConfig({ ...config, settings: { ...config.settings, searchUrl: event.currentTarget.value, }, }); }} /> )} Upload your config file by dragging and dropping it onto the page! ); }