diff --git a/src/app/dashboard/[teamSlug]/templates/(tabs)/list/page.tsx b/src/app/dashboard/[teamSlug]/templates/(tabs)/list/page.tsx index 76f6b25ad..ae2a9e652 100644 --- a/src/app/dashboard/[teamSlug]/templates/(tabs)/list/page.tsx +++ b/src/app/dashboard/[teamSlug]/templates/(tabs)/list/page.tsx @@ -1,11 +1,30 @@ import { Suspense } from 'react' import LoadingLayout from '@/features/dashboard/loading-layout' +import { + TEMPLATES_DEFAULT_SORT, + TEMPLATES_PAGE_SIZE, +} from '@/features/dashboard/templates/list/constants' import TemplatesTable from '@/features/dashboard/templates/list/table' +import { HydrateClient, prefetch, trpc } from '@/trpc/server' + +export default async function TemplatesListPage({ + params, +}: PageProps<'/dashboard/[teamSlug]/templates/list'>) { + const { teamSlug } = await params + + prefetch( + trpc.templates.getTemplates.infiniteQueryOptions({ + teamSlug, + limit: TEMPLATES_PAGE_SIZE, + sort: TEMPLATES_DEFAULT_SORT, + }) + ) -export default function TemplatesListPage() { return ( - }> - - + + }> + + + ) } diff --git a/src/core/modules/templates/models.ts b/src/core/modules/templates/models.ts index aa08bebab..4cccb32fc 100644 --- a/src/core/modules/templates/models.ts +++ b/src/core/modules/templates/models.ts @@ -1,3 +1,7 @@ +import type { + components as DashboardComponents, + paths as DashboardPaths, +} from '@/contracts/dashboard-api' import type { components as InfraComponents } from '@/contracts/infra-api' export type Template = Pick< @@ -23,3 +27,14 @@ export type DefaultTemplate = Template & { isDefault: true defaultDescription?: string } + +export type TemplatesSort = DashboardComponents['parameters']['templates_sort'] + +export type ListTeamTemplatesOptions = NonNullable< + DashboardPaths['/templates']['get']['parameters']['query'] +> + +export interface ListTeamTemplatesResult { + data: Array