import { SidebarMenuTask } from "@/types/globals"; import { Dropdown, DropdownItem, DropdownMenu, DropdownTrigger, Tooltip, User } from '@nextui-org/react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import React, { useEffect, useState } from 'react'; import { ChevronLeftIcon, ChevronRightIcon, FormCustomIcon, FormHorizontalIcon, FormLayoutIcon, FormValidationIcon, FormVerticalIcon } from '../icons'; import { DashboardIcon, HomeIcon, InfoCircleIcon, MinusCircleIcon, TableIcon } from '../icons/sidebar-icon'; import { ThemeSwitch } from '../theme-switch'; import { SidebarCollapseItems } from "./sidebar-collapse-items"; import { SidebarCollapseSubItems } from "./sidebar-collapse-sub-items"; import { useSidebar } from './sidebar-context'; import { SidebarMenu } from "./sidebar-menu"; interface SubMenuItems { id: number; name: string; modulePathUrl: string; isSubActive: boolean; } interface MenuItems { id: number; name: string; modulePathUrl: string; isSubActive: boolean; childMenu?: SubMenuItems[]; icon?: string } interface SidebarProps { sidebarData: boolean; updateSidebarData: (newData: boolean) => void; } const sideBarDummyData = [ { id: 1, name: "Dashboard", moduleId: 652, moduleName: "Dashboard", modulePathUrl: "/admin/dashboard", isGroup: true, parentId: -1, icon: "dashboard", position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 2, name: "Dashboard", moduleId: 652, moduleName: "Dashboard", modulePathUrl: "/admin/dashboard", parentId: -1, icon: , position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 3, name: "Apps", moduleId: 652, moduleName: "Dashboard", modulePathUrl: "/admin/basic", isGroup: true, parentId: -1, icon: "table", position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 4, name: "Artikel", moduleId: 652, moduleName: "Dashboard", modulePathUrl: "/admin/article", parentId: -1, icon: , position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 4, name: "E-Magazine", moduleId: 652, moduleName: "Dashboard", modulePathUrl: "/admin/pagination-basic", parentId: -1, icon: , position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 5, name: "Master", moduleId: 652, moduleName: "Dashboard", isGroup: true, modulePathUrl: "/admin/basic", parentId: -1, icon: "table", position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 6, name: "Master Menu", moduleId: 652, moduleName: "Form Custom", modulePathUrl: "/admin/form-costum", parentId: -1, icon: , position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 7, name: "Master Module", moduleId: 653, moduleName: "Form Horizontal", modulePathUrl: "/admin/form-horizontal", parentId: -1, icon: , position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 8, name: "Master User", moduleId: 654, moduleName: "Form Vertical", modulePathUrl: "/admin/form-vertical", parentId: -1, icon: , position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 9, name: "Master User Levels", moduleId: 655, moduleName: "Form Layout", modulePathUrl: "/admin/form-layout", parentId: -1, icon: , position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, { id: 10, name: "Master User Role", moduleId: 656, moduleName: "Form Validation", modulePathUrl: "/admin/form-validation", parentId: -1, icon: , position: 1, statusId: 1, childMenu: [], statusName: "Active", childModule: null, }, // { // id: 11, // name: "Form Wizard", // moduleId: 657, // moduleName: "Form Wizard", // modulePathUrl: "/admin/form-wizard", // parentId: -1, // icon: , // position: 1, // statusId: 1, // childMenu: [], // statusName: "Active", // childModule: null, // }, // { // id: 13, // name: "Others", // moduleId: 658, // moduleName: "Others", // modulePathUrl: "/admin/basic", // isGroup: true, // parentId: -1, // icon: "table", // position: 1, // statusId: 1, // childMenu: [], // statusName: "Active", // childModule: null, // }, // { // id: 13, // name: "Menu 1", // moduleId: 652, // moduleName: "Menu 1", // modulePathUrl: "/admin/menu1", // parentId: -1, // icon: , // position: 1, // statusId: 1, // statusName: "Active", // childMenu: [ // { // id: 3, // name: "SubMenu 1", // moduleId: 653, // moduleName: "SubMenu 1", // modulePathUrl: "/admin/menu1/submenu1", // parentId: 702, // icon: , // position: 2, // statusId: 1, // statusName: "Active", // childMenu: [], // childModule: null, // }, // { // id: 4, // name: "SubMenu 2", // moduleId: 653, // moduleName: "SubMenu 2", // modulePathUrl: "/admin/menu1/submenu2", // parentId: 702, // icon: , // position: 2, // statusId: 1, // statusName: "Active", // childMenu: [], // childModule: null, // } // ], // childModule: null, // }, ] const Sidebar: React.FC = ({ updateSidebarData }) => { const pathname = usePathname(); const [sidebarMenu, setSidebarMenu] = useState(); const { isOpen, toggleSidebar } = useSidebar(); const closeSidebar = () => { if (isOpen) { toggleSidebar(); } }; useEffect(() => { updateSidebarData(isOpen) }, [isOpen]) const renderIcon = (icon: string) => { switch (icon) { case 'dashboard': return ; case 'menu1': return ; case 'table': return ; default: return null; } }; return ( {!isOpen && } {isOpen && ACME} {isOpen && } Signed in as @tonyreichert Profile Settings Analytics Help & Feedback Log Out {sideBarDummyData ? sideBarDummyData?.map((list: any, index: number) => ( list.isGroup ? {isOpen ? list.name : "..."} : list.childMenu?.length < 1 ? <> {isOpen ? {list.icon} {isOpen && list.name} : {list.icon} {isOpen && list.name} } > : ( )), ]} /> )) : ""} {isOpen && "Theme"} {isOpen ? {isOpen && "Support"} : {isOpen && "Support"} } {isOpen ? {isOpen && "Log Out"} : {isOpen && "Log Out"} } {/* {sideBarDummyData.map((list) => ( ))} {isOpen && ( )} */} ); }; export default Sidebar;
Signed in as
@tonyreichert
{isOpen ? list.name : "..."}