OverviewHomePage.jsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. "use client";
  2. import React from "react";
  3. import { useOverviewBranchTarget } from "@/lib/frontend/overview/useOverviewBranchTarget";
  4. import { buildOverviewCards } from "@/lib/frontend/overview/cardsConfig";
  5. import OverviewCard from "@/components/overview/OverviewCard";
  6. import { getOverviewCardsLayoutClasses } from "@/components/overview/layoutClasses";
  7. export default function OverviewHomePage() {
  8. const {
  9. isAuthenticated,
  10. canManageUsers,
  11. explorerHref,
  12. searchHref,
  13. disabledHint,
  14. } = useOverviewBranchTarget();
  15. if (!isAuthenticated) return null;
  16. const cards = buildOverviewCards({
  17. explorerHref,
  18. searchHref,
  19. canManageUsers,
  20. disabledHint,
  21. });
  22. const { cardsRowClassName, cardItemClassName } =
  23. getOverviewCardsLayoutClasses({
  24. cardCount: cards.length,
  25. });
  26. return (
  27. <div className="min-h-[calc(100dvh-9rem)] py-4">
  28. <div className="mx-auto flex h-full w-full flex-col">
  29. <div className="space-y-1 text-left">
  30. <h1 className="text-2xl font-semibold tracking-tight">Übersicht</h1>
  31. <p className="text-sm text-muted-foreground">
  32. Schnellzugriff auf die wichtigsten Bereiche.
  33. </p>
  34. </div>
  35. <div className="flex flex-1 items-center justify-center pt-20 pb-10">
  36. <div className={cardsRowClassName}>
  37. {cards.map((card) => (
  38. <OverviewCard
  39. key={card.key}
  40. title={card.title}
  41. description={card.description}
  42. imageSrc={card.imageSrc}
  43. href={card.href}
  44. disabledHint={card.disabledHint}
  45. containerClassName={cardItemClassName}
  46. />
  47. ))}
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. );
  53. }