Add accounts UI with list, create, edit, detail tabs for all sub-entities

Accounts list with paginated table, search, sort. Account detail page with
tabs for members, payment methods, tax exemptions, and processor links.
All sub-entities have create/edit dialogs and delete actions. Forms use
shared Zod schemas via react-hook-form.
This commit is contained in:
Ryan Moon
2026-03-28 07:45:52 -05:00
parent e734ef4606
commit 9abdf6c050
23 changed files with 1688 additions and 6 deletions

View File

@@ -0,0 +1,43 @@
import { useNavigate, useSearch } from '@tanstack/react-router'
import type { PaginationInput } from '@forte/shared/schemas'
interface PaginationSearch {
page?: number
limit?: number
q?: string
sort?: string
order?: 'asc' | 'desc'
}
export function usePagination() {
const search = useSearch({ strict: false }) as PaginationSearch
const navigate = useNavigate()
const params: PaginationInput = {
page: search.page ?? 1,
limit: search.limit ?? 25,
q: search.q,
sort: search.sort,
order: search.order ?? 'asc',
}
function setParams(updates: Partial<PaginationSearch>) {
navigate({
search: (prev: PaginationSearch) => ({
...prev,
...updates,
// Reset to page 1 when search or sort changes
page: updates.q !== undefined || updates.sort !== undefined ? 1 : (updates.page ?? prev.page),
}),
replace: true,
})
}
return {
...params,
setPage: (page: number) => setParams({ page }),
setSearch: (q: string) => setParams({ q: q || undefined }),
setSort: (sort: string, order: 'asc' | 'desc') => setParams({ sort, order }),
params,
}
}