From 661437a2d33f3ad710f61bbd788f3f4c16f9e3a2 Mon Sep 17 00:00:00 2001 From: "fredy.siswanto" Date: Thu, 6 Mar 2025 23:49:12 +0700 Subject: [PATCH] feat: update dashboard to render author details and improve row numbering --- app/pages/dashboard-contents/index.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/pages/dashboard-contents/index.tsx b/app/pages/dashboard-contents/index.tsx index 6815f60..5bc737f 100644 --- a/app/pages/dashboard-contents/index.tsx +++ b/app/pages/dashboard-contents/index.tsx @@ -18,14 +18,19 @@ export const ContentsPage = () => { DataTable.use(DT) const dataTable = newsData const dataColumns = [ - { title: 'No', data: 'id' }, + { + title: 'No', + data: undefined, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + render: function (data: any, type: any, row: any, meta: any) { + return meta.row + 1 + }, + }, { title: 'Tanggal Konten', data: 'live_at' }, { title: 'Nama Penulis', - //ignore the error below - // eslint-disable-next-line @typescript-eslint/no-explicit-any - render: (data: any, type: any, row: any) => - `${row.author.name}
ID: ${row.id.slice(0, 12)}`, + + data: 'author', }, { title: 'Judul', data: 'title' }, { title: 'Kategori', data: 'categories' }, @@ -47,7 +52,9 @@ export const ContentsPage = () => { 1: (value: string) => { return formatDate(value) }, - // 2: (value: TAuthor) => `${value}`, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + 2: (value: any, type: any, data: any) => + `${value.name}
ID: ${data.id.slice(0, 12)}`, 4: (value: TCategories) => { const categories = value.map((item) => item.name).join(', ') return `${categories}`