feat(satusehat): implement query schema and improve data table

- Add schema.query.ts for query validation with zod
- Move constants to const.ts for better organization
- Refactor list.vue to use new query schema and constants
- Add empty state handling to data-table.vue
This commit is contained in:
Khafid Prayoga
2025-08-26 13:10:09 +07:00
parent de7a833ddc
commit 5685b31c48
4 changed files with 177 additions and 150 deletions
@@ -1,6 +1,8 @@
<script setup lang="ts">
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '~/components/pub/ui/table'
import type { DataTableLoader } from './type'
import { Info } from 'lucide-vue-next'
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '~/components/pub/ui/table'
defineProps<{
rows: unknown[]
cols: any[]
@@ -33,6 +35,16 @@ const loader = inject('table_data_loader') as DataTableLoader
</TableCell>
</TableRow>
</TableBody>
<TableBody v-if="rows.length === 0 && !loader.isTableLoading">
<TableRow>
<TableCell colspan="100%" class="text-center">
<div class="flex items-center justify-center">
<Info class="size-5 text-muted-foreground" />
<span class="ml-2">No data available</span>
</div>
</TableCell>
</TableRow>
</TableBody>
<TableBody v-else>
<TableRow v-for="(row, rowIndex) in rows" :key="`row-${rowIndex}`">
<TableCell v-for="(key, cellIndex) in keys" :key="`cell-${rowIndex}-${cellIndex}`">