36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { prisma } from "@/lib/prisma";
|
|
import { Card, CardContent } from "@/components/ui/card";
|
|
|
|
export async function RecentImports() {
|
|
const listings = await prisma.listing.findMany({
|
|
take: 10,
|
|
orderBy: { importedAt: "desc" },
|
|
});
|
|
|
|
if (listings.length === 0) {
|
|
return <p className="text-slate-500">Noch keine Listings importiert.</p>;
|
|
}
|
|
|
|
return (
|
|
<div className="mt-8">
|
|
<h2 className="text-xl font-semibold mb-4">Zuletzt importiert</h2>
|
|
<div className="space-y-2">
|
|
{listings.map((listing) => (
|
|
<Card key={listing.id}>
|
|
<CardContent className="p-4 flex justify-between items-center">
|
|
<div>
|
|
<h3 className="font-medium">{listing.title}</h3>
|
|
<p className="text-sm text-slate-500">{listing.locationText || "Kein Ort"}</p>
|
|
</div>
|
|
<div className="text-right">
|
|
<div className="font-medium">€{listing.nightlyPrice || "—"}</div>
|
|
<div className="text-sm text-slate-500">⭐ {listing.rating || "—"}</div>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
))}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|