feat: update dashboard contents to include category names and format dates

This commit is contained in:
fredy.siswanto
2025-03-06 19:47:45 +07:00
parent 4754e75f59
commit b61235a3b5
4 changed files with 64 additions and 26 deletions
+16 -5
View File
@@ -6,6 +6,8 @@ import { Button } from '~/components/ui/button'
import { UiTable } from '~/components/ui/table'
import { TitleDashboard } from '~/components/ui/title-dashboard'
import type { loader } from '~/routes/_admin.lg-admin._dashboard.contents'
import type { TCategory } from '~/types/news'
import { formatDate } from '~/utils/formatter'
export const ContentsPage = () => {
const loaderData = useRouteLoaderData<typeof loader>(
@@ -20,7 +22,7 @@ export const ContentsPage = () => {
{ title: 'Tanggal Konten', data: 'created_at' },
{ title: 'Nama Penulis', data: 'author_id' },
{ title: 'Judul', data: 'title' },
// { title: 'Kategori', data: 'category' },
{ title: 'Kategori', data: 'categories' },
{
title: 'Tags',
data: 'is_premium',
@@ -30,12 +32,21 @@ export const ContentsPage = () => {
: `<span class="bg-[#F5F5F5] text-[#4C5CA0] px-4 py-2 rounded-full">Normal</span>`
},
},
// {
// title: 'Action',
// data: 'id',
// },
{
title: 'Action',
data: 'id',
},
]
const dataSlot = {
1: (value: string) => {
return formatDate(value)
},
4: (value: TCategory[]) => {
return value.map((item: { name: string }) => {
return `${item.name}`
})
},
6: (value: string | number) => {
return (
<Button