Files
Projektarbeit-MYP/packages/reservation-platform/src/components/dynamic-printer-cards.tsx
Till Tomczak f1541478ad Bereinige und vereinfache Installations-Skripte
- Entferne alle überflüssigen Installations- und Konfigurationsskripte
- Erstelle zwei vereinfachte Docker-Installationsskripte:
  - install-frontend.sh für Frontend-Installation
  - install-backend.sh für Backend-Installation
- Verbessere Frontend Dockerfile mit besserer Unterstützung für native Dependencies
- Aktualisiere Backend Dockerfile für automatische DB-Initialisierung
- Korrigiere TypeScript-Fehler in personalized-cards.tsx
- Erstelle env.ts für Umgebungsvariablen-Verwaltung
- Füge ausführliche Installationsanleitung in INSTALL.md hinzu
- Konfiguriere Docker-Compose für Host-Netzwerkmodus
- Erweitere Dockerfiles mit Healthchecks für bessere Zuverlässigkeit

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-31 14:22:07 +02:00

39 lines
1.1 KiB
TypeScript

"use client";
import { PrinterCard } from "@/components/printer-card";
import { Skeleton } from "@/components/ui/skeleton";
import type { InferResultType } from "@/utils/drizzle";
import { fetcher } from "@/utils/fetch";
import type { RegisteredDatabaseUserAttributes } from "lucia";
import useSWR from "swr";
interface DynamicPrinterCardsProps {
user: RegisteredDatabaseUserAttributes | null;
}
export function DynamicPrinterCards(props: DynamicPrinterCardsProps) {
const { user } = props;
const { data, error, isLoading } = useSWR("/api/printers", fetcher, {
refreshInterval: 1000 * 15,
});
if (error) {
return <div>Ein Fehler ist aufgetreten.</div>;
}
if (isLoading) {
return (
<>
{new Array(6).fill(null).map((_, index) => (
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
<Skeleton key={index} className="w-auto h-36 animate-pulse" />
))}
</>
);
}
return data.map((printer: InferResultType<"printers", { printJobs: true }>) => {
return <PrinterCard key={printer.id} printer={printer} user={user} />;
});
}