From 2eb58856af218b913d6ebe37fafd00b57fdff811 Mon Sep 17 00:00:00 2001 From: "santasri.pachhal" Date: Thu, 2 Jul 2026 11:33:53 +0530 Subject: [PATCH] feat(ticket): add section icons, theme-aware system timeline, and nested sidebar active routes --- .../components/TicketClassDetailSkeleton.tsx | 46 ++++++++++--------- .../components/TicketDefectClassTabs.tsx | 3 +- .../components/TicketHistoryCard.tsx | 22 ++++++--- .../components/TicketOverviewCard.tsx | 7 ++- src/components/app-sidebar.tsx | 20 ++++++-- 5 files changed, 64 insertions(+), 34 deletions(-) diff --git a/src/app/(modules)/ticket/[ticketId]/components/TicketClassDetailSkeleton.tsx b/src/app/(modules)/ticket/[ticketId]/components/TicketClassDetailSkeleton.tsx index 7a45a30..873dad2 100644 --- a/src/app/(modules)/ticket/[ticketId]/components/TicketClassDetailSkeleton.tsx +++ b/src/app/(modules)/ticket/[ticketId]/components/TicketClassDetailSkeleton.tsx @@ -54,28 +54,32 @@ export function TicketClassContentSkeleton() { -
-
- - -
- {Array.from({ length: 3 }).map((_, index) => ( -
- {index < 2 ? ( - - ) : null} - -
-
- - -
- - -
+ + +
+ +
- ))} -
+ + + {Array.from({ length: 3 }).map((_, index) => ( +
+ {index < 2 ? ( + + ) : null} + +
+
+ + +
+ + +
+
+ ))} +
+
); } diff --git a/src/app/(modules)/ticket/[ticketId]/components/TicketDefectClassTabs.tsx b/src/app/(modules)/ticket/[ticketId]/components/TicketDefectClassTabs.tsx index 596a85c..a0a9745 100644 --- a/src/app/(modules)/ticket/[ticketId]/components/TicketDefectClassTabs.tsx +++ b/src/app/(modules)/ticket/[ticketId]/components/TicketDefectClassTabs.tsx @@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from 'react'; import { usePathname, useRouter, useSearchParams } from 'next/navigation'; -import { Component } from 'lucide-react'; +import { AlertTriangle, Component } from 'lucide-react'; import { Badge } from '@/components/ui/badge'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; @@ -89,6 +89,7 @@ export function TicketDefectClassTabs({ + Issues - - System Generated - +
+ + {getSourceLabel(item.source)} +

{item.title}

{noteText ? (

@@ -62,7 +70,7 @@ function UserHistoryEntry({ item }: { item: TicketHistoryItem }) { const isAssigned = item.event_type === 'assigned'; return ( -

+

{item.title}

{isAssigned && item.target_user ? ( @@ -116,7 +124,7 @@ export function TicketHistoryCard({ ticket }: { ticket: TicketDetail }) { ))} ) : ( -
+

No timeline entries yet

diff --git a/src/app/(modules)/ticket/[ticketId]/components/TicketOverviewCard.tsx b/src/app/(modules)/ticket/[ticketId]/components/TicketOverviewCard.tsx index 37ba579..6489d0b 100644 --- a/src/app/(modules)/ticket/[ticketId]/components/TicketOverviewCard.tsx +++ b/src/app/(modules)/ticket/[ticketId]/components/TicketOverviewCard.tsx @@ -1,5 +1,7 @@ 'use client'; +import { LayoutDashboard } from 'lucide-react'; + import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { PersonInfo } from '@/components/person-avatar'; import type { TicketOverviewDetail } from '@/types'; @@ -40,7 +42,10 @@ export function TicketOverviewCard({ return ( - Overview + + + Overview + diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx index 11b2513..b32252a 100644 --- a/src/components/app-sidebar.tsx +++ b/src/components/app-sidebar.tsx @@ -33,6 +33,11 @@ import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { useAppStore } from '@/store/app.store'; +function isRouteActive(pathname: string, path?: string) { + if (!path) return false; + return pathname === path || pathname.startsWith(`${path}/`); +} + export function AppSidebar({ ...props }: React.ComponentProps) { const pathname = usePathname(); const { hasPermission } = usePermissions(); @@ -85,16 +90,23 @@ function SidebarNavItem({ item: MenuItem; pathname: string; }) { - const isActive = item.path ? pathname === item.path : false; + const isActive = isRouteActive(pathname, item.path); const isChildActive = - item.children?.some((child) => child.path === pathname) ?? false; + item.children?.some((child) => isRouteActive(pathname, child.path)) ?? + false; const hasChildren = Boolean(item.children?.length); + const [open, setOpen] = React.useState(isChildActive); + + React.useEffect(() => { + if (isChildActive) setOpen(true); + }, [isChildActive]); if (hasChildren) { return ( @@ -112,7 +124,7 @@ function SidebarNavItem({ {child.path ? (