fix: path
This commit is contained in:
parent
67b747f0ff
commit
de93de2e6d
@ -6,13 +6,13 @@ const nextConfig: NextConfig = {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: '/',
|
source: '/',
|
||||||
destination: '/en/dashboards/crm',
|
destination: '/en/dashboards/overview',
|
||||||
permanent: true,
|
permanent: true,
|
||||||
locale: false
|
locale: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
source: '/:lang(en|fr|ar)',
|
source: '/:lang(en|fr|ar)',
|
||||||
destination: '/:lang/dashboards/crm',
|
destination: '/:lang/dashboards/overview',
|
||||||
permanent: true,
|
permanent: true,
|
||||||
locale: false
|
locale: false
|
||||||
},
|
},
|
||||||
|
|||||||
@ -91,8 +91,8 @@ const HorizontalMenu = ({ dictionary }: { dictionary: Awaited<ReturnType<typeof
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SubMenu label={dictionary['navigation'].dashboards} icon={<i className='tabler-smart-home' />}>
|
<SubMenu label={dictionary['navigation'].dashboards} icon={<i className='tabler-smart-home' />}>
|
||||||
<MenuItem href={`/${locale}/dashboards/crm`} icon={<i className='tabler-chart-pie-2' />}>
|
<MenuItem href={`/${locale}/dashboards/overview`} icon={<i className='tabler-chart-pie-2' />}>
|
||||||
{dictionary['navigation'].crm}
|
{dictionary['navigation'].overview}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem href={`/${locale}/dashboards/analytics`} icon={<i className='tabler-trending-up' />}>
|
<MenuItem href={`/${locale}/dashboards/analytics`} icon={<i className='tabler-trending-up' />}>
|
||||||
{dictionary['navigation'].analytics}
|
{dictionary['navigation'].analytics}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import { useSettings } from '@core/hooks/useSettings'
|
|||||||
// Util Imports
|
// Util Imports
|
||||||
import { getLocalizedUrl } from '@/utils/i18n'
|
import { getLocalizedUrl } from '@/utils/i18n'
|
||||||
import { useAuthMutation } from '../../../services/mutations/auth'
|
import { useAuthMutation } from '../../../services/mutations/auth'
|
||||||
|
import { useAuth } from '../../../contexts/authContext'
|
||||||
|
|
||||||
// Styled component for badge content
|
// Styled component for badge content
|
||||||
const BadgeContentSpan = styled('span')({
|
const BadgeContentSpan = styled('span')({
|
||||||
@ -42,6 +43,8 @@ const BadgeContentSpan = styled('span')({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const UserDropdown = () => {
|
const UserDropdown = () => {
|
||||||
|
const { currentUser } = useAuth()
|
||||||
|
|
||||||
// States
|
// States
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
@ -85,6 +88,10 @@ const UserDropdown = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!currentUser) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Badge
|
<Badge
|
||||||
@ -124,9 +131,9 @@ const UserDropdown = () => {
|
|||||||
<Avatar alt={'john doe'} src={''} />
|
<Avatar alt={'john doe'} src={''} />
|
||||||
<div className='flex items-start flex-col'>
|
<div className='flex items-start flex-col'>
|
||||||
<Typography className='font-medium' color='text.primary'>
|
<Typography className='font-medium' color='text.primary'>
|
||||||
{'john doe'}
|
{currentUser?.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant='caption'>{'email'}</Typography>
|
<Typography variant='caption'>{currentUser?.email}</Typography>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Divider className='mlb-1' />
|
<Divider className='mlb-1' />
|
||||||
|
|||||||
@ -30,8 +30,8 @@ const defaultSuggestions: DefaultSuggestionsType[] = [
|
|||||||
icon: 'tabler-trending-up'
|
icon: 'tabler-trending-up'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'CRM',
|
label: 'Overview',
|
||||||
href: '/dashboards/crm',
|
href: '/dashboards/overview',
|
||||||
icon: 'tabler-chart-pie-2'
|
icon: 'tabler-chart-pie-2'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,8 +29,8 @@ const noResultData: NoResultData[] = [
|
|||||||
icon: 'tabler-user'
|
icon: 'tabler-user'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'CRM',
|
label: 'Overview',
|
||||||
href: '/dashboards/crm',
|
href: '/dashboards/overview',
|
||||||
icon: 'tabler-chart-donut-3'
|
icon: 'tabler-chart-donut-3'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -55,7 +55,7 @@ export type Config = {
|
|||||||
|
|
||||||
const themeConfig: Config = {
|
const themeConfig: Config = {
|
||||||
templateName: 'APSKEL',
|
templateName: 'APSKEL',
|
||||||
homePageUrl: '/dashboards/crm',
|
homePageUrl: '/dashboards/overview',
|
||||||
settingsCookieName: 'vuexy-mui-next-demo-1',
|
settingsCookieName: 'vuexy-mui-next-demo-1',
|
||||||
mode: 'system', // 'system', 'light', 'dark'
|
mode: 'system', // 'system', 'light', 'dark'
|
||||||
skin: 'default', // 'default', 'bordered'
|
skin: 'default', // 'default', 'bordered'
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import Loading from '../components/layout/shared/Loading'
|
|||||||
type AuthContextType = {
|
type AuthContextType = {
|
||||||
isAuthenticated: boolean
|
isAuthenticated: boolean
|
||||||
token: string | null
|
token: string | null
|
||||||
currentUser: string | null
|
currentUser: any | null
|
||||||
}
|
}
|
||||||
|
|
||||||
const AuthContext = createContext<AuthContextType>({
|
const AuthContext = createContext<AuthContextType>({
|
||||||
@ -17,14 +17,14 @@ const AuthContext = createContext<AuthContextType>({
|
|||||||
|
|
||||||
export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
||||||
const [token, setToken] = useState<string | null>(null)
|
const [token, setToken] = useState<string | null>(null)
|
||||||
const [currentUser, setCurrentUser] = useState<string | null>(null)
|
const [currentUser, setCurrentUser] = useState<any | null>(null)
|
||||||
const [isInitialized, setIsInitialized] = useState(false)
|
const [isInitialized, setIsInitialized] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const savedToken = localStorage.getItem('authToken')
|
const savedToken = localStorage.getItem('authToken')
|
||||||
const savedUser = localStorage.getItem('user')
|
const savedUser = localStorage.getItem('user')
|
||||||
if (savedToken) setToken(savedToken)
|
if (savedToken) setToken(savedToken)
|
||||||
if (savedUser) setCurrentUser(savedUser)
|
if (savedUser) setCurrentUser(JSON.parse(savedUser))
|
||||||
setIsInitialized(true)
|
setIsInitialized(true)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"dashboards": "لوحات القيادة",
|
"dashboards": "لوحات القيادة",
|
||||||
"crm": "إدارة علاقات العملاء",
|
|
||||||
"analytics": "تحليلات",
|
"analytics": "تحليلات",
|
||||||
"eCommerce": "التجارة الإلكترونية",
|
"eCommerce": "التجارة الإلكترونية",
|
||||||
"stock": "المخزون",
|
"stock": "المخزون",
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"dashboards": "Dashboards",
|
"dashboards": "Dashboards",
|
||||||
"crm": "CRM",
|
|
||||||
"analytics": "Analytics",
|
"analytics": "Analytics",
|
||||||
"eCommerce": "eCommerce",
|
"eCommerce": "eCommerce",
|
||||||
"stock": "Stock",
|
"stock": "Stock",
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"dashboards": "Tableaux de bord",
|
"dashboards": "Tableaux de bord",
|
||||||
"crm": "GRC",
|
|
||||||
"analytics": "Analytique",
|
"analytics": "Analytique",
|
||||||
"eCommerce": "commerce électronique",
|
"eCommerce": "commerce électronique",
|
||||||
"stock": "Stock",
|
"stock": "Stock",
|
||||||
|
|||||||
@ -10,9 +10,9 @@ const horizontalMenuData = (dictionary: Awaited<ReturnType<typeof getDictionary>
|
|||||||
children: [
|
children: [
|
||||||
// This is how you will normally render menu item
|
// This is how you will normally render menu item
|
||||||
{
|
{
|
||||||
label: dictionary['navigation'].crm,
|
label: dictionary['navigation'].overview,
|
||||||
icon: 'tabler-chart-pie-2',
|
icon: 'tabler-chart-pie-2',
|
||||||
href: '/dashboards/crm'
|
href: '/dashboards/overview'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: dictionary['navigation'].analytics,
|
label: dictionary['navigation'].analytics,
|
||||||
|
|||||||
@ -14,9 +14,9 @@ const verticalMenuData = (dictionary: Awaited<ReturnType<typeof getDictionary>>)
|
|||||||
children: [
|
children: [
|
||||||
// This is how you will normally render menu item
|
// This is how you will normally render menu item
|
||||||
{
|
{
|
||||||
label: dictionary['navigation'].crm,
|
label: dictionary['navigation'].overview,
|
||||||
icon: 'tabler-circle',
|
icon: 'tabler-circle',
|
||||||
href: '/dashboards/crm'
|
href: '/dashboards/overview'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: dictionary['navigation'].analytics,
|
label: dictionary['navigation'].analytics,
|
||||||
|
|||||||
@ -11,8 +11,8 @@ type SearchData = {
|
|||||||
const data: SearchData[] = [
|
const data: SearchData[] = [
|
||||||
{
|
{
|
||||||
id: '1',
|
id: '1',
|
||||||
name: 'CRM Dashboard',
|
name: 'Overview Dashboard',
|
||||||
url: '/dashboards/crm',
|
url: '/dashboards/overview',
|
||||||
icon: 'tabler-chart-pie-2',
|
icon: 'tabler-chart-pie-2',
|
||||||
section: 'Dashboards'
|
section: 'Dashboards'
|
||||||
},
|
},
|
||||||
|
|||||||
@ -87,7 +87,7 @@ async function updateNextConfig() {
|
|||||||
|
|
||||||
const redirect = `return [{
|
const redirect = `return [{
|
||||||
source: '/',
|
source: '/',
|
||||||
destination: '/dashboards/crm',
|
destination: '/dashboards/overview',
|
||||||
permanent: true
|
permanent: true
|
||||||
}]`
|
}]`
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,7 @@ import { useSettings } from '@core/hooks/useSettings'
|
|||||||
// Util Imports
|
// Util Imports
|
||||||
import { getLocalizedUrl } from '@/utils/i18n'
|
import { getLocalizedUrl } from '@/utils/i18n'
|
||||||
import { useAuthMutation } from '../services/mutations/auth'
|
import { useAuthMutation } from '../services/mutations/auth'
|
||||||
|
import { CircularProgress } from '@mui/material'
|
||||||
|
|
||||||
// Styled Custom Components
|
// Styled Custom Components
|
||||||
const LoginIllustration = styled('img')(({ theme }) => ({
|
const LoginIllustration = styled('img')(({ theme }) => ({
|
||||||
@ -134,7 +135,7 @@ const Login = ({ mode }: { mode: SystemMode }) => {
|
|||||||
const onSubmit: SubmitHandler<FormData> = async (data: FormData) => {
|
const onSubmit: SubmitHandler<FormData> = async (data: FormData) => {
|
||||||
login.mutate(data)
|
login.mutate(data)
|
||||||
|
|
||||||
const redirectURL = searchParams.get('redirectTo') ?? '/'
|
const redirectURL = searchParams.get('redirectTo') ?? '/dashboards/overview'
|
||||||
|
|
||||||
router.replace(getLocalizedUrl(redirectURL, locale as Locale))
|
router.replace(getLocalizedUrl(redirectURL, locale as Locale))
|
||||||
}
|
}
|
||||||
@ -161,12 +162,6 @@ const Login = ({ mode }: { mode: SystemMode }) => {
|
|||||||
<Typography variant='h4'>{`Welcome to ${themeConfig.templateName}! 👋🏻`}</Typography>
|
<Typography variant='h4'>{`Welcome to ${themeConfig.templateName}! 👋🏻`}</Typography>
|
||||||
<Typography>Please sign-in to your account and start the adventure</Typography>
|
<Typography>Please sign-in to your account and start the adventure</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Alert icon={false} className='bg-[var(--mui-palette-primary-lightOpacity)]'>
|
|
||||||
<Typography variant='body2' color='primary.main'>
|
|
||||||
Email: <span className='font-medium'>admin@vuexy.com</span> / Pass:{' '}
|
|
||||||
<span className='font-medium'>admin</span>
|
|
||||||
</Typography>
|
|
||||||
</Alert>
|
|
||||||
<form
|
<form
|
||||||
noValidate
|
noValidate
|
||||||
autoComplete='off'
|
autoComplete='off'
|
||||||
@ -244,7 +239,7 @@ const Login = ({ mode }: { mode: SystemMode }) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Button fullWidth variant='contained' type='submit' disabled={login.isPending}>
|
<Button fullWidth variant='contained' type='submit' disabled={login.isPending}>
|
||||||
{login.isPending ? 'Login...' : 'Login'}
|
{login.isPending ? <CircularProgress size={16} /> : 'Login'}
|
||||||
</Button>
|
</Button>
|
||||||
<div className='flex justify-center items-center flex-wrap gap-2'>
|
<div className='flex justify-center items-center flex-wrap gap-2'>
|
||||||
<Typography>New on our platform?</Typography>
|
<Typography>New on our platform?</Typography>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user