/** * @file * @copyright 2020 Aleksej Komarov * @license MIT */ import { toFixed } from 'common/math'; import { useLocalState } from 'tgui/backend'; import { useDispatch, useSelector } from 'common/redux'; import { Box, Button, ColorBox, Divider, Dropdown, Flex, Input, LabeledList, NumberInput, Section, Stack, Tabs, TextArea } from 'tgui/components'; import { ChatPageSettings } from '../chat'; import { rebuildChat, saveChatToDisk } from '../chat/actions'; import { THEMES } from '../themes'; import { changeSettingsTab, updateSettings } from './actions'; import { FONTS, SETTINGS_TABS } from './constants'; import { selectActiveTab, selectSettings } from './selectors'; export const SettingsPanel = (props, context) => { const activeTab = useSelector(context, selectActiveTab); const dispatch = useDispatch(context); return (
{SETTINGS_TABS.map(tab => ( dispatch(changeSettingsTab({ tabId: tab.id, }))}> {tab.name} ))}
{activeTab === 'general' && ( )} {activeTab === 'chatPage' && ( )}
); }; export const SettingsGeneral = (props, context) => { const { theme, fontFamily, fontSize, lineHeight, highlightText, highlightColor, matchWord, matchCase, } = useSelector(context, selectSettings); const dispatch = useDispatch(context); const [freeFont, setFreeFont] = useLocalState(context, "freeFont", false); return (
dispatch(updateSettings({ theme: value, }))} /> {!freeFont && ( dispatch(updateSettings({ fontFamily: value, }))} /> ) || ( dispatch(updateSettings({ fontFamily: value, }))} /> )}