forked from purpleio/purple-admin-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
42 lines (33 loc) · 1.15 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { useDashboard } from "@/client/sample/dashboard";
import { getDefaultLayout, IDefaultLayoutPage, IPageHeader } from "@/components/layout/default-layout";
import CalendarSample from "@/components/page/index/calendar-sample";
import StatisticSample from "@/components/page/index/statistic-sample";
import { useAuth } from "@/lib/auth/auth-provider";
import { Alert, Divider, Skeleton } from "antd";
const pageHeader: IPageHeader = {
title: "Welcome",
};
const IndexPage: IDefaultLayoutPage = () => {
const { session } = useAuth();
const { data, error } = useDashboard();
return (
<>
<h2 className="title">👋 {session.user.name || "관리자"}님 안녕하세요!</h2>
<div className="my-5">
{data ? (
<StatisticSample data={data} />
) : error ? (
<Alert message="대시보드 API 호출 중 오류가 발생했습니다." type="warning" />
) : (
<Skeleton />
)}
</div>
<Divider />
<h3 className="title">달력</h3>
<CalendarSample />
</>
);
};
IndexPage.getLayout = getDefaultLayout;
IndexPage.pageHeader = pageHeader;
export default IndexPage;