mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Starting working on settings Page.
This commit is contained in:
@@ -3,14 +3,16 @@ import {SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem} from
|
||||
import Link from "next/link";
|
||||
import {cn} from "@/lib/utils";
|
||||
import {buttonVariants} from "@/components/ui/button";
|
||||
import {PropsWithChildren, useState} from "react";
|
||||
import {PropsWithChildren, useEffect, useState} from "react";
|
||||
import {ChartArea, Home, Settings, ShieldHalf} from "lucide-react";
|
||||
import {usePathname} from "next/navigation";
|
||||
|
||||
export type SidebarMenuCustomProps = {}
|
||||
|
||||
export const SidebarMenuCustom = (props: SidebarMenuCustomProps) => {
|
||||
|
||||
const BASE_URL = "/dashboard";
|
||||
const pathname = usePathname();
|
||||
// Menu items.
|
||||
const items = [
|
||||
{
|
||||
@@ -35,6 +37,14 @@ export const SidebarMenuCustom = (props: SidebarMenuCustomProps) => {
|
||||
},
|
||||
]
|
||||
|
||||
useEffect(() => {
|
||||
const currentUrl = pathname;
|
||||
const currentItem = items.find((item) => `${BASE_URL}/${item.url}` === currentUrl);
|
||||
if (currentItem) {
|
||||
setActiveItem(currentItem.title);
|
||||
}
|
||||
}, [pathname]);
|
||||
|
||||
const [activeItem, setActiveItem] = useState(items[0].title);
|
||||
const handleItemClick = (title: string) => {
|
||||
setActiveItem(title);
|
||||
|
||||
Reference in New Issue
Block a user