gitscope
← marzneshin / v0.3.0-alpha11 / dashboard/src/features/services/dialogs/settings.dialog.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/services/dialogs/settings.dialog.tsx · TypeScript
Blame Raw
 1import {
 2    Sheet,
 3    SheetContent,
 4    SheetHeader,
 5    SheetTitle,
 6    Tabs,
 7    TabsContent,
 8    TabsList,
 9    TabsTrigger,
10} from "@marzneshin/components"
11import { FC } from "react"
12import { useTranslation } from "react-i18next"
13import { ServiceType } from "..";
14import { ServiceInboundsTable } from "../tables/inbounds";
15import { ServicesUsersTable } from "../tables/users";
16
17interface ServicecSettingsDialogProps {
18    onOpenChange: (state: boolean) => void
19    open: boolean
20    entity: ServiceType | null
21}
22
23export const ServiceSettingsDialog: FC<ServicecSettingsDialogProps> = ({ onOpenChange, open, entity }) => {
24
25    const { t } = useTranslation();
26
27    if (entity) {
28        return (
29            <Sheet open={open} onOpenChange={onOpenChange}>
30                <SheetContent className="sm:min-w-full md:min-w-[700px]" >
31                    <SheetHeader>
32                        <SheetTitle>
33                            {t('page.services.settings.title')}
34                        </SheetTitle>
35                    </SheetHeader>
36                    <Tabs className="my-3 w-full h-full" defaultValue="inbounds">
37                        <TabsList className="w-full">
38                            <TabsTrigger className="w-full" value="inbounds">{t('inbounds')}</TabsTrigger>
39                            <TabsTrigger className="w-full" value="users">{t('users')}</TabsTrigger>
40                        </TabsList>
41                        <TabsContent value="inbounds" className="h-full">
42                            <ServiceInboundsTable service={entity} />
43                        </TabsContent>
44                        <TabsContent value="users" className="h-full">
45                            <ServicesUsersTable service={entity} />
46                        </TabsContent>
47                    </Tabs>
48                </SheetContent>
49            </Sheet>
50        )
51    }
52}