/
QuickMeet
/
Chat.Desktop
Обзор
Документация
Войти
/
QuickMeet
/
Chat.Desktop
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/ui/components/SettingsView/SettingsView.tsx
80 строк
2 KB
Jean Brito
fix: Add back button to settings (#2949)
25 сен 2024, 18:07
Не верифицирован
25 сен 2024, 18:07
9391b10
Код
Авторство
О чём код?
import { Box, IconButton, Tabs } from '@rocket.chat/fuselage'; import '@rocket.chat/fuselage-polyfills'; import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; import { dispatch } from '../../../store'; import type { RootState } from '../../../store/rootReducer'; import { DOWNLOADS_BACK_BUTTON_CLICKED } from '../../actions'; import { CertificatesTab } from './CertificatesTab'; import { GeneralTab } from './GeneralTab'; export const SettingsView = () => { const isVisible = useSelector( ({ currentView }: RootState) => currentView === 'settings' ); const { t } = useTranslation(); const [currentTab, setCurrentTab] = useState('general'); const isSideBarEnabled = useSelector( ({ isSideBarEnabled }: RootState) => isSideBarEnabled ); const lastSelectedServerUrl = useSelector( ({ lastSelectedServerUrl }: RootState) => lastSelectedServerUrl ); const handleBackButton = function (): void { dispatch({ type: DOWNLOADS_BACK_BUTTON_CLICKED, payload: lastSelectedServerUrl, }); }; return ( <Box display={isVisible ? 'flex' : 'none'} position='absolute' flexDirection='column' height='full' width='full' className='rcx-sidebar--main' bg='light' > <Box width='full' padding={24} display='flex' flexDirection='row' flexWrap='nowrap' fontScale='h1' color='font-default' > {!isSideBarEnabled && ( <IconButton icon='arrow-back' onClick={handleBackButton} /> )} {t('settings.title')} </Box> <Tabs> <Tabs.Item selected={currentTab === 'general'} onClick={() => setCurrentTab('general')} > {t('settings.general')} </Tabs.Item> <Tabs.Item selected={currentTab === 'certificates'} onClick={() => setCurrentTab('certificates')} > {t('settings.certificates')} </Tabs.Item> </Tabs> <Box m='x24' overflowY='auto'> {(currentTab === 'general' && <GeneralTab />) || (currentTab === 'certificates' && <CertificatesTab />)} </Box> </Box> ); };