feat: add resizable side panel for agency details (#81)#90
feat: add resizable side panel for agency details (#81)#90
Conversation
- Implement 50/50 split view using resizable panels - Auto-close sidebar when viewing agency details - Add click handler on table rows to open detail panel - Display agency details in side panel (name, code, status, dates) Co-Authored-By: martty-code <nesalia.inc@gmail.com> Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
Add gaps, borders, rounded corners and custom resize handle styling Co-Authored-By: martty-code <nesalia.inc@gmail.com> Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
Add resizable side panel for agencies showing agency info and employees - Display agency details (code, status, dates) in cards - Show employees table with contract type and status - Add close button in bottom left of panel - Adjust metrics section gap Co-Authored-By: martty-code <nesalia.inc@gmail.com> Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
| const [search, setSearch] = useState(""); | ||
| const [statusFilter, setStatusFilter] = useState<string>("all"); | ||
| const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false); | ||
| const [editingAgency, setEditingAgency] = useState<any>(null); |
There was a problem hiding this comment.
Type Safety Issue: Using any type for state variables reduces type safety. Consider defining proper TypeScript interfaces for agency data.
| const [editingAgency, setEditingAgency] = useState<any>(null); | |
| interface Agency { | |
| id: string; | |
| name: string; | |
| code?: string; | |
| isActive: boolean; | |
| createdAt?: string; | |
| updatedAt?: string; | |
| } | |
| const [selectedAgency, setSelectedAgency] = useState<Agency | null>(null); |
| const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false); | ||
| const [editingAgency, setEditingAgency] = useState<any>(null); | ||
| const [deletingAgency, setDeletingAgency] = useState<any>(null); | ||
| const [selectedAgency, setSelectedAgency] = useState<any>(null); |
There was a problem hiding this comment.
Type Safety: Using any type reduces type safety. Consider defining a proper TypeScript interface for the agency state.
| const [selectedAgency, setSelectedAgency] = useState<any>(null); | |
| const [selectedAgency, setSelectedAgency] = useState<Agency | null>(null); |
If you have an Agency interface defined elsewhere in the codebase, please import and use it.
| agency, | ||
| onClose, | ||
| }: { | ||
| agency: any; |
There was a problem hiding this comment.
Performance Concern: The AgencyDetailPanel component is always mounted and fetching data via useEmployees() and useContracts() hooks, even when the panel isn't visible. This means all employees and contracts are fetched on page load.
Consider:
- Using
enabled: !!agencyin the query if supported - Fetching filtered data at the API level
- Using React.memo to prevent unnecessary re-renders
| agency: any; | |
| const { data: employees = [] } = useEmployees({ | |
| enabled: !!agency | |
| }); |
| "Intérim": "bg-teal-500/15 border border-teal-500/25 text-teal-600", | ||
| Alternance: "bg-purple-500/15 border border-purple-500/25 text-purple-600", | ||
| }; | ||
|
|
There was a problem hiding this comment.
UX Suggestion: The close button is positioned at the bottom-left which may be hard to discover. Consider:
- Using a more conventional position (top-right)
- Using an X icon instead of text
- Adding a tooltip
| <Button | |
| className="absolute top-2 right-2 z-10" | |
| size="icon" | |
| variant="ghost" | |
| onClick={onClose} | |
| > | |
| <X className="h-4 w-4" /> | |
| <span className="sr-only">Close panel</span> | |
| </Button> |
SummaryThis PR implements a resizable side panel for displaying agency details, improving the UX of the agencies page by allowing users to view detailed information without navigating away from the list. Critical Issues1. Event Propagation Bug (Line 280)When clicking the Edit or Delete buttons in the agencies table, the detail panel also opens because the onClick event bubbles up to the TableRow. This creates an unexpected and confusing user experience. Fix needed: Add e.stopPropagation() to the edit and delete button click handlers. RecommendationsPerformance
Code Quality
User Experience
Accessibility
Positive Notes
🤖 Generated with Claude Code |
- Fix ResizablePanelGroup to wrap entire content (not nested) - Add useSidebar hook to auto-close sidebar when employee selected - Fix EmployeeDetailPanel layout with proper close button - Match exact structure from PR #90 for consistency Co-Authored-By: martty-code <nesalia.inc@gmail.com> Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
Summary
Changes
Test plan
🤖 Generated with Claude Code