https://dev.kronoz.win/r/marzneshin.git
1import { createFileRoute } from '@tanstack/react-router'
2import {
3 Page,
4} from '@marzneshin/components';
5import { UsersStatsWidget, useUsersStatsQuery } from '@marzneshin/modules/users';
6import { TotalTrafficsWidget } from '@marzneshin/features/total-traffic-widget';
7import { useTranslation } from 'react-i18next';
8import { FC } from 'react';
9
10export const DashboardPage: FC = () => {
11 const { t } = useTranslation();
12 const { data } = useUsersStatsQuery()
13
14 return (
15 <Page className="flex flex-col gap-4 w-full" title={t('home')}>
16 <div className={`grid grid-cols-1 md:grid-cols-12 gap-4`}>
17 <div className={data.total !== 0 ? "md:col-span-8" : "md:col-span-12"}>
18 <TotalTrafficsWidget />
19 </div>
20
21 {data.total !== 0 && (
22 <div className="md:col-span-4">
23 <UsersStatsWidget {...data} />
24 </div>
25 )}
26 </div>
27 </Page>
28 )
29};
30
31
32export const Route = createFileRoute('/_dashboard/')({
33 component: () => <DashboardPage />
34})