first commit
This commit is contained in:
94
components/explorer/PlaceCard.tsx
Normal file
94
components/explorer/PlaceCard.tsx
Normal file
@ -0,0 +1,94 @@
|
||||
"use client";
|
||||
|
||||
import { MapPin, ExternalLink } from "lucide-react";
|
||||
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Place } from "@/app/api/places/route";
|
||||
|
||||
interface PlaceCardProps {
|
||||
place: Place;
|
||||
}
|
||||
|
||||
export default function PlaceCard({ place }: PlaceCardProps) {
|
||||
const handleOpenMaps = () => {
|
||||
let url: string;
|
||||
if (place.gmapLink && place.gmapLink !== "LIEN_GOOGLE_MAPS_A_INSERER") {
|
||||
url = place.gmapLink;
|
||||
} else {
|
||||
url = `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(place.location.address)}`;
|
||||
}
|
||||
window.open(url, "_blank");
|
||||
};
|
||||
|
||||
return (
|
||||
<Card className="overflow-hidden">
|
||||
<div className="relative h-48 bg-gradient-to-br from-primary/20 to-secondary">
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<MapPin className="h-16 w-16 text-primary/30" />
|
||||
</div>
|
||||
</div>
|
||||
<CardHeader>
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<div className="flex-1">
|
||||
<CardTitle>{place.name}</CardTitle>
|
||||
{place.type && (
|
||||
<p className="text-sm text-gray-500 mt-1">{place.type}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<p className="text-gray-700 leading-relaxed">{place.description}</p>
|
||||
|
||||
{place.keywords && place.keywords.length > 0 && (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{place.keywords.map((keyword, index) => (
|
||||
<span
|
||||
key={index}
|
||||
className="px-2 py-1 bg-secondary text-primary text-xs font-medium rounded-lg"
|
||||
>
|
||||
{keyword}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2 text-sm text-gray-600">
|
||||
<MapPin className="h-4 w-4" />
|
||||
<span>{place.location.address}</span>
|
||||
</div>
|
||||
{place.contact && (
|
||||
<div className="flex items-center gap-2 text-sm text-gray-600">
|
||||
<span className="font-medium">Contact:</span>
|
||||
<a
|
||||
href={`tel:${place.contact.replace(/\s/g, "")}`}
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
{place.contact}
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
{place.horaires && (
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-xl p-3">
|
||||
<p className="text-xs font-semibold text-blue-900 mb-1">Horaires</p>
|
||||
<p className="text-sm text-blue-800">{place.horaires}</p>
|
||||
</div>
|
||||
)}
|
||||
{place.conseil && (
|
||||
<div className="bg-secondary border border-primary/20 rounded-xl p-3">
|
||||
<p className="text-xs font-semibold text-primary mb-1">💡 Conseil pratique</p>
|
||||
<p className="text-sm text-gray-700">{place.conseil}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Button onClick={handleOpenMaps} className="w-full" variant="outline">
|
||||
<ExternalLink className="mr-2 h-4 w-4" />
|
||||
Y aller
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user