A full-featured CRM built with React, shadcn/ui, and Supabase.
add mobile navigation
Jean-Baptiste Kaiserd12860eeb694
diff --git a/registry.json b/registry.jsonindex fd7daaa2..d86b47ee 100644--- a/registry.json+++ b/registry.json@@ -372,6 +372,10 @@"path": "src/components/atomic-crm/layout/TopToolbar.tsx","type": "registry:component"},+ {+ "path": "src/components/atomic-crm/layout/MobileNavigation.tsx",+ "type": "registry:component"+ },{"path": "src/components/atomic-crm/layout/MobileLayout.tsx","type": "registry:component"diff --git a/src/components/atomic-crm/layout/MobileLayout.tsx b/src/components/atomic-crm/layout/MobileLayout.tsxindex 7a84d6d8..198320c8 100644--- a/src/components/atomic-crm/layout/MobileLayout.tsx+++ b/src/components/atomic-crm/layout/MobileLayout.tsx@@ -5,17 +5,19 @@ import { Error } from "@/components/admin/error";import { Skeleton } from "@/components/ui/skeleton";import MobileHeader from "./MobileHeader";+import { MobileNavigation } from "./MobileNavigation";export const MobileLayout = ({ children }: { children: ReactNode }) => (<><MobileHeader />- <main className="max-w-screen-xl mx-auto pt-4 px-4" id="main-content">+ <main className="max-w-screen-xl mx-auto pt-4 px-4 pb-18" id="main-content"><ErrorBoundary FallbackComponent={Error}><Suspense fallback={<Skeleton className="h-12 w-12 rounded-full" />}>{children}</Suspense></ErrorBoundary></main>+ <MobileNavigation /><Notification /></>);diff --git a/src/components/atomic-crm/layout/MobileNavigation.tsx b/src/components/atomic-crm/layout/MobileNavigation.tsxnew file mode 100644index 00000000..f6111c11--- /dev/null+++ b/src/components/atomic-crm/layout/MobileNavigation.tsx@@ -0,0 +1,110 @@+import { Button } from "@/components/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { cn } from "@/lib/utils";+import { Building2, HandHeart, Home, Plus, Users } from "lucide-react";+import { Link, matchPath, useLocation } from "react-router";++export const MobileNavigation = () => {+ const location = useLocation();++ let currentPath: string | boolean = "/";+ if (matchPath("/", location.pathname)) {+ currentPath = "/";+ } else if (matchPath("/contacts/*", location.pathname)) {+ currentPath = "/contacts";+ } else if (matchPath("/companies/*", location.pathname)) {+ currentPath = "/companies";+ } else if (matchPath("/deals/*", location.pathname)) {+ currentPath = "/deals";+ } else {+ currentPath = false;+ }++ return (+ <nav+ aria-label="CRM navigation"+ className="fixed bottom-0 left-0 right-0 z-50 bg-secondary h-14"+ >+ <div className="flex justify-center">+ <>+ <NavigationButton+ href="/"+ Icon={Home}+ label="Home"+ isActive={currentPath === "/"}+ />+ <NavigationButton+ href="/contacts"+ Icon={Users}+ label="Contacts"+ isActive={currentPath === "/contacts"}+ />+ <CreateButton />+ <NavigationButton+ href="/companies"+ Icon={Building2}+ label="Companies"+ isActive={currentPath === "/companies"}+ />+ <NavigationButton+ href="/deals"+ Icon={HandHeart}+ label="Deals"+ isActive={currentPath === "/deals"}+ />+ </>+ </div>+ </nav>+ );+};++const NavigationButton = ({+ href,+ Icon,+ label,+ isActive,+}: {+ href: string;+ Icon: React.ComponentType<React.SVGProps<SVGSVGElement>>;+ label: string;+ isActive: boolean;+}) => (+ <Button+ asChild+ variant="ghost"+ className={cn(+ "flex-col gap-1 h-auto py-2 px-1 rounded-md w-16",+ isActive ? null : "text-muted-foreground",+ )}+ >+ <Link to={href}>+ <Icon className="size-6" />+ <span className="text-[0.6rem] font-medium">{label}</span>+ </Link>+ </Button>+);++const CreateButton = () => (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ variant="default"+ size="icon"+ className="h-16 w-16 rounded-full -mt-3"+ aria-label="Create"+ >+ <Plus className="size-10" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ <DropdownMenuItem>Contact</DropdownMenuItem>+ <DropdownMenuItem>Note</DropdownMenuItem>+ <DropdownMenuItem>Task</DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+);