feat: rm time from recent edits table
All checks were successful
Deploy eolas-app / deploy (push) Successful in 47s

This commit is contained in:
Thomas Bishop 2025-11-07 19:36:54 +00:00
parent d8579876ad
commit f89dbfab03

View file

@ -6,72 +6,68 @@ import { Button } from "@/components/ui/button"
import { DataTable } from "@/components/DataTable" import { DataTable } from "@/components/DataTable"
const columns = [ const columns = [
{ {
accessorKey: "title", accessorKey: "title",
header: ({ column }) => { header: ({ column }) => {
return ( return (
<Button <Button
variant="ghost" variant="ghost"
className="rounded-none" className="rounded-none"
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")} onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
> >
Title Title
<ArrowUpDown className="ml-2 h-4 w-4" /> <ArrowUpDown className="ml-2 h-4 w-4" />
</Button> </Button>
) )
}, },
cell: ({ cell, row }) => { cell: ({ cell, row }) => {
return ( return (
<Link to={`entries/${row.original.link}`}> <Link to={`entries/${row.original.link}`}>
<span className="text-foreground underline-offset-3 underline hover:text-gray-700 dark:hover:text-green-300"> <span className="text-foreground underline-offset-3 underline hover:text-gray-700 dark:hover:text-green-300">
{row.original.title} {row.original.title}
</span> </span>
</Link> </Link>
) )
}, },
}, },
{ {
accessorKey: "date", accessorKey: "date",
header: "Date", header: "Date",
}, },
{
accessorKey: "time",
header: "Time",
},
] ]
export default function RecentEdits() { export default function RecentEdits() {
const { data, isLoading } = useQuery({ const { data, isLoading } = useQuery({
queryKey: ["entries_recent"], queryKey: ["entries_recent"],
queryFn: () => api.get("/entries?limit=20&sort=date").then((res) => res.data), queryFn: () => api.get("/entries?limit=20&sort=date").then((res) => res.data),
}) })
const parsed = data?.data?.map((entry) => { const parsed = data?.data?.map((entry) => {
const [date, time] = entry?.last_modified?.split(" ") const [date, time] = entry?.last_modified?.split(" ")
return { return {
title: entry.title.replace(/_/g, " "), title: entry.title.replace(/_/g, " "),
date: new Date(date).toLocaleString("en-GB", { date: new Date(date).toLocaleString("en-GB", {
day: "numeric", day: "numeric",
month: "long", month: "long",
year: "numeric", year: "numeric",
}), }),
time: time, // time: time,
link: entry.title, link: entry.title,
} }
}) })
return ( return (
<> <>
<div className="border w-full"> <div className="border w-full">
<div className="border-b py-2 px-4 lg:px-6 bg-sidebar"> <div className="border-b py-2 px-4 lg:px-6 bg-sidebar">
<h2 className="scroll-m-20 font-semibold">Recent edits</h2> <h2 className="scroll-m-20 font-semibold">Recent edits</h2>
</div> </div>
<div className="p-4 lg:p-6"> <div className="p-4 lg:p-6">
<div className="container mx-auto py-2"> <div className="container mx-auto py-2">
<DataTable columns={columns} data={parsed || []} loading={isLoading} /> <DataTable columns={columns} data={parsed || []} loading={isLoading} />
</div> </div>
</div> </div>
</div> </div>
</> </>
) )
} }