diff --git a/components/admin/portfolio-projects-overview.tsx b/components/admin/portfolio-projects-overview.tsx index f18ca48..765aa70 100644 --- a/components/admin/portfolio-projects-overview.tsx +++ b/components/admin/portfolio-projects-overview.tsx @@ -1,13 +1,22 @@ -import { ExternalLink, FolderKanban, Plus, Tags, CheckCircle2 } from "lucide-react"; +/* eslint-disable @next/next/no-img-element */ + +import { CheckCircle2, ExternalLink, FolderKanban, ImageOff, Plus, Star, Tags } from "lucide-react"; import Link from "next/link"; import { StatsCard } from "@/components/dashboard/stats-card"; -import { MotionFade } from "@/components/motion-fade"; import { PortfolioProjectActions } from "@/components/admin/portfolio-project-actions"; import { AppCard } from "@/components/ui/app-card"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; -import { CardContent } from "@/components/ui/card"; +import { Card } from "@/components/ui/card"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; import { getAdminAppPath } from "@/lib/admin-routing"; import { getSiteSettings } from "@/lib/app-config"; import { getLocalizedPath } from "@/lib/locale"; @@ -24,17 +33,34 @@ const copy = { all: "Alle", newProject: "Neues Projekt", newCategory: "Neues Kategorie", - openProject: "Ansehen", + view: "Auf der Website ansehen", untitled: "Unbenanntes Projekt", empty: "Noch keine Projekte vorhanden.", + emptyFiltered: "Keine Projekte in dieser Auswahl.", + emptyHint: "Lege dein erstes Projekt an, um es hier zu verwalten.", + colProject: "Projekt", + colCategory: "Kategorie", + colYear: "Jahr", + colStatus: "Status", + colMode: "Layout", + colActions: "Aktionen", + published: "Published", + draft: "Draft", + featured: "Featured", }; +function categoryLabel(name: PortfolioCategoryView["name"]) { + return name.de || name.en || name.ar; +} + export async function PortfolioProjectsOverview({ categories, projects, selectedCategory, }: PortfolioProjectsOverviewProps) { const siteSettings = await getSiteSettings(); + const publishedCount = projects.filter((project) => project.isPublished).length; + const isFiltered = selectedCategory !== ""; return (
@@ -42,11 +68,7 @@ export async function PortfolioProjectsOverview({
- project.isPublished).length)} - icon={CheckCircle2} - /> +
@@ -76,59 +98,134 @@ export async function PortfolioProjectsOverview({ variant={selectedCategory === category.id ? "default" : "outline"} > - {category.name.de || category.name.en || category.name.ar} + {categoryLabel(category.name)} ))}
-
- {projects.map((project, index) => ( - - - -
-
-

- {getLocalizedValue(project.title, "de") || copy.untitled} -

- - {project.isPublished ? "Published" : "Draft"} - - {project.viewMode} -
-
- {project.category.name.de || project.category.name.en || project.category.name.ar} - {project.projectYear} -
-
+ {projects.length === 0 ? ( + +
+
+ +
+
+

+ {isFiltered ? copy.emptyFiltered : copy.empty} +

+

{copy.emptyHint}

+
+ {isFiltered ? ( + + ) : ( + + )} +
+
+ ) : ( + + + + + + Cover + + {copy.colProject} + {copy.colCategory} + {copy.colYear} + {copy.colStatus} + {copy.colMode} + {copy.colActions} + + + + {projects.map((project) => { + const title = getLocalizedValue(project.title, "de") || copy.untitled; -
- - -
- - - - ))} + return ( + + +
+ {project.coverImagePath ? ( + {title} + ) : ( + + )} +
+
- {projects.length === 0 ? ( - - - {copy.empty} - - - ) : null} - + +
+ + {title} + {project.isFeatured ? ( + + ) : null} + + /{project.slug} +
+
+ + + {categoryLabel(project.category.name)} + + + + {project.projectYear} + + + + + {project.isPublished ? copy.published : copy.draft} + + + + + {project.viewMode} + + + +
+ + +
+
+
+ ); + })} +
+
+
+ )}
); }