mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
fix: fix appsidebar on mobile
This commit is contained in:
parent
aed5a782fb
commit
9e058699c5
3 changed files with 27 additions and 5 deletions
|
|
@ -13,7 +13,7 @@ class RateLimiter:
|
|||
|
||||
def __init__(self):
|
||||
self.redis_client: Optional[aioredis.Redis] = None
|
||||
self.stale_call_timeout = 300 # 5 minutes in seconds
|
||||
self.stale_call_timeout = 1200 # 20 minutes in seconds
|
||||
|
||||
async def _get_redis(self) -> aioredis.Redis:
|
||||
"""Get or create Redis connection"""
|
||||
|
|
|
|||
|
|
@ -1,12 +1,27 @@
|
|||
"use client";
|
||||
|
||||
import { Menu } from "lucide-react";
|
||||
import { usePathname } from "next/navigation";
|
||||
import React, { ReactNode } from "react";
|
||||
|
||||
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { SidebarInset, SidebarProvider, useSidebar } from "@/components/ui/sidebar";
|
||||
|
||||
import { AppSidebar } from "./AppSidebar";
|
||||
|
||||
function MobileHeader() {
|
||||
const { toggleSidebar } = useSidebar();
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-50 flex items-center gap-3 border-b bg-background px-4 py-2 md:hidden">
|
||||
<Button variant="ghost" size="icon" onClick={toggleSidebar} aria-label="Open menu">
|
||||
<Menu className="h-5 w-5" />
|
||||
</Button>
|
||||
<span className="text-lg font-bold">Dograh</span>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
interface AppLayoutProps {
|
||||
children: ReactNode;
|
||||
headerActions?: ReactNode;
|
||||
|
|
@ -36,6 +51,7 @@ const AppLayout: React.FC<AppLayoutProps> = ({
|
|||
<div className="flex min-h-screen w-full">
|
||||
<AppSidebar />
|
||||
<SidebarInset className="flex-1">
|
||||
<MobileHeader />
|
||||
{/* Optional header area for specific pages */}
|
||||
{headerActions && (
|
||||
<header className="sticky top-0 z-50 w-full border-b bg-background">
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ const StackTeamSwitcher = React.lazy(() =>
|
|||
export function AppSidebar() {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const { state } = useSidebar();
|
||||
const { state, isMobile, setOpenMobile } = useSidebar();
|
||||
const { provider, getSelectedTeam, logout, user } = useAuth();
|
||||
const { config } = useAppConfig();
|
||||
|
||||
|
|
@ -167,6 +167,12 @@ export function AppSidebar() {
|
|||
},
|
||||
];
|
||||
|
||||
const handleMobileNavClick = () => {
|
||||
if (isMobile) {
|
||||
setOpenMobile(false);
|
||||
}
|
||||
};
|
||||
|
||||
const SidebarLink = ({ item }: { item: typeof overviewSection[0] }) => {
|
||||
const isItemActive = isActive(item.url);
|
||||
const Icon = item.icon;
|
||||
|
|
@ -183,7 +189,7 @@ export function AppSidebar() {
|
|||
isItemActive && "bg-accent text-accent-foreground"
|
||||
)}
|
||||
>
|
||||
<Link href={item.url}>
|
||||
<Link href={item.url} onClick={handleMobileNavClick}>
|
||||
<Icon className="h-4 w-4" />
|
||||
<span className="sr-only">{item.title}</span>
|
||||
</Link>
|
||||
|
|
@ -205,7 +211,7 @@ export function AppSidebar() {
|
|||
isItemActive && "bg-accent text-accent-foreground"
|
||||
)}
|
||||
>
|
||||
<Link href={item.url}>
|
||||
<Link href={item.url} onClick={handleMobileNavClick}>
|
||||
<Icon className="h-4 w-4" />
|
||||
<span>{item.title}</span>
|
||||
</Link>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue