import { getCurrent } from '@tauri-apps/api/webviewWindow'; import { createGlobalState, useKeyPressEvent } from 'react-use'; import { capitalize } from '../../lib/capitalize'; import { TabContent, Tabs } from '../core/Tabs/Tabs'; import { SettingsAppearance } from './SettingsAppearance'; import { SettingsGeneral } from './SettingsGeneral'; enum Tab { General = 'general', Appearance = 'appearance', } const tabs = [Tab.General, Tab.Appearance]; const useTabState = createGlobalState(tabs[0]!); export const Settings = () => { const [tab, setTab] = useTabState(); // Close settings window on escape // TODO: Could this be put in a better place? Eg. in Rust key listener when creating the window useKeyPressEvent('Escape', () => getCurrent().close()); return ( <>
Settings
({ value, label: capitalize(value) }))} > ); };