diff --git a/src/components/Layout/Header.tsx b/src/components/Layout/Header.tsx index 9121b43..729c651 100644 --- a/src/components/Layout/Header.tsx +++ b/src/components/Layout/Header.tsx @@ -1,4 +1,4 @@ -import { Box, IconButton, Typography } from '@mui/material'; +import { Box, IconButton, Skeleton, Typography } from '@mui/material'; import { Icon } from '@rkheftan/harmony-ui'; import { More } from 'iconsax-react'; import type { UserInfo } from '@/contexts/AuthContext'; @@ -7,7 +7,7 @@ interface HeaderProps { user: UserInfo; } -export const Header: React.FC = ({ user }) => { +export const Header: React.FC = ({ user, loading }) => { return ( { const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('md')); const [sideNavOpen, setSideNavOpen] = useState(false); - const { userInfo } = useAuth(); return ( @@ -45,7 +44,9 @@ export const Layout = () => { setSideNavOpen={setSideNavOpen} user={userInfo} /> - + + + = ({ setSideNavOpen, isMobile, user, + loading, }) => { return ( = ({ )} - {/* */} - LOGO placeholder + ('/Profile/GetProfile'); + return apiClient.post('/Profile/GetProfile', {}); } export async function saveProfile(payload: { diff --git a/src/routes/config.tsx b/src/routes/config.tsx index 1aa145c..6eef082 100644 --- a/src/routes/config.tsx +++ b/src/routes/config.tsx @@ -1,15 +1,4 @@ import { Layout } from '@/components'; -import { - AuthenticationPage, - ForgetPasswordPage, - UserCompletionPage, -} from '@/features/authorization'; -import { - ActiveDevicesPage, - SecurityPage, - SettingPage, - UserInformationPage, -} from '@/features/profile'; import { Calendar, Devices, @@ -23,9 +12,45 @@ import { Sms, type Icon, } from 'iconsax-react'; -import { type ReactNode } from 'react'; +import { lazy, type ReactNode } from 'react'; import { Navigate } from 'react-router-dom'; +const AuthenticationPage = lazy(() => + import('@/features/authorization').then((module) => ({ + default: module.AuthenticationPage, + })), +); +const UserCompletionPage = lazy(() => + import('@/features/authorization').then((module) => ({ + default: module.UserCompletionPage, + })), +); +const ForgetPasswordPage = lazy(() => + import('@/features/authorization').then((module) => ({ + default: module.ForgetPasswordPage, + })), +); +const UserInformationPage = lazy(() => + import('@/features/profile').then((module) => ({ + default: module.UserInformationPage, + })), +); +const SecurityPage = lazy(() => + import('@/features/profile').then((module) => ({ + default: module.SecurityPage, + })), +); +const ActiveDevicesPage = lazy(() => + import('@/features/profile').then((module) => ({ + default: module.ActiveDevicesPage, + })), +); +const SettingPage = lazy(() => + import('@/features/profile').then((module) => ({ + default: module.SettingPage, + })), +); + export interface RouteConfig { path: string; element?: ReactNode;