mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 18:31:11 -05:00
123 lines
4.6 KiB
TypeScript
123 lines
4.6 KiB
TypeScript
import React from 'react';
|
|
import { useNavigate } from 'react-router-dom';
|
|
import { Card, CardContent } from '@/components/ui/card';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import { Building2, Star, MapPin } from 'lucide-react';
|
|
import { Company } from '@/types/database';
|
|
|
|
interface ParkOwnerCardProps {
|
|
company: Company;
|
|
}
|
|
|
|
const ParkOwnerCard = ({ company }: ParkOwnerCardProps) => {
|
|
const navigate = useNavigate();
|
|
|
|
const handleClick = () => {
|
|
navigate(`/owners/${company.slug}/parks/`);
|
|
};
|
|
|
|
const getCompanyIcon = () => {
|
|
return <Building2 className="w-5 h-5" />;
|
|
};
|
|
|
|
return (
|
|
<Card
|
|
className="group overflow-hidden border-border/50 bg-gradient-to-br from-card via-card to-card/80 hover:shadow-2xl hover:shadow-primary/20 transition-all duration-300 cursor-pointer hover:scale-[1.02]"
|
|
onClick={handleClick}
|
|
>
|
|
{/* Logo/Image Section */}
|
|
<div className="aspect-video relative bg-gradient-to-br from-primary/20 via-primary/10 to-transparent overflow-hidden">
|
|
{(company.card_image_url || company.card_image_id) ? (
|
|
<img
|
|
src={company.card_image_url || `https://imagedelivery.net/X-2-mmiWukWxvAQQ2_o-7Q/${company.card_image_id}/public`}
|
|
alt={company.name}
|
|
className="w-full h-full object-cover group-hover:scale-110 transition-transform duration-500"
|
|
/>
|
|
) : (
|
|
<>
|
|
<div className="absolute inset-0 bg-gradient-to-t from-background/80 via-transparent to-transparent" />
|
|
|
|
{/* Property Owner Badge */}
|
|
<div className="absolute top-3 right-3 z-10">
|
|
<Badge variant="outline" className="bg-background/80 backdrop-blur-sm">
|
|
Property Owner
|
|
</Badge>
|
|
</div>
|
|
|
|
{/* Logo Display */}
|
|
<div className="absolute inset-0 flex items-center justify-center">
|
|
{company.logo_url ? (
|
|
<div className="w-20 h-20 bg-background/90 rounded-xl overflow-hidden shadow-lg backdrop-blur-sm border border-border/50">
|
|
<img
|
|
src={company.logo_url}
|
|
alt={`${company.name} logo`}
|
|
className="w-full h-full object-contain p-2"
|
|
/>
|
|
</div>
|
|
) : (
|
|
<div className="w-20 h-20 bg-background/90 rounded-xl shadow-lg backdrop-blur-sm border border-border/50 flex items-center justify-center">
|
|
{getCompanyIcon()}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</>
|
|
)}
|
|
</div>
|
|
|
|
<CardContent className="p-4 space-y-3">
|
|
{/* Company Name */}
|
|
<h3 className="text-lg font-semibold group-hover:text-primary transition-colors line-clamp-2">
|
|
{company.name}
|
|
</h3>
|
|
|
|
{/* Description */}
|
|
{company.description && (
|
|
<p className="text-sm text-muted-foreground line-clamp-2">
|
|
{company.description}
|
|
</p>
|
|
)}
|
|
|
|
{/* Company Info */}
|
|
<div className="flex flex-wrap gap-x-4 gap-y-1 text-sm">
|
|
{company.founded_year && (
|
|
<div className="flex items-center gap-1">
|
|
<span className="text-muted-foreground">Founded:</span>
|
|
<span className="font-medium">{company.founded_year}</span>
|
|
</div>
|
|
)}
|
|
|
|
{company.headquarters_location && (
|
|
<div className="flex items-center gap-1">
|
|
<MapPin className="w-3 h-3 text-muted-foreground" />
|
|
<span className="text-muted-foreground truncate">
|
|
{company.headquarters_location}
|
|
</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Rating */}
|
|
{company.average_rating > 0 && (
|
|
<div className="flex items-center gap-1">
|
|
<Star className="w-4 h-4 fill-yellow-400 text-yellow-400" />
|
|
<span className="text-sm font-medium">{company.average_rating.toFixed(1)}</span>
|
|
<span className="text-xs text-muted-foreground">({company.review_count} reviews)</span>
|
|
</div>
|
|
)}
|
|
|
|
{/* Park Count Stats */}
|
|
<div className="flex flex-wrap gap-x-4 gap-y-1 text-sm">
|
|
{(company as any).park_count > 0 && (
|
|
<div className="flex items-center gap-1">
|
|
<Building2 className="w-3 h-3 text-muted-foreground" />
|
|
<span className="font-medium">{(company as any).park_count}</span>
|
|
<span className="text-muted-foreground">parks owned</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
};
|
|
|
|
export default ParkOwnerCard; |