diff --git a/next.config.ts b/next.config.ts index e9ef6f0..e21db92 100644 --- a/next.config.ts +++ b/next.config.ts @@ -6,13 +6,13 @@ const nextConfig: NextConfig = { return [ { source: '/', - destination: '/en/dashboards/crm', + destination: '/en/dashboards/overview', permanent: true, locale: false }, { source: '/:lang(en|fr|ar)', - destination: '/:lang/dashboards/crm', + destination: '/:lang/dashboards/overview', permanent: true, locale: false }, diff --git a/src/app/[lang]/(dashboard)/(private)/apps/ecommerce/orders/detail/page.tsx b/src/app/[lang]/(dashboard)/(private)/apps/ecommerce/orders/detail/page.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/components/layout/horizontal/HorizontalMenu.tsx b/src/components/layout/horizontal/HorizontalMenu.tsx index 290a675..af9bbac 100644 --- a/src/components/layout/horizontal/HorizontalMenu.tsx +++ b/src/components/layout/horizontal/HorizontalMenu.tsx @@ -91,8 +91,8 @@ const HorizontalMenu = ({ dictionary }: { dictionary: Awaited }> - }> - {dictionary['navigation'].crm} + }> + {dictionary['navigation'].overview} }> {dictionary['navigation'].analytics} diff --git a/src/components/layout/shared/UserDropdown.tsx b/src/components/layout/shared/UserDropdown.tsx index 6ba4184..95e6708 100644 --- a/src/components/layout/shared/UserDropdown.tsx +++ b/src/components/layout/shared/UserDropdown.tsx @@ -30,6 +30,7 @@ import { useSettings } from '@core/hooks/useSettings' // Util Imports import { getLocalizedUrl } from '@/utils/i18n' import { useAuthMutation } from '../../../services/mutations/auth' +import { useAuth } from '../../../contexts/authContext' // Styled component for badge content const BadgeContentSpan = styled('span')({ @@ -42,6 +43,8 @@ const BadgeContentSpan = styled('span')({ }) const UserDropdown = () => { + const { currentUser } = useAuth() + // States const [open, setOpen] = useState(false) @@ -85,6 +88,10 @@ const UserDropdown = () => { } } + if (!currentUser) { + return null + } + return ( <> {
- {'john doe'} + {currentUser?.name} - {'email'} + {currentUser?.email}
diff --git a/src/components/layout/shared/search/DefaultSuggestions.tsx b/src/components/layout/shared/search/DefaultSuggestions.tsx index db6d2f5..d7a343c 100644 --- a/src/components/layout/shared/search/DefaultSuggestions.tsx +++ b/src/components/layout/shared/search/DefaultSuggestions.tsx @@ -30,8 +30,8 @@ const defaultSuggestions: DefaultSuggestionsType[] = [ icon: 'tabler-trending-up' }, { - label: 'CRM', - href: '/dashboards/crm', + label: 'Overview', + href: '/dashboards/overview', icon: 'tabler-chart-pie-2' }, { diff --git a/src/components/layout/shared/search/NoResult.tsx b/src/components/layout/shared/search/NoResult.tsx index 0231906..61784f7 100644 --- a/src/components/layout/shared/search/NoResult.tsx +++ b/src/components/layout/shared/search/NoResult.tsx @@ -29,8 +29,8 @@ const noResultData: NoResultData[] = [ icon: 'tabler-user' }, { - label: 'CRM', - href: '/dashboards/crm', + label: 'Overview', + href: '/dashboards/overview', icon: 'tabler-chart-donut-3' } ] diff --git a/src/configs/themeConfig.ts b/src/configs/themeConfig.ts index 1242763..a0805ba 100644 --- a/src/configs/themeConfig.ts +++ b/src/configs/themeConfig.ts @@ -55,7 +55,7 @@ export type Config = { const themeConfig: Config = { templateName: 'APSKEL', - homePageUrl: '/dashboards/crm', + homePageUrl: '/dashboards/overview', settingsCookieName: 'vuexy-mui-next-demo-1', mode: 'system', // 'system', 'light', 'dark' skin: 'default', // 'default', 'bordered' diff --git a/src/contexts/authContext.tsx b/src/contexts/authContext.tsx index cd8af9e..70db8a8 100644 --- a/src/contexts/authContext.tsx +++ b/src/contexts/authContext.tsx @@ -6,7 +6,7 @@ import Loading from '../components/layout/shared/Loading' type AuthContextType = { isAuthenticated: boolean token: string | null - currentUser: string | null + currentUser: any | null } const AuthContext = createContext({ @@ -17,14 +17,14 @@ const AuthContext = createContext({ export const AuthProvider = ({ children }: { children: React.ReactNode }) => { const [token, setToken] = useState(null) - const [currentUser, setCurrentUser] = useState(null) + const [currentUser, setCurrentUser] = useState(null) const [isInitialized, setIsInitialized] = useState(false) useEffect(() => { const savedToken = localStorage.getItem('authToken') const savedUser = localStorage.getItem('user') if (savedToken) setToken(savedToken) - if (savedUser) setCurrentUser(savedUser) + if (savedUser) setCurrentUser(JSON.parse(savedUser)) setIsInitialized(true) }, []) diff --git a/src/data/dictionaries/ar.json b/src/data/dictionaries/ar.json index abe3fb1..f1d047a 100644 --- a/src/data/dictionaries/ar.json +++ b/src/data/dictionaries/ar.json @@ -1,7 +1,6 @@ { "navigation": { "dashboards": "لوحات القيادة", - "crm": "إدارة علاقات العملاء", "analytics": "تحليلات", "eCommerce": "التجارة الإلكترونية", "stock": "المخزون", diff --git a/src/data/dictionaries/en.json b/src/data/dictionaries/en.json index 3498401..c367431 100644 --- a/src/data/dictionaries/en.json +++ b/src/data/dictionaries/en.json @@ -1,7 +1,6 @@ { "navigation": { "dashboards": "Dashboards", - "crm": "CRM", "analytics": "Analytics", "eCommerce": "eCommerce", "stock": "Stock", diff --git a/src/data/dictionaries/fr.json b/src/data/dictionaries/fr.json index 6b71d4c..ea7e5a1 100644 --- a/src/data/dictionaries/fr.json +++ b/src/data/dictionaries/fr.json @@ -1,7 +1,6 @@ { "navigation": { "dashboards": "Tableaux de bord", - "crm": "GRC", "analytics": "Analytique", "eCommerce": "commerce électronique", "stock": "Stock", diff --git a/src/data/navigation/horizontalMenuData.tsx b/src/data/navigation/horizontalMenuData.tsx index cefd853..e1322fd 100644 --- a/src/data/navigation/horizontalMenuData.tsx +++ b/src/data/navigation/horizontalMenuData.tsx @@ -10,9 +10,9 @@ const horizontalMenuData = (dictionary: Awaited children: [ // This is how you will normally render menu item { - label: dictionary['navigation'].crm, + label: dictionary['navigation'].overview, icon: 'tabler-chart-pie-2', - href: '/dashboards/crm' + href: '/dashboards/overview' }, { label: dictionary['navigation'].analytics, diff --git a/src/data/navigation/verticalMenuData.tsx b/src/data/navigation/verticalMenuData.tsx index 22ee48d..823476f 100644 --- a/src/data/navigation/verticalMenuData.tsx +++ b/src/data/navigation/verticalMenuData.tsx @@ -14,9 +14,9 @@ const verticalMenuData = (dictionary: Awaited>) children: [ // This is how you will normally render menu item { - label: dictionary['navigation'].crm, + label: dictionary['navigation'].overview, icon: 'tabler-circle', - href: '/dashboards/crm' + href: '/dashboards/overview' }, { label: dictionary['navigation'].analytics, diff --git a/src/data/searchData.ts b/src/data/searchData.ts index d56a58b..26ac316 100644 --- a/src/data/searchData.ts +++ b/src/data/searchData.ts @@ -11,8 +11,8 @@ type SearchData = { const data: SearchData[] = [ { id: '1', - name: 'CRM Dashboard', - url: '/dashboards/crm', + name: 'Overview Dashboard', + url: '/dashboards/overview', icon: 'tabler-chart-pie-2', section: 'Dashboards' }, diff --git a/src/remove-translation-scripts/findAndReplaceInFiles.ts b/src/remove-translation-scripts/findAndReplaceInFiles.ts index 3461c47..fe6b414 100644 --- a/src/remove-translation-scripts/findAndReplaceInFiles.ts +++ b/src/remove-translation-scripts/findAndReplaceInFiles.ts @@ -87,7 +87,7 @@ async function updateNextConfig() { const redirect = `return [{ source: '/', - destination: '/dashboards/crm', + destination: '/dashboards/overview', permanent: true }]` diff --git a/src/views/Login.tsx b/src/views/Login.tsx index c3f609f..d1934e3 100644 --- a/src/views/Login.tsx +++ b/src/views/Login.tsx @@ -45,6 +45,7 @@ import { useSettings } from '@core/hooks/useSettings' // Util Imports import { getLocalizedUrl } from '@/utils/i18n' import { useAuthMutation } from '../services/mutations/auth' +import { CircularProgress } from '@mui/material' // Styled Custom Components const LoginIllustration = styled('img')(({ theme }) => ({ @@ -134,7 +135,7 @@ const Login = ({ mode }: { mode: SystemMode }) => { const onSubmit: SubmitHandler = async (data: FormData) => { login.mutate(data) - const redirectURL = searchParams.get('redirectTo') ?? '/' + const redirectURL = searchParams.get('redirectTo') ?? '/dashboards/overview' router.replace(getLocalizedUrl(redirectURL, locale as Locale)) } @@ -161,12 +162,6 @@ const Login = ({ mode }: { mode: SystemMode }) => { {`Welcome to ${themeConfig.templateName}! 👋🏻`} Please sign-in to your account and start the adventure - - - Email: admin@vuexy.com / Pass:{' '} - admin - -
{
New on our platform?