build-address added tested
This commit is contained in:
@@ -1,51 +1,30 @@
|
||||
"use client"
|
||||
|
||||
import { IconCirclePlusFilled, IconMail, type Icon } from "@tabler/icons-react"
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
SidebarGroup,
|
||||
SidebarGroupContent,
|
||||
SidebarMenu,
|
||||
SidebarMenuButton,
|
||||
SidebarMenuItem,
|
||||
} from "@/components/ui/sidebar"
|
||||
import Link from "next/link"
|
||||
import { type Icon } from "@tabler/icons-react"
|
||||
import { SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "@/components/ui/sidebar"
|
||||
import { usePathname } from 'next/navigation'
|
||||
|
||||
export function NavMain({
|
||||
items,
|
||||
}: {
|
||||
items: {
|
||||
title: string
|
||||
url: string
|
||||
icon?: Icon
|
||||
}[]
|
||||
}) {
|
||||
const pathname = usePathname()
|
||||
const linkRenderActive = (item: { title: string; url: string; icon?: Icon }) =>
|
||||
<Link key={`${item.title}-${item.url}`} href={item.url}>
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton tooltip={item.title}>
|
||||
{item.icon && <item.icon />}
|
||||
<span>{item.title}</span>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
</Link>
|
||||
interface NavMainProps {
|
||||
title: string
|
||||
url: string
|
||||
icon?: Icon
|
||||
}
|
||||
|
||||
const linkRenderDisabled = (item: { title: string; url: string; icon?: Icon }) =>
|
||||
export function NavMain({ items }: { items: NavMainProps[] }) {
|
||||
const pathname = usePathname()?.split("/")[1]
|
||||
const linkRenderActive = (item: NavMainProps) =>
|
||||
<Link key={`${item.title}-${item.url}`} href={item.url}><SidebarMenuItem>
|
||||
<SidebarMenuButton tooltip={item.title}>{item.icon && <item.icon />}<span>{item.title}</span></SidebarMenuButton>
|
||||
</SidebarMenuItem></Link>
|
||||
const linkRenderDisabled = (item: NavMainProps) =>
|
||||
<SidebarMenuItem key={`${item.title}-${item.url}`} className="opacity-50 bg-gray-300 border-gray-300 border-2 rounded-2xl">
|
||||
<SidebarMenuButton disabled tooltip={item.title}>
|
||||
{item.icon && <item.icon />}
|
||||
<span>{item.title}</span>
|
||||
</SidebarMenuButton>
|
||||
<SidebarMenuButton disabled tooltip={item.title}>{item.icon && <item.icon />}<span>{item.title}</span></SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
|
||||
return (
|
||||
<SidebarGroup>
|
||||
<SidebarGroupContent className="flex flex-col gap-2">
|
||||
<SidebarMenu>
|
||||
{items.map((item) => pathname?.includes(item.url) ? linkRenderDisabled(item) : linkRenderActive(item))}
|
||||
{items.map((item) => pathname?.toLocaleLowerCase() === item.url?.split("/")[1].toLocaleLowerCase() ? linkRenderDisabled(item) : linkRenderActive(item))}
|
||||
</SidebarMenu>
|
||||
</SidebarGroupContent>
|
||||
</SidebarGroup>
|
||||
|
||||
@@ -14,10 +14,11 @@ import {
|
||||
IconInnerShadowTop,
|
||||
IconListDetails,
|
||||
IconReport,
|
||||
IconSearch,
|
||||
IconAddressBook,
|
||||
IconSettings,
|
||||
IconUsers,
|
||||
IconBuilding
|
||||
IconBuilding,
|
||||
IconTypeface
|
||||
} from "@tabler/icons-react"
|
||||
|
||||
import { NavMain } from "@/components/dashboard/nav-main"
|
||||
@@ -57,98 +58,98 @@ const data = {
|
||||
url: "/build",
|
||||
icon: IconBuilding,
|
||||
},
|
||||
// {
|
||||
// title: "Projects",
|
||||
// url: "#",
|
||||
// icon: IconFolder,
|
||||
// },
|
||||
// {
|
||||
// title: "Team",
|
||||
// url: "#",
|
||||
// icon: IconUsers,
|
||||
// },
|
||||
{
|
||||
title: "Build Types",
|
||||
url: "/build-types",
|
||||
icon: IconTypeface,
|
||||
},
|
||||
{
|
||||
title: "Build Addresses",
|
||||
url: "/build-address",
|
||||
icon: IconAddressBook,
|
||||
}
|
||||
],
|
||||
navClouds: [
|
||||
{
|
||||
title: "Capture",
|
||||
icon: IconCamera,
|
||||
isActive: true,
|
||||
url: "#",
|
||||
items: [
|
||||
{
|
||||
title: "Active Proposals",
|
||||
url: "#",
|
||||
},
|
||||
{
|
||||
title: "Archived",
|
||||
url: "#",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Proposal",
|
||||
icon: IconFileDescription,
|
||||
url: "#",
|
||||
items: [
|
||||
{
|
||||
title: "Active Proposals",
|
||||
url: "#",
|
||||
},
|
||||
{
|
||||
title: "Archived",
|
||||
url: "#",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Prompts",
|
||||
icon: IconFileAi,
|
||||
url: "#",
|
||||
items: [
|
||||
{
|
||||
title: "Active Proposals",
|
||||
url: "#",
|
||||
},
|
||||
{
|
||||
title: "Archived",
|
||||
url: "#",
|
||||
},
|
||||
],
|
||||
},
|
||||
// {
|
||||
// title: "Capture",
|
||||
// icon: IconCamera,
|
||||
// isActive: true,
|
||||
// url: "#",
|
||||
// items: [
|
||||
// {
|
||||
// title: "Active Proposals",
|
||||
// url: "#",
|
||||
// },
|
||||
// {
|
||||
// title: "Archived",
|
||||
// url: "#",
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// title: "Proposal",
|
||||
// icon: IconFileDescription,
|
||||
// url: "#",
|
||||
// items: [
|
||||
// {
|
||||
// title: "Active Proposals",
|
||||
// url: "#",
|
||||
// },
|
||||
// {
|
||||
// title: "Archived",
|
||||
// url: "#",
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// title: "Prompts",
|
||||
// icon: IconFileAi,
|
||||
// url: "#",
|
||||
// items: [
|
||||
// {
|
||||
// title: "Active Proposals",
|
||||
// url: "#",
|
||||
// },
|
||||
// {
|
||||
// title: "Archived",
|
||||
// url: "#",
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
],
|
||||
navSecondary: [
|
||||
{
|
||||
title: "Settings",
|
||||
url: "#",
|
||||
icon: IconSettings,
|
||||
},
|
||||
{
|
||||
title: "Get Help",
|
||||
url: "#",
|
||||
icon: IconHelp,
|
||||
},
|
||||
{
|
||||
title: "Search",
|
||||
url: "#",
|
||||
icon: IconSearch,
|
||||
},
|
||||
// {
|
||||
// title: "Settings",
|
||||
// url: "#",
|
||||
// icon: IconSettings,
|
||||
// },
|
||||
// {
|
||||
// title: "Get Help",
|
||||
// url: "#",
|
||||
// icon: IconHelp,
|
||||
// },
|
||||
// {
|
||||
// title: "Search",
|
||||
// url: "#",
|
||||
// icon: IconSearch,
|
||||
// },
|
||||
],
|
||||
documents: [
|
||||
{
|
||||
name: "Data Library",
|
||||
url: "#",
|
||||
icon: IconDatabase,
|
||||
},
|
||||
{
|
||||
name: "Reports",
|
||||
url: "#",
|
||||
icon: IconReport,
|
||||
},
|
||||
{
|
||||
name: "Word Assistant",
|
||||
url: "#",
|
||||
icon: IconFileWord,
|
||||
},
|
||||
// {
|
||||
// name: "Data Library",
|
||||
// url: "#",
|
||||
// icon: IconDatabase,
|
||||
// },
|
||||
// {
|
||||
// name: "Reports",
|
||||
// url: "#",
|
||||
// icon: IconReport,
|
||||
// },
|
||||
// {
|
||||
// name: "Word Assistant",
|
||||
// url: "#",
|
||||
// icon: IconFileWord,
|
||||
// },
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,5 @@ export const dateGetter = (str: string | undefined): Date | null => {
|
||||
export const dateSetter = (date: Date | null): string => {
|
||||
if (!date) return "";
|
||||
const fmt = (n: number) => String(n).padStart(2, "0");
|
||||
return `${fmt(date.getDate())}/${fmt(date.getMonth() + 1)}/${date.getFullYear()} ${fmt(
|
||||
date.getHours()
|
||||
)}:${fmt(date.getMinutes())}:${fmt(date.getSeconds())}`;
|
||||
return `${fmt(date.getDate())}/${fmt(date.getMonth() + 1)}/${date.getFullYear()} ${fmt(date.getHours())}:${fmt(date.getMinutes())}:${fmt(date.getSeconds())}`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user