refactor: align routes with next 16 and local fonts

This commit is contained in:
Esdras Renan 2025-10-22 02:08:18 -03:00
parent 2e3b46a7b5
commit dad84d7d0e
16 changed files with 2448 additions and 198 deletions

View file

@ -296,12 +296,23 @@ export function AdminCompaniesManager({ initialCompanies, tenantId }: Props) {
const machines = useQuery(api.machines.listByTenant, {
tenantId: effectiveTenantId,
includeMetadata: false,
}) as Array<Record<string, unknown>> | undefined
}) as unknown[] | undefined
function extractCompanySlug(entry: unknown): string | undefined {
if (!entry || typeof entry !== "object") {
return undefined
}
if ("companySlug" in entry) {
const value = (entry as { companySlug?: unknown }).companySlug
return typeof value === "string" && value.length > 0 ? value : undefined
}
return undefined
}
const machineCountsBySlug = useMemo(() => {
const map: Record<string, number> = {}
;(machines ?? []).forEach((m) => {
const slug = (m as any)?.companySlug as string | undefined
;(machines ?? []).forEach((entry) => {
const slug = extractCompanySlug(entry)
if (!slug) return
map[slug] = (map[slug] ?? 0) + 1
})
@ -934,7 +945,15 @@ function TableView({ companies, machineCountsBySlug, onEdit, onDelete }: TableVi
<PaginationPrevious disabled={pageIndex === 0} onClick={() => setPageIndex((p) => Math.max(0, p - 1))} />
</PaginationItem>
<PaginationItem>
<PaginationLink isActive>{pageIndex + 1}</PaginationLink>
<PaginationLink
href="#"
isActive
onClick={(event) => {
event.preventDefault()
}}
>
{pageIndex + 1}
</PaginationLink>
</PaginationItem>
<PaginationItem>
<PaginationNext disabled={pageIndex >= pageCount - 1} onClick={() => setPageIndex((p) => Math.min(pageCount - 1, p + 1))} />