From ff3afeef114777c358d4d812755a83d2038568da Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 02:47:13 +0000 Subject: [PATCH] Code edited in Lovable Code Editor Edited UI in Lovable Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/app-shell.tsx | 129 ++++------------------------------- 1 file changed, 14 insertions(+), 115 deletions(-) diff --git a/src/components/app-shell.tsx b/src/components/app-shell.tsx index 349da7f..5061872 100644 --- a/src/components/app-shell.tsx +++ b/src/components/app-shell.tsx @@ -1,28 +1,9 @@ import { Link, useLocation, useNavigate } from "@tanstack/react-router"; import { useAuth } from "@/lib/auth"; import { Button } from "@/components/ui/button"; -import { Badge } from "@/components/ui/badge"; -import { HeaderTimer } from "@/components/timer/header-timer"; -import { QuickAddTime, QuickAddExpense } from "@/components/quick-add/quick-add"; -import { supabase } from "@/integrations/supabase/client"; -import { - Briefcase, - Users, - Receipt, - ShieldCheck, - LogOut, - Scale, - LayoutDashboard, - Settings, - Wallet, - FileSignature, - FolderArchive, - ClipboardList, - Contact, - MessageSquare, -} from "lucide-react"; +import { Briefcase, Users, FileText, Receipt, ShieldCheck, LogOut, Scale, LayoutDashboard } from "lucide-react"; import { cn } from "@/lib/utils"; -import { useEffect, useState, useCallback, type ReactNode } from "react"; +import type { ReactNode } from "react"; interface NavItem { to: string; @@ -35,71 +16,14 @@ const NAV: NavItem[] = [ { to: "/", label: "Dashboard", icon: LayoutDashboard }, { to: "/clients", label: "Clients", icon: Users }, { to: "/cases", label: "Cases", icon: Briefcase }, - { to: "/contacts", label: "Contacts", icon: Contact }, - { to: "/messages", label: "Messages", icon: MessageSquare }, - { to: "/status", label: "Status Updates", icon: ClipboardList }, - { to: "/collections", label: "Collections", icon: Wallet }, - { to: "/documents", label: "Documents", icon: FileSignature }, - { to: "/files", label: "Files", icon: FolderArchive }, { to: "/invoices", label: "Invoices", icon: Receipt }, { to: "/admin/users", label: "Users", icon: ShieldCheck, adminOnly: true }, - { to: "/settings", label: "Settings", icon: Settings, adminOnly: true }, ]; -function useUnreadMessagesCount() { - const { user } = useAuth(); - const uid = user?.id; - const [count, setCount] = useState(0); - - const refresh = useCallback(async () => { - if (!uid) { - setCount(0); - return; - } - const { data: mems } = await supabase - .from("conversation_members") - .select("conversation_id, last_read_at") - .eq("user_id", uid); - if (!mems || mems.length === 0) { - setCount(0); - return; - } - let total = 0; - await Promise.all( - mems.map(async (m) => { - const { count: c } = await supabase - .from("messages") - .select("id", { count: "exact", head: true }) - .eq("conversation_id", m.conversation_id) - .gt("created_at", m.last_read_at) - .neq("sender_id", uid); - total += c ?? 0; - }), - ); - setCount(total); - }, [uid]); - - useEffect(() => { - refresh(); - if (!uid) return; - const ch = supabase - .channel("sidebar-unread") - .on("postgres_changes", { event: "*", schema: "public", table: "messages" }, () => refresh()) - .on("postgres_changes", { event: "UPDATE", schema: "public", table: "conversation_members", filter: `user_id=eq.${uid}` }, () => refresh()) - .subscribe(); - return () => { - supabase.removeChannel(ch); - }; - }, [uid, refresh]); - - return count; -} - export function AppShell({ children }: { children: ReactNode }) { const { user, signOut, isAdmin, roles } = useAuth(); const location = useLocation(); const navigate = useNavigate(); - const unreadMessages = useUnreadMessagesCount(); const handleSignOut = async () => { await signOut(); @@ -115,21 +39,15 @@ export function AppShell({ children }: { children: ReactNode }) {
-
Counsel
-
- Law Firm Suite -
+
Stage Law Firm, PLLC
+
Law Firm Suite