mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 06:51:13 -05:00
feat: Implement Operators listing page
This commit is contained in:
113
src/components/operators/OperatorCard.tsx
Normal file
113
src/components/operators/OperatorCard.tsx
Normal file
@@ -0,0 +1,113 @@
|
||||
import React from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Building, Star, MapPin } from 'lucide-react';
|
||||
import { Company } from '@/types/database';
|
||||
|
||||
interface OperatorCardProps {
|
||||
company: Company;
|
||||
}
|
||||
|
||||
const OperatorCard = ({ company }: OperatorCardProps) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleClick = () => {
|
||||
navigate(`/operators/${company.slug}/parks/`);
|
||||
};
|
||||
|
||||
const getCompanyIcon = () => {
|
||||
return <Building 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">
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-background/80 via-transparent to-transparent" />
|
||||
|
||||
{/* Park Operator Badge */}
|
||||
<div className="absolute top-3 right-3 z-10">
|
||||
<Badge variant="outline" className="bg-background/80 backdrop-blur-sm">
|
||||
Park Operator
|
||||
</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">
|
||||
<Building className="w-3 h-3 text-muted-foreground" />
|
||||
<span className="font-medium">{(company as any).park_count}</span>
|
||||
<span className="text-muted-foreground">parks operated</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default OperatorCard;
|
||||
Reference in New Issue
Block a user