- ) {
const pathname = usePathname();
const { hasPermission } = usePermissions();
+ const { isMobile } = useSidebar();
const authUser = useAppStore((state) => state.user);
const navItems = filterMenuItems(menuItems, hasPermission);
const user = {
@@ -53,17 +55,21 @@ export function AppSidebar({ ...props }: React.ComponentProps) {
return (
-
-
-
diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx
index b32252a..026c13c 100644
--- a/src/components/app-sidebar.tsx
+++ b/src/components/app-sidebar.tsx
@@ -18,16 +18,17 @@ import {
Sidebar,
SidebarContent,
SidebarFooter,
+ SidebarGroup,
SidebarHeader,
- SidebarRail,
SidebarMenu,
- SidebarMenuItem,
SidebarMenuButton,
+ SidebarMenuItem,
SidebarMenuSub,
SidebarMenuSubButton,
SidebarMenuSubItem,
- SidebarGroup,
- SidebarGroupLabel,
+ SidebarRail,
+ SidebarTrigger,
+ useSidebar,
} from '@/components/ui/sidebar';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
@@ -41,6 +42,7 @@ function isRouteActive(pathname: string, path?: string) {
export function AppSidebar({ ...props }: React.ComponentProps
-
-
-
-
-
- {children}
+
+
+
{children}
-
+
+
-
-
+
+
{navItems.map((item) => (
) {
-
+
@@ -83,6 +89,23 @@ export function AppSidebar({ ...props }: React.ComponentProps) {
);
}
+function SidebarBrandControl({ isMobile }: { isMobile: boolean }) {
+ return (
+ ) {
- const { toggleSidebar } = useSidebar();
+}: React.ComponentProps & {
+ tooltip?: string | React.ComponentProps;
+}) {
+ const { isMobile, toggleSidebar } = useSidebar();
- return (
+ const button = (
);
-}
+ if (!tooltip) {
+ return button;
+ }
+
+ if (typeof tooltip === 'string') {
+ tooltip = {
+ children: tooltip,
+ };
+ }
+
+ return (
+
+ {button}
+
+
+ );
+}
function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
const { toggleSidebar } = useSidebar();
+
RoadMonitor
Road Intelligence
+
+
+
+
+ );
+}
+
function SidebarNavItem({
item,
pathname,
@@ -159,4 +182,3 @@ function SidebarNavItem({
);
}
-
diff --git a/src/components/ui/sidebar.tsx b/src/components/ui/sidebar.tsx
index 1fe8642..6993967 100644
--- a/src/components/ui/sidebar.tsx
+++ b/src/components/ui/sidebar.tsx
@@ -256,29 +256,56 @@ function Sidebar({
function SidebarTrigger({
className,
onClick,
+ tooltip,
...props
-}: React.ComponentProps