From b61235a3b51af5ea42c6c9cdacf17dce9beb803d Mon Sep 17 00:00:00 2001 From: "fredy.siswanto" Date: Thu, 6 Mar 2025 19:47:45 +0700 Subject: [PATCH] feat: update dashboard contents to include category names and format dates --- app/app.css | 23 ++-------------- app/pages/dashboard-contents/index.tsx | 21 ++++++++++---- app/types/news.ts | 38 ++++++++++++++++++++++++++ app/utils/formatter.ts | 8 ++++++ 4 files changed, 64 insertions(+), 26 deletions(-) diff --git a/app/app.css b/app/app.css index ef30239..74741fe 100644 --- a/app/app.css +++ b/app/app.css @@ -33,26 +33,7 @@ table.dataTable tbody > tr > td { border-bottom: 1px solid #ebebeb; } -/* .embla.hero { - overflow: hidden; -} -.embla__container.hero { +nav[aria-label='pagination'] { display: flex; - background-color: yellow; + justify-content: center; } -.embla__slide.hero { - flex: 0 0 100%; - min-width: 0; -} */ - -/* .embla__slide { - margin-right: 10px; - flex: 0 0 auto; - min-width: 0; - max-width: 100%; -} -@media (min-width: 768px) { - .embla__slide { - margin-right: 30px; - } -} */ diff --git a/app/pages/dashboard-contents/index.tsx b/app/pages/dashboard-contents/index.tsx index 9c3726d..e7fa581 100644 --- a/app/pages/dashboard-contents/index.tsx +++ b/app/pages/dashboard-contents/index.tsx @@ -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( @@ -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 = () => { : `Normal` }, }, - // { - // 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 (