@@ -4,6 +4,8 @@ import { Trans, useTranslation } from 'react-i18next';
44import { TabContext , TabList , TabPanel } from '@mui/lab' ;
55import { Badge , Box , Link , Tab , Typography } from '@mui/material' ;
66
7+ import { UnionOfConst } from '@graasp/sdk' ;
8+
79import { AlertTriangle , Info , MessageSquareText , Settings } from 'lucide-react' ;
810
911import { GeneralSettings , SettingsKeys } from '@/config/appSetting' ;
@@ -20,15 +22,16 @@ import {
2022import SettingsView from '../settings/SettingsView' ;
2123import ConversationsView from './ConversationsView' ;
2224
23- enum Tabs {
24- TABLE_VIEW = 'TABLE_VIEW' ,
25- SETTINGS_VIEW = 'SETTINGS_VIEW' ,
26- ABOUT_VIEW = 'ABOUT_VIEW' ,
27- }
25+ const Tabs = {
26+ TABLE_VIEW : 'TABLE_VIEW' ,
27+ SETTINGS_VIEW : 'SETTINGS_VIEW' ,
28+ ABOUT_VIEW : 'ABOUT_VIEW' ,
29+ } as const ;
30+ type TabsType = UnionOfConst < typeof Tabs > ;
2831
2932const AdminView = ( ) : JSX . Element => {
3033 const { t } = useTranslation ( ) ;
31- const [ activeTab , setActiveTab ] = useState ( Tabs . TABLE_VIEW ) ;
34+ const [ activeTab , setActiveTab ] = useState < TabsType > ( Tabs . TABLE_VIEW ) ;
3235
3336 const { data : generalSettings } = hooks . useAppSettings < GeneralSettings > ( {
3437 name : SettingsKeys . ChatbotPrompt ,
@@ -40,7 +43,7 @@ const AdminView = (): JSX.Element => {
4043 < TabList
4144 textColor = "secondary"
4245 indicatorColor = "secondary"
43- onChange = { ( _ , newTab : Tabs ) => setActiveTab ( newTab ) }
46+ onChange = { ( _ , newTab : TabsType ) => setActiveTab ( newTab ) }
4447 centered
4548 >
4649 < Tab
0 commit comments