"use client"; import React from "react"; import { CardItem } from "./CardItem"; import { CardSkeleton } from "./CardSkeleton"; import { getFieldValue, getGridClasses } from "./utils"; import { CardDisplayProps } from "./schema"; // Interface moved to schema.ts export function CardDisplay({ showFields, data, lang, translations, error, loading, titleField = "name", onCardClick, renderCustomField, gridCols = 4, showViewIcon = false, showUpdateIcon = false, onViewClick, onUpdateClick, }: CardDisplayProps) { if (error) { return (
{error.message || "An error occurred while fetching data."}
); } return (
{loading ? ( // Loading skeletons Array.from({ length: 10 }).map((_, index) => ( )) ) : data.length === 0 ? (
{(translations[lang] || {}).noData || "No data found"}
) : ( data.map((item, index) => ( )) )}
); }