dashboard page view done
This commit is contained in:
@ -19,7 +19,7 @@ const Header = () => {
|
||||
return (
|
||||
<header
|
||||
className={clsx(
|
||||
'flex items-center transition-[height] shrink-0 h-[--tw-header-height] bg-[length:600px] bg-no-repeat bg-red-600',
|
||||
'flex items-center transition-[height] shrink-0 h-[--tw-header-height] bg-[length:600px] bg-no-repeat bg-blue-600',
|
||||
headerSticky &&
|
||||
'transition-[height] fixed z-10 top-0 left-0 right-0 shadow-sm backdrop-blur-md bg-white/70 dark:bg-coal-500/70 dark:border-b dark:border-b-coal-100'
|
||||
)}
|
||||
|
||||
@ -53,12 +53,12 @@ const HeaderLogo = () => {
|
||||
alt="logo"
|
||||
/> */}
|
||||
<img
|
||||
src={toAbsoluteUrl('/media/app/app-logo.png')}
|
||||
src={toAbsoluteUrl('/media/app/logo-tt.jpeg')}
|
||||
className="dark:hidden h-14"
|
||||
alt="logo"
|
||||
/>
|
||||
<img
|
||||
src={toAbsoluteUrl('/media/app/app-logo.png')}
|
||||
src={toAbsoluteUrl('/media/app/logo-tt.jpeg')}
|
||||
className="hidden dark:inline-block min-h-[42px]"
|
||||
alt="logo"
|
||||
/>
|
||||
@ -66,7 +66,7 @@ const HeaderLogo = () => {
|
||||
|
||||
<div className="flex items-center">
|
||||
<h3 className={`text-xl hidden md:block ${isSticky ? 'text-black' : 'text-gray-50'}`}>
|
||||
TPAY Dashboard Portal
|
||||
Revenue Dashboard Portal
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -34,9 +34,9 @@ const HeaderTopbar = () => {
|
||||
>
|
||||
{getAuth()?.user.name}
|
||||
</span>
|
||||
<span className={`text-xs ${isSticky ? 'text-gray-700' : 'text-white'}`}>
|
||||
{/* <span className={`text-xs ${isSticky ? 'text-gray-700' : 'text-white'}`}>
|
||||
as {getAuth()?.role_name}
|
||||
</span>
|
||||
</span> */}
|
||||
</div>
|
||||
|
||||
<Menu className="w-12 h-12">
|
||||
|
||||
@ -8,56 +8,69 @@ import {
|
||||
MenuSub,
|
||||
MenuTitle
|
||||
} from '@/components/menu';
|
||||
import { useMenus } from '@/providers';
|
||||
// import { useMenus } from '@/providers';
|
||||
// import { useLocation } from 'react-router';
|
||||
import { useLanguage } from '@/i18n';
|
||||
import { doGetNavbarMenu } from '@/actions/NavbarMenuActions';
|
||||
import { RoleList, MappedMenu } from '@/types/GlobalTypes';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { MappedMenu } from '@/types/GlobalTypes';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Static menu structure (previously fetched from the API via
|
||||
// doGetNavbarMenu). Update `path` values to match your actual route
|
||||
// definitions:
|
||||
// - "Dashboard" points to the real dashboard route.
|
||||
// - Every other item points to "/coming-soon", a shared placeholder page
|
||||
// that just renders "This page will be available soon".
|
||||
// ---------------------------------------------------------------------------
|
||||
const COMING_SOON_PATH = '/coming-soon';
|
||||
|
||||
const STATIC_MENU: MappedMenu[] = [
|
||||
{
|
||||
title: 'Main Dashboard',
|
||||
path: '-',
|
||||
children: [{ title: 'Dashboard', path: '/' }]
|
||||
},
|
||||
{
|
||||
title: 'Revenue',
|
||||
path: '-',
|
||||
children: [
|
||||
{ title: 'SMS', path: COMING_SOON_PATH },
|
||||
{ title: 'Voice', path: COMING_SOON_PATH },
|
||||
{ title: 'Digital Content', path: COMING_SOON_PATH },
|
||||
{ title: 'Refill Packet', path: COMING_SOON_PATH },
|
||||
{ title: 'Refill Voucher', path: COMING_SOON_PATH }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Dealer & Outlet',
|
||||
path: '-',
|
||||
children: [
|
||||
{ title: 'Dealer', path: COMING_SOON_PATH },
|
||||
{ title: 'Outlet', path: COMING_SOON_PATH }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'User Management',
|
||||
path: '-',
|
||||
children: [
|
||||
{ title: 'User List', path: COMING_SOON_PATH },
|
||||
{ title: 'Group Role List', path: COMING_SOON_PATH },
|
||||
{ title: 'Role List', path: COMING_SOON_PATH }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Manage Profile',
|
||||
path: '-',
|
||||
children: [{ title: 'Manage Cell', path: COMING_SOON_PATH }]
|
||||
}
|
||||
];
|
||||
|
||||
const NavbarMenu = () => {
|
||||
// const { pathname } = useLocation();
|
||||
// const { getMenuConfig } = useMenus();
|
||||
// const primaryMenu = getMenuConfig('primary');
|
||||
const { isRTL } = useLanguage();
|
||||
const [menuData, setMenuData] = useState<RoleList[]>([]);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
let navbarMenu;
|
||||
|
||||
useEffect(() => {
|
||||
const fetchNavbarMenu = async () => {
|
||||
try {
|
||||
const result = await doGetNavbarMenu();
|
||||
if (result.status && result.data) {
|
||||
setMenuData(result.data.roles_list);
|
||||
} else {
|
||||
setError(result.message);
|
||||
}
|
||||
} catch (err) {
|
||||
setError('Failed to fetch navbar menu');
|
||||
}
|
||||
};
|
||||
|
||||
fetchNavbarMenu();
|
||||
}, []);
|
||||
|
||||
const mapMenuData = (data: RoleList[]): MappedMenu[] => {
|
||||
return data.map((item) => {
|
||||
const mappedItem: MappedMenu = {
|
||||
title: item.name,
|
||||
path: item.link !== '-' ? item.link : '/'
|
||||
};
|
||||
|
||||
if (item.children && item.children.length > 0) {
|
||||
mappedItem.children = mapMenuData(item.children);
|
||||
}
|
||||
|
||||
return mappedItem;
|
||||
});
|
||||
};
|
||||
|
||||
navbarMenu = mapMenuData(menuData);
|
||||
// navbarMenu = primaryMenu?.[0].children;
|
||||
const navbarMenu: TMenuConfig = STATIC_MENU;
|
||||
|
||||
const buildMenu = (items: TMenuConfig) => {
|
||||
return items.map((item, index) => {
|
||||
@ -149,11 +162,11 @@ const NavbarMenu = () => {
|
||||
<div className="grid">
|
||||
<div className="scrollable-x-auto">
|
||||
<Menu highlight={true} className="gap-5 lg:gap-7.5">
|
||||
{navbarMenu && navbarMenu && buildMenu(navbarMenu)}
|
||||
{navbarMenu && buildMenu(navbarMenu)}
|
||||
</Menu>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { NavbarMenu };
|
||||
export { NavbarMenu };
|
||||
Reference in New Issue
Block a user