Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a reusable “resource detail” UI pattern (detail view + delete confirmation) and wires it into the Agencies feature by introducing an agency detail route with fetch + delete hooks.
Changes:
- Add generic
ResourceDetail+ConfirmModalcomponents and shared types to support detail rendering and delete confirmation. - Introduce React Query hooks to fetch a single agency and delete an agency with cache invalidation.
- Add
/agencies/[id]detail page and link to it from the agencies list.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/types/index.ts | Adds shared generic prop/type definitions for ResourceDetail. |
| frontend/tsconfig.tsbuildinfo | Adds a TypeScript build artifact (should not be committed). |
| frontend/hooks/useApi.ts | Adds useAgency (fetch by id) and useDeleteAgency (delete + invalidate caches). |
| frontend/components/ResourceDetail.tsx | New reusable detail renderer with delete action that triggers ConfirmModal. |
| frontend/components/ConfirmModal.tsx | New confirmation dialog component used for delete flows. |
| frontend/app/agencies/page.tsx | Adds “View details” link for each agency to navigate to the new detail route. |
| frontend/app/agencies/[id]/page.tsx | New agency detail page using ResourceDetail, fetch hook, and delete hook. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| key: "billing_profiles", | ||
| label: "Billing Profiles", | ||
| emptyValue: "None", | ||
| }, |
There was a problem hiding this comment.
defaultDisplayValue will call JSON.stringify on the profiles array, producing raw output so maybe add a render like this: (v) => Array.isArray(v) ? ${v.length} profile(s) : "-"
| const params = useParams<{ id: string }>(); | ||
| const router = useRouter(); | ||
| const rawId = params?.id; | ||
| const agencyId = Array.isArray(rawId) ? rawId[0] : rawId; |
There was a problem hiding this comment.
I think Array.isArray branch is dead code so we can simplify it to:
| const agencyId = Array.isArray(rawId) ? rawId[0] : rawId; | |
| const agencyId = params?.id |
| }: ResourceDetailProps<T>) { | ||
| const [showConfirmModal, setShowConfirmModal] = useState(false); | ||
|
|
||
| const handleDeleteConfirm = async () => { |
There was a problem hiding this comment.
If onDelete() rejects, setShowConfirmModal(false) is never reached so should there be error handling here?
Jira ticket link
Jira ticket
Implementation description
Steps to test
What should reviewers focus on?
Checklist
Format for branch, commit, and PR title: docs/GIT.md.