um-react/src/components/AppRoot.tsx

58 lines
1.7 KiB
TypeScript
Raw Normal View History

2023-06-03 13:13:37 +00:00
import { useEffect } from 'react';
2023-09-05 00:34:42 +00:00
import { MdSettings, MdHome, MdQuestionAnswer } from 'react-icons/md';
import { ChakraProvider, Tabs, TabList, TabPanels, Tab, TabPanel, Icon, chakra } from '@chakra-ui/react';
import { MainTab } from '~/tabs/MainTab';
import { SettingsTab } from '~/tabs/SettingsTab';
2023-06-03 13:13:37 +00:00
import { Provider } from 'react-redux';
import { theme } from '~/theme';
import { persistSettings } from '~/features/settings/persistSettings';
import { setupStore } from '~/store';
import { Footer } from '~/components/Footer';
2023-09-05 00:34:42 +00:00
import { FaqTab } from '~/tabs/FaqTab';
2023-06-03 13:13:37 +00:00
// Private to this file only.
const store = setupStore();
export function AppRoot() {
useEffect(() => persistSettings(store), []);
return (
<ChakraProvider theme={theme}>
<Provider store={store}>
<Tabs flex={1} minH={0} display="flex" flexDir="column">
<TabList justifyContent="center">
<Tab>
<Icon as={MdHome} mr="1" />
<chakra.span></chakra.span>
</Tab>
<Tab>
<Icon as={MdSettings} mr="1" />
<chakra.span></chakra.span>
</Tab>
2023-09-05 00:34:42 +00:00
<Tab>
<Icon as={MdQuestionAnswer} mr="1" />
<chakra.span></chakra.span>
</Tab>
</TabList>
2023-06-09 22:11:30 +00:00
<TabPanels overflow="auto" minW={0} flexDir="column" flex={1} display="flex">
<TabPanel>
<MainTab />
</TabPanel>
2023-06-09 22:11:30 +00:00
<TabPanel flex={1} display="flex">
<SettingsTab />
</TabPanel>
2023-09-05 00:34:42 +00:00
<TabPanel>
<FaqTab />
</TabPanel>
</TabPanels>
</Tabs>
<Footer />
2023-06-03 13:13:37 +00:00
</Provider>
</ChakraProvider>
);
}