Files
Compagnon-du-Lagon---Marama/components/explorer/PlaceCard.tsx
syoul 115d8c05a7 Build APK Android fonctionnel - Corrections finales
- Ajout de Java 21 dans Dockerfile pour compatibilité Capacitor
- Création de fichiers de types séparés (lib/types/) pour éviter dépendances API routes
- Configuration next.config.export.js pour export statique
- Exclusion temporaire des routes API pendant le build
- Correction configuration Gradle (Java 17/21)
- Script build-apk.sh amélioré avec gestion des routes API
- APK généré avec succès (4.5MB) dans dist/compagnon-admin-debug.apk

Fichiers de types créés:
- lib/types/place.ts
- lib/types/infos.ts
- lib/types/tides.ts
- lib/types/excursions.ts
- lib/types/sun-times.ts
- lib/types/notifications.ts

Tous les imports mis à jour pour utiliser les nouveaux fichiers de types.
2025-11-23 10:07:34 +01:00

95 lines
3.2 KiB
TypeScript

"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 "@/lib/types/place";
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>
);
}