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';
|
2023-06-04 22:56:15 +00:00
|
|
|
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';
|
2023-06-04 22:56:15 +00:00
|
|
|
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}>
|
2023-06-04 22:56:15 +00:00
|
|
|
<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" />
|
2023-10-19 01:16:21 +00:00
|
|
|
<chakra.span>答疑</chakra.span>
|
2023-09-05 00:34:42 +00:00
|
|
|
</Tab>
|
2023-06-04 22:56:15 +00:00
|
|
|
</TabList>
|
|
|
|
|
2023-06-09 22:11:30 +00:00
|
|
|
<TabPanels overflow="auto" minW={0} flexDir="column" flex={1} display="flex">
|
2023-06-04 22:56:15 +00:00
|
|
|
<TabPanel>
|
|
|
|
<MainTab />
|
|
|
|
</TabPanel>
|
2023-06-09 22:11:30 +00:00
|
|
|
<TabPanel flex={1} display="flex">
|
2023-06-04 22:56:15 +00:00
|
|
|
<SettingsTab />
|
|
|
|
</TabPanel>
|
2023-09-05 00:34:42 +00:00
|
|
|
<TabPanel>
|
|
|
|
<FaqTab />
|
|
|
|
</TabPanel>
|
2023-06-04 22:56:15 +00:00
|
|
|
</TabPanels>
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
<Footer />
|
2023-06-03 13:13:37 +00:00
|
|
|
</Provider>
|
|
|
|
</ChakraProvider>
|
|
|
|
);
|
|
|
|
}
|