import React, { useState } from 'react'; import { createBrowserRouter, RouterProvider, Navigate, Outlet, useLocation, } from 'react-router-dom'; import { SideNav, type NavItemConfig } from '@rkheftan/harmony-ui'; import { Devices, LocationTick, Mobile, PasswordCheck, Personalcard, ProfileCircle, Setting as SettingIcon, Shield, Sms, Menu, } from 'iconsax-react'; import { Box, Typography, useTheme, useMediaQuery, Drawer, AppBar, Toolbar, IconButton, } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { ActiveDevices } from '../components/activeDevices/ActiveDevices'; import { Setting } from '../components/setting/Setting'; import { RecentLogins } from '../components/security/RecentLogins'; import { PasswordSecurity } from '../components/security/PasswordSecurity'; import { PersonalInformation } from '../components/userInformation/PersonalInformation'; import { PhoneNumber } from '../components/userInformation/PhoneNumber'; import { SocialMedia } from '../components/userInformation/SocialMedia'; function Header() { const headers = [{ name: 'محمدحسین برزه گر', phone: '09123456789' }]; return ( {headers.map((h) => ( {h.name} {h.phone} ))} ); } export function Layout() { const theme = useTheme(); const isMdUp = useMediaQuery(theme.breakpoints.up('md')); const location = useLocation(); const { t } = useTranslation('sideMap'); const [drawerOpen, setDrawerOpen] = useState(false); const contentMaxWidth = '100%'; const contentWidthMd = '810px'; const navWidthMd = '274px'; const navConfig: NavItemConfig[] = [ { text: t('side.account'), getIcon: (sel) => sel ? ( ) : ( ), path: '/profile', children: [ { text: t('side.personalInfo'), getIcon: (sel) => sel ? ( ) : ( ), path: '/profile#info', }, { text: t('side.phoneNumber'), getIcon: (sel) => sel ? ( ) : ( ), path: '/profile#contact-info', }, { text: t('side.email'), getIcon: (sel) => sel ? ( ) : ( ), path: '/profile#email', }, ], }, { text: t('side.security'), getIcon: (sel) => sel ? ( ) : ( ), path: '/security', children: [ { text: t('side.password'), getIcon: (sel) => sel ? ( ) : ( ), path: '/security#password', }, { text: t('side.verifiedAddress'), getIcon: (sel) => sel ? ( ) : ( ), path: '/security#locations', }, { text: t('side.recentLogins'), getIcon: (sel) => sel ? ( ) : ( ), path: '/security#sessions', }, ], }, { text: t('side.activeDevices'), getIcon: (sel) => sel ? ( ) : ( ), path: '/devices', }, { text: t('side.settings'), getIcon: (sel) => sel ? ( ) : ( ), path: '/setting', }, ]; return ( {!isMdUp && ( setDrawerOpen(true)} > )} {isMdUp && ( } activePath={location.pathname + location.hash} sideNavVariant="full" positioning="absolute" /> )} {!isMdUp && ( setDrawerOpen(false)} > } activePath={location.pathname + location.hash} sideNavVariant="full" /> )} ); } const router = createBrowserRouter([ { path: '/', element: , children: [ { path: '/', element: }, { path: '/profile', element: (
), }, { path: '/security', element: (
), }, { path: '/devices', element: }, { path: '/setting', element: }, ], }, ]); export function Settings() { return ; }