diff --git a/apps/web/src/app/usul/texts/columns.tsx b/apps/web/src/app/usul/texts/columns.tsx index 50c2258..6738242 100644 --- a/apps/web/src/app/usul/texts/columns.tsx +++ b/apps/web/src/app/usul/texts/columns.tsx @@ -3,12 +3,14 @@ import Link from "next/link"; import { useRouter } from "next/navigation"; import { DeleteModal } from "@/components/delete-modal"; +import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import Spinner from "@/components/ui/spinner"; import { api } from "@/trpc/react"; import { ColumnDef } from "@tanstack/react-table"; import { PenBoxIcon, Trash2Icon } from "lucide-react"; import toast from "react-hot-toast"; +import { Version } from "@/components/versions-input"; export type Text = { id: string; @@ -18,6 +20,7 @@ export type Text = { englishAuthorName?: string; createdAt?: Date | null; updatedAt?: Date | null; + versions: Version['type'][]; genres: { id: string; arabicName?: string; @@ -84,6 +87,22 @@ export const columns: ColumnDef[] = [ ); }, }, + { + header: "Version(s)", + cell: ({ row }) => { + const { versions } = row.original; + + return ( +
+ {versions.map((v) => ( + + {v === "pdf" || v === 'openiti' || v === 'turath' ? "PDF" : "E-Book"} + + ))} +
+ ); + }, + }, { header: "Created At", cell: ({ row }) => { diff --git a/apps/web/src/app/usul/texts/page.tsx b/apps/web/src/app/usul/texts/page.tsx index f6677d6..b42c43a 100644 --- a/apps/web/src/app/usul/texts/page.tsx +++ b/apps/web/src/app/usul/texts/page.tsx @@ -91,6 +91,7 @@ export default async function TextsPage({ id: true, createdAt: true, updatedAt: true, + versions: true, primaryNameTranslations: { where: { OR: [{ locale: "ar" }, { locale: "en" }], @@ -131,7 +132,7 @@ export default async function TextsPage({ createdAt: "desc", }, { - id: 'desc' + id: "desc", }, ], skip: (pagination.page - 1) * pagination.pageSize, @@ -166,6 +167,7 @@ export default async function TextsPage({ id: g.id, arabicName: g.nameTranslations[0]?.text, })), + versions: Array.from(new Set(book.versions.map((v) => v.source))).sort(), }; });