mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:51:13 -05:00
Add park and ride pages
This commit is contained in:
@@ -6,7 +6,9 @@ import { BrowserRouter, Routes, Route } from "react-router-dom";
|
|||||||
import Index from "./pages/Index";
|
import Index from "./pages/Index";
|
||||||
import Parks from "./pages/Parks";
|
import Parks from "./pages/Parks";
|
||||||
import ParkDetail from "./pages/ParkDetail";
|
import ParkDetail from "./pages/ParkDetail";
|
||||||
|
import RideDetail from "./pages/RideDetail";
|
||||||
import Rides from "./pages/Rides";
|
import Rides from "./pages/Rides";
|
||||||
|
import Manufacturers from "./pages/Manufacturers";
|
||||||
import NotFound from "./pages/NotFound";
|
import NotFound from "./pages/NotFound";
|
||||||
|
|
||||||
const queryClient = new QueryClient();
|
const queryClient = new QueryClient();
|
||||||
@@ -21,7 +23,9 @@ const App = () => (
|
|||||||
<Route path="/" element={<Index />} />
|
<Route path="/" element={<Index />} />
|
||||||
<Route path="/parks" element={<Parks />} />
|
<Route path="/parks" element={<Parks />} />
|
||||||
<Route path="/parks/:slug" element={<ParkDetail />} />
|
<Route path="/parks/:slug" element={<ParkDetail />} />
|
||||||
|
<Route path="/parks/:parkSlug/rides/:rideSlug" element={<RideDetail />} />
|
||||||
<Route path="/rides" element={<Rides />} />
|
<Route path="/rides" element={<Rides />} />
|
||||||
|
<Route path="/manufacturers" element={<Manufacturers />} />
|
||||||
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
|
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
|
||||||
<Route path="*" element={<NotFound />} />
|
<Route path="*" element={<NotFound />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { Input } from '@/components/ui/input';
|
|||||||
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet';
|
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
|
import { SearchDropdown } from '@/components/search/SearchDropdown';
|
||||||
|
|
||||||
export function Header() {
|
export function Header() {
|
||||||
const [isSearchFocused, setIsSearchFocused] = useState(false);
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -49,7 +49,11 @@ export function Header() {
|
|||||||
<Star className="w-4 h-4 mr-2" />
|
<Star className="w-4 h-4 mr-2" />
|
||||||
Reviews
|
Reviews
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" className="text-sm font-medium hover:text-primary">
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
className="text-sm font-medium hover:text-primary"
|
||||||
|
onClick={() => navigate('/manufacturers')}
|
||||||
|
>
|
||||||
🏭 Manufacturers
|
🏭 Manufacturers
|
||||||
</Button>
|
</Button>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -57,33 +61,7 @@ export function Header() {
|
|||||||
|
|
||||||
{/* Search Bar */}
|
{/* Search Bar */}
|
||||||
<div className="flex-1 max-w-xl mx-4">
|
<div className="flex-1 max-w-xl mx-4">
|
||||||
<div className={`relative transition-all duration-300 ${isSearchFocused ? 'scale-105' : ''}`}>
|
<SearchDropdown />
|
||||||
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" />
|
|
||||||
<Input
|
|
||||||
placeholder="Search parks, rides, or locations..."
|
|
||||||
className={`pl-10 pr-4 bg-muted/50 border-border/50 focus:border-primary/50 transition-all duration-300 ${
|
|
||||||
isSearchFocused ? 'shadow-lg shadow-primary/10' : ''
|
|
||||||
}`}
|
|
||||||
onFocus={() => setIsSearchFocused(true)}
|
|
||||||
onBlur={() => setIsSearchFocused(false)}
|
|
||||||
/>
|
|
||||||
{isSearchFocused && (
|
|
||||||
<div className="absolute top-full mt-1 left-0 right-0 bg-card border border-border rounded-lg shadow-xl z-50 p-3">
|
|
||||||
<div className="text-sm text-muted-foreground mb-2">Popular searches</div>
|
|
||||||
<div className="flex flex-wrap gap-2">
|
|
||||||
<Badge variant="secondary" className="cursor-pointer hover:bg-primary/20">
|
|
||||||
Roller Coasters
|
|
||||||
</Badge>
|
|
||||||
<Badge variant="secondary" className="cursor-pointer hover:bg-primary/20">
|
|
||||||
Disney World
|
|
||||||
</Badge>
|
|
||||||
<Badge variant="secondary" className="cursor-pointer hover:bg-primary/20">
|
|
||||||
Cedar Point
|
|
||||||
</Badge>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* User Actions */}
|
{/* User Actions */}
|
||||||
@@ -123,7 +101,11 @@ export function Header() {
|
|||||||
<Star className="w-4 h-4 mr-2" />
|
<Star className="w-4 h-4 mr-2" />
|
||||||
Reviews
|
Reviews
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" className="justify-start">
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
className="justify-start"
|
||||||
|
onClick={() => navigate('/manufacturers')}
|
||||||
|
>
|
||||||
🏭 Manufacturers
|
🏭 Manufacturers
|
||||||
</Button>
|
</Button>
|
||||||
<div className="border-t pt-4 mt-4">
|
<div className="border-t pt-4 mt-4">
|
||||||
|
|||||||
67
src/components/search/SearchDropdown.tsx
Normal file
67
src/components/search/SearchDropdown.tsx
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import { useState, useRef, useEffect } from 'react';
|
||||||
|
import { Search } from 'lucide-react';
|
||||||
|
import { Input } from '@/components/ui/input';
|
||||||
|
import { SearchResults } from './SearchResults';
|
||||||
|
|
||||||
|
export function SearchDropdown() {
|
||||||
|
const [query, setQuery] = useState('');
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const [isFocused, setIsFocused] = useState(false);
|
||||||
|
const searchRef = useRef<HTMLDivElement>(null);
|
||||||
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleClickOutside = (event: MouseEvent) => {
|
||||||
|
if (searchRef.current && !searchRef.current.contains(event.target as Node)) {
|
||||||
|
setIsOpen(false);
|
||||||
|
setIsFocused(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
return () => document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
setQuery(value);
|
||||||
|
setIsOpen(value.length >= 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInputFocus = () => {
|
||||||
|
setIsFocused(true);
|
||||||
|
if (query.length >= 1) {
|
||||||
|
setIsOpen(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setIsOpen(false);
|
||||||
|
setQuery('');
|
||||||
|
inputRef.current?.blur();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={searchRef} className={`relative transition-all duration-300 ${isFocused ? 'scale-105' : ''}`}>
|
||||||
|
<div className="relative">
|
||||||
|
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" />
|
||||||
|
<Input
|
||||||
|
ref={inputRef}
|
||||||
|
placeholder="Search parks, rides, or manufacturers..."
|
||||||
|
value={query}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
onFocus={handleInputFocus}
|
||||||
|
className={`pl-10 pr-4 bg-muted/50 border-border/50 focus:border-primary/50 transition-all duration-300 ${
|
||||||
|
isFocused ? 'shadow-lg shadow-primary/10' : ''
|
||||||
|
}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isOpen && (
|
||||||
|
<div className="absolute top-full mt-1 left-0 right-0 bg-card border border-border rounded-lg shadow-xl z-50 max-w-2xl">
|
||||||
|
<SearchResults query={query} onClose={handleClose} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
237
src/components/search/SearchResults.tsx
Normal file
237
src/components/search/SearchResults.tsx
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { MapPin, Star, Search as SearchIcon } from 'lucide-react';
|
||||||
|
import { Park, Ride, Company } from '@/types/database';
|
||||||
|
import { supabase } from '@/integrations/supabase/client';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
interface SearchResultsProps {
|
||||||
|
query: string;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
type SearchResult = {
|
||||||
|
type: 'park' | 'ride' | 'company';
|
||||||
|
data: Park | Ride | Company;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function SearchResults({ query, onClose }: SearchResultsProps) {
|
||||||
|
const [results, setResults] = useState<SearchResult[]>([]);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (query.length >= 2) {
|
||||||
|
searchContent();
|
||||||
|
} else {
|
||||||
|
setResults([]);
|
||||||
|
}
|
||||||
|
}, [query]);
|
||||||
|
|
||||||
|
const searchContent = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const searchTerm = `%${query.toLowerCase()}%`;
|
||||||
|
|
||||||
|
// Search parks
|
||||||
|
const { data: parks } = await supabase
|
||||||
|
.from('parks')
|
||||||
|
.select(`*, location:locations(*)`)
|
||||||
|
.or(`name.ilike.${searchTerm},description.ilike.${searchTerm}`)
|
||||||
|
.limit(5);
|
||||||
|
|
||||||
|
// Search rides
|
||||||
|
const { data: rides } = await supabase
|
||||||
|
.from('rides')
|
||||||
|
.select(`*, park:parks!inner(name, slug)`)
|
||||||
|
.or(`name.ilike.${searchTerm},description.ilike.${searchTerm}`)
|
||||||
|
.limit(5);
|
||||||
|
|
||||||
|
// Search companies
|
||||||
|
const { data: companies } = await supabase
|
||||||
|
.from('companies')
|
||||||
|
.select('*')
|
||||||
|
.or(`name.ilike.${searchTerm},description.ilike.${searchTerm}`)
|
||||||
|
.limit(3);
|
||||||
|
|
||||||
|
const allResults: SearchResult[] = [
|
||||||
|
...(parks || []).map(park => ({ type: 'park' as const, data: park })),
|
||||||
|
...(rides || []).map(ride => ({ type: 'ride' as const, data: ride })),
|
||||||
|
...(companies || []).map(company => ({ type: 'company' as const, data: company }))
|
||||||
|
];
|
||||||
|
|
||||||
|
setResults(allResults);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Search error:', error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleResultClick = (result: SearchResult) => {
|
||||||
|
onClose();
|
||||||
|
|
||||||
|
switch (result.type) {
|
||||||
|
case 'park':
|
||||||
|
navigate(`/parks/${(result.data as Park).slug}`);
|
||||||
|
break;
|
||||||
|
case 'ride':
|
||||||
|
const ride = result.data as Ride;
|
||||||
|
if (ride.park && typeof ride.park === 'object' && 'slug' in ride.park) {
|
||||||
|
navigate(`/parks/${ride.park.slug}/rides/${ride.slug}`);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'company':
|
||||||
|
// Navigate to manufacturer page when implemented
|
||||||
|
console.log('Company clicked:', result.data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getResultIcon = (result: SearchResult) => {
|
||||||
|
switch (result.type) {
|
||||||
|
case 'park':
|
||||||
|
const park = result.data as Park;
|
||||||
|
switch (park.park_type) {
|
||||||
|
case 'theme_park': return '🏰';
|
||||||
|
case 'amusement_park': return '🎢';
|
||||||
|
case 'water_park': return '🏊';
|
||||||
|
default: return '🎡';
|
||||||
|
}
|
||||||
|
case 'ride':
|
||||||
|
const ride = result.data as Ride;
|
||||||
|
switch (ride.category) {
|
||||||
|
case 'roller_coaster': return '🎢';
|
||||||
|
case 'water_ride': return '🌊';
|
||||||
|
case 'dark_ride': return '🎭';
|
||||||
|
default: return '🎡';
|
||||||
|
}
|
||||||
|
case 'company':
|
||||||
|
return '🏭';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getResultTitle = (result: SearchResult) => {
|
||||||
|
return result.data.name;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getResultSubtitle = (result: SearchResult) => {
|
||||||
|
switch (result.type) {
|
||||||
|
case 'park':
|
||||||
|
const park = result.data as Park;
|
||||||
|
return park.location ? `${park.location.city}, ${park.location.country}` : 'Theme Park';
|
||||||
|
case 'ride':
|
||||||
|
const ride = result.data as Ride;
|
||||||
|
return ride.park && typeof ride.park === 'object' && 'name' in ride.park
|
||||||
|
? `at ${ride.park.name}`
|
||||||
|
: 'Ride';
|
||||||
|
case 'company':
|
||||||
|
const company = result.data as Company;
|
||||||
|
return company.company_type.replace('_', ' ');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getResultRating = (result: SearchResult) => {
|
||||||
|
if (result.type === 'park' || result.type === 'ride') {
|
||||||
|
const data = result.data as Park | Ride;
|
||||||
|
return data.average_rating > 0 ? data.average_rating : null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (query.length < 2) {
|
||||||
|
return (
|
||||||
|
<div className="p-6 text-center">
|
||||||
|
<SearchIcon className="w-12 h-12 text-muted-foreground mx-auto mb-3" />
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
Start typing to search parks, rides, and manufacturers...
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="p-6">
|
||||||
|
<div className="animate-pulse space-y-3">
|
||||||
|
{[...Array(5)].map((_, i) => (
|
||||||
|
<div key={i} className="h-16 bg-muted rounded"></div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results.length === 0) {
|
||||||
|
return (
|
||||||
|
<div className="p-6 text-center">
|
||||||
|
<SearchIcon className="w-12 h-12 text-muted-foreground mx-auto mb-3" />
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
No results found for "{query}"
|
||||||
|
</p>
|
||||||
|
<p className="text-sm text-muted-foreground mt-1">
|
||||||
|
Try searching for park names, ride names, or locations
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="max-h-96 overflow-y-auto">
|
||||||
|
<div className="p-2 space-y-1">
|
||||||
|
{results.map((result, index) => (
|
||||||
|
<Card
|
||||||
|
key={`${result.type}-${result.data.id}-${index}`}
|
||||||
|
className="cursor-pointer hover:bg-muted/50 transition-colors"
|
||||||
|
onClick={() => handleResultClick(result)}
|
||||||
|
>
|
||||||
|
<CardContent className="p-3">
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<div className="text-2xl">{getResultIcon(result)}</div>
|
||||||
|
<div className="flex-1 min-w-0">
|
||||||
|
<div className="flex items-center gap-2 mb-1">
|
||||||
|
<h4 className="font-medium text-sm truncate">
|
||||||
|
{getResultTitle(result)}
|
||||||
|
</h4>
|
||||||
|
<Badge variant="secondary" className="text-xs">
|
||||||
|
{result.type}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-muted-foreground truncate">
|
||||||
|
{getResultSubtitle(result)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{getResultRating(result) && (
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<Star className="w-3 h-3 fill-yellow-400 text-yellow-400" />
|
||||||
|
<span className="text-xs font-medium">
|
||||||
|
{getResultRating(result)?.toFixed(1)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{results.length > 0 && (
|
||||||
|
<div className="p-3 border-t">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
className="w-full"
|
||||||
|
onClick={() => {
|
||||||
|
onClose();
|
||||||
|
navigate(`/search?q=${encodeURIComponent(query)}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
View all results for "{query}"
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
251
src/pages/Manufacturers.tsx
Normal file
251
src/pages/Manufacturers.tsx
Normal file
@@ -0,0 +1,251 @@
|
|||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import { Header } from '@/components/layout/Header';
|
||||||
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
|
import { Input } from '@/components/ui/input';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { Search, Filter, SlidersHorizontal, Globe, MapPin } from 'lucide-react';
|
||||||
|
import { Company } from '@/types/database';
|
||||||
|
import { supabase } from '@/integrations/supabase/client';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
export default function Manufacturers() {
|
||||||
|
const [companies, setCompanies] = useState<Company[]>([]);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
|
const [sortBy, setSortBy] = useState('name');
|
||||||
|
const [filterType, setFilterType] = useState('all');
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchCompanies();
|
||||||
|
}, [sortBy, filterType]);
|
||||||
|
|
||||||
|
const fetchCompanies = async () => {
|
||||||
|
try {
|
||||||
|
let query = supabase
|
||||||
|
.from('companies')
|
||||||
|
.select('*');
|
||||||
|
|
||||||
|
// Apply filters
|
||||||
|
if (filterType !== 'all') {
|
||||||
|
query = query.eq('company_type', filterType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply sorting
|
||||||
|
switch (sortBy) {
|
||||||
|
case 'founded':
|
||||||
|
query = query.order('founded_year', { ascending: false, nullsFirst: false });
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
query = query.order('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data } = await query;
|
||||||
|
setCompanies(data || []);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching companies:', error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const filteredCompanies = companies.filter(company =>
|
||||||
|
company.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
company.headquarters_location?.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
company.description?.toLowerCase().includes(searchQuery.toLowerCase())
|
||||||
|
);
|
||||||
|
|
||||||
|
const getCompanyIcon = (type: string) => {
|
||||||
|
switch (type) {
|
||||||
|
case 'manufacturer': return '🏭';
|
||||||
|
case 'operator': return '🎡';
|
||||||
|
case 'designer': return '📐';
|
||||||
|
case 'contractor': return '🔨';
|
||||||
|
default: return '🏢';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatCompanyType = (type: string) => {
|
||||||
|
return type.split('_').map(word =>
|
||||||
|
word.charAt(0).toUpperCase() + word.slice(1)
|
||||||
|
).join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
|
const companyTypes = [
|
||||||
|
{ value: 'all', label: 'All Types' },
|
||||||
|
{ value: 'manufacturer', label: 'Manufacturers' },
|
||||||
|
{ value: 'operator', label: 'Operators' },
|
||||||
|
{ value: 'designer', label: 'Designers' },
|
||||||
|
{ value: 'contractor', label: 'Contractors' }
|
||||||
|
];
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
<div className="container mx-auto px-4 py-8">
|
||||||
|
<div className="animate-pulse space-y-6">
|
||||||
|
<div className="h-12 bg-muted rounded w-1/3"></div>
|
||||||
|
<div className="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||||
|
{[...Array(8)].map((_, i) => (
|
||||||
|
<div key={i} className="h-64 bg-muted rounded-lg"></div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
|
||||||
|
<main className="container mx-auto px-4 py-8">
|
||||||
|
{/* Page Header */}
|
||||||
|
<div className="mb-8">
|
||||||
|
<div className="flex items-center gap-3 mb-4">
|
||||||
|
<div className="text-4xl">🏭</div>
|
||||||
|
<h1 className="text-4xl font-bold">Manufacturers & Companies</h1>
|
||||||
|
</div>
|
||||||
|
<p className="text-lg text-muted-foreground">
|
||||||
|
Explore the companies behind your favorite rides and attractions
|
||||||
|
</p>
|
||||||
|
<div className="flex items-center gap-2 mt-2">
|
||||||
|
<Badge variant="secondary">{filteredCompanies.length} companies found</Badge>
|
||||||
|
<Badge variant="outline">{companies.filter(c => c.company_type === 'manufacturer').length} manufacturers</Badge>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Search and Filters */}
|
||||||
|
<div className="mb-8 space-y-4">
|
||||||
|
<div className="flex flex-col md:flex-row gap-4">
|
||||||
|
<div className="relative flex-1">
|
||||||
|
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" />
|
||||||
|
<Input
|
||||||
|
placeholder="Search companies by name, location, or description..."
|
||||||
|
value={searchQuery}
|
||||||
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
|
className="pl-10"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Select value={sortBy} onValueChange={setSortBy}>
|
||||||
|
<SelectTrigger className="w-[180px]">
|
||||||
|
<SlidersHorizontal className="w-4 h-4 mr-2" />
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="name">Name A-Z</SelectItem>
|
||||||
|
<SelectItem value="founded">Founded (Newest)</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
|
||||||
|
<Select value={filterType} onValueChange={setFilterType}>
|
||||||
|
<SelectTrigger className="w-[160px]">
|
||||||
|
<Filter className="w-4 h-4 mr-2" />
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{companyTypes.map(type => (
|
||||||
|
<SelectItem key={type.value} value={type.value}>
|
||||||
|
{type.label}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Companies Grid */}
|
||||||
|
{filteredCompanies.length > 0 ? (
|
||||||
|
<div className="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||||
|
{filteredCompanies.map((company) => (
|
||||||
|
<Card
|
||||||
|
key={company.id}
|
||||||
|
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]"
|
||||||
|
>
|
||||||
|
<CardHeader className="pb-3">
|
||||||
|
<div className="flex items-start justify-between">
|
||||||
|
<div className="flex-1">
|
||||||
|
<div className="flex items-center gap-2 mb-2">
|
||||||
|
<span className="text-2xl">{getCompanyIcon(company.company_type)}</span>
|
||||||
|
<Badge variant="outline" className="text-xs">
|
||||||
|
{formatCompanyType(company.company_type)}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
<CardTitle className="text-lg group-hover:text-primary transition-colors line-clamp-2">
|
||||||
|
{company.name}
|
||||||
|
</CardTitle>
|
||||||
|
</div>
|
||||||
|
{company.logo_url && (
|
||||||
|
<div className="w-12 h-12 bg-muted rounded-lg overflow-hidden flex-shrink-0">
|
||||||
|
<img
|
||||||
|
src={company.logo_url}
|
||||||
|
alt={`${company.name} logo`}
|
||||||
|
className="w-full h-full object-cover"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</CardHeader>
|
||||||
|
|
||||||
|
<CardContent className="space-y-3">
|
||||||
|
{company.description && (
|
||||||
|
<p className="text-sm text-muted-foreground line-clamp-3">
|
||||||
|
{company.description}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="space-y-2 text-sm">
|
||||||
|
{company.founded_year && (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<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-2">
|
||||||
|
<MapPin className="w-3 h-3 text-muted-foreground" />
|
||||||
|
<span className="text-muted-foreground text-xs">
|
||||||
|
{company.headquarters_location}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{company.website_url && (
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
className="w-full"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
window.open(company.website_url, '_blank');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Globe className="w-4 h-4 mr-2" />
|
||||||
|
Visit Website
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<div className="text-6xl mb-4">🏭</div>
|
||||||
|
<h3 className="text-xl font-semibold mb-2">No companies found</h3>
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
Try adjusting your search criteria or filters
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
487
src/pages/RideDetail.tsx
Normal file
487
src/pages/RideDetail.tsx
Normal file
@@ -0,0 +1,487 @@
|
|||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import { useParams, useNavigate } from 'react-router-dom';
|
||||||
|
import { Header } from '@/components/layout/Header';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||||
|
import { Separator } from '@/components/ui/separator';
|
||||||
|
import {
|
||||||
|
MapPin,
|
||||||
|
Star,
|
||||||
|
Clock,
|
||||||
|
Zap,
|
||||||
|
ArrowLeft,
|
||||||
|
Users,
|
||||||
|
Ruler,
|
||||||
|
Timer,
|
||||||
|
TrendingUp,
|
||||||
|
Camera,
|
||||||
|
Heart,
|
||||||
|
AlertTriangle
|
||||||
|
} from 'lucide-react';
|
||||||
|
import { Ride } from '@/types/database';
|
||||||
|
import { supabase } from '@/integrations/supabase/client';
|
||||||
|
|
||||||
|
export default function RideDetail() {
|
||||||
|
const { parkSlug, rideSlug } = useParams<{ parkSlug: string; rideSlug: string }>();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [ride, setRide] = useState<Ride | null>(null);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (parkSlug && rideSlug) {
|
||||||
|
fetchRideData();
|
||||||
|
}
|
||||||
|
}, [parkSlug, rideSlug]);
|
||||||
|
|
||||||
|
const fetchRideData = async () => {
|
||||||
|
try {
|
||||||
|
// First get park to find park_id
|
||||||
|
const { data: parkData } = await supabase
|
||||||
|
.from('parks')
|
||||||
|
.select('id')
|
||||||
|
.eq('slug', parkSlug)
|
||||||
|
.maybeSingle();
|
||||||
|
|
||||||
|
if (parkData) {
|
||||||
|
// Then get ride details
|
||||||
|
const { data: rideData } = await supabase
|
||||||
|
.from('rides')
|
||||||
|
.select(`
|
||||||
|
*,
|
||||||
|
park:parks!inner(name, slug, location:locations(*)),
|
||||||
|
manufacturer:companies!rides_manufacturer_id_fkey(*),
|
||||||
|
designer:companies!rides_designer_id_fkey(*)
|
||||||
|
`)
|
||||||
|
.eq('park_id', parkData.id)
|
||||||
|
.eq('slug', rideSlug)
|
||||||
|
.maybeSingle();
|
||||||
|
|
||||||
|
setRide(rideData);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching ride data:', error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getStatusColor = (status: string) => {
|
||||||
|
switch (status) {
|
||||||
|
case 'operating': return 'bg-green-500/20 text-green-400 border-green-500/30';
|
||||||
|
case 'seasonal': return 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30';
|
||||||
|
case 'under_construction': return 'bg-blue-500/20 text-blue-400 border-blue-500/30';
|
||||||
|
default: return 'bg-red-500/20 text-red-400 border-red-500/30';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getRideIcon = (category: string) => {
|
||||||
|
switch (category) {
|
||||||
|
case 'roller_coaster': return '🎢';
|
||||||
|
case 'water_ride': return '🌊';
|
||||||
|
case 'dark_ride': return '🎭';
|
||||||
|
case 'flat_ride': return '🎡';
|
||||||
|
case 'kiddie_ride': return '🎠';
|
||||||
|
case 'transportation': return '🚂';
|
||||||
|
default: return '🎢';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatCategory = (category: string) => {
|
||||||
|
return category.split('_').map(word =>
|
||||||
|
word.charAt(0).toUpperCase() + word.slice(1)
|
||||||
|
).join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
<div className="container mx-auto px-4 py-8">
|
||||||
|
<div className="animate-pulse space-y-6">
|
||||||
|
<div className="h-64 bg-muted rounded-lg"></div>
|
||||||
|
<div className="h-8 bg-muted rounded w-1/2"></div>
|
||||||
|
<div className="h-4 bg-muted rounded w-1/3"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ride || !ride.park) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
<div className="container mx-auto px-4 py-8">
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<h1 className="text-2xl font-bold mb-4">Ride Not Found</h1>
|
||||||
|
<p className="text-muted-foreground mb-6">
|
||||||
|
The ride you're looking for doesn't exist or has been removed.
|
||||||
|
</p>
|
||||||
|
<Button onClick={() => navigate('/rides')}>
|
||||||
|
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||||
|
Back to Rides
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
|
||||||
|
<main className="container mx-auto px-4 py-8">
|
||||||
|
{/* Back Button */}
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
onClick={() => navigate(`/parks/${ride.park?.slug}`)}
|
||||||
|
className="mb-6"
|
||||||
|
>
|
||||||
|
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||||
|
Back to {ride.park?.name}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
{/* Hero Section */}
|
||||||
|
<div className="relative mb-8">
|
||||||
|
<div className="aspect-[21/9] bg-gradient-to-br from-primary/20 via-secondary/20 to-accent/20 rounded-lg overflow-hidden relative">
|
||||||
|
{ride.image_url ? (
|
||||||
|
<img
|
||||||
|
src={ride.image_url}
|
||||||
|
alt={ride.name}
|
||||||
|
className="w-full h-full object-cover"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="flex items-center justify-center h-full">
|
||||||
|
<div className="text-8xl opacity-50">
|
||||||
|
{getRideIcon(ride.category)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent" />
|
||||||
|
|
||||||
|
{/* Ride Title Overlay */}
|
||||||
|
<div className="absolute bottom-0 left-0 right-0 p-8">
|
||||||
|
<div className="flex items-end justify-between">
|
||||||
|
<div>
|
||||||
|
<div className="flex items-center gap-3 mb-2">
|
||||||
|
<Badge className={`${getStatusColor(ride.status)} border`}>
|
||||||
|
{ride.status.replace('_', ' ').toUpperCase()}
|
||||||
|
</Badge>
|
||||||
|
<Badge variant="outline" className="bg-black/20 text-white border-white/20">
|
||||||
|
{formatCategory(ride.category)}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
<h1 className="text-4xl md:text-6xl font-bold text-white mb-2">
|
||||||
|
{ride.name}
|
||||||
|
</h1>
|
||||||
|
<div className="flex items-center text-white/90 text-lg">
|
||||||
|
<MapPin className="w-5 h-5 mr-2" />
|
||||||
|
{ride.park.name}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{ride.average_rating > 0 && (
|
||||||
|
<div className="bg-black/20 backdrop-blur-sm rounded-lg p-4 text-center">
|
||||||
|
<div className="flex items-center gap-2 text-white mb-1">
|
||||||
|
<Star className="w-5 h-5 fill-yellow-400 text-yellow-400" />
|
||||||
|
<span className="text-2xl font-bold">{ride.average_rating.toFixed(1)}</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-white/70 text-sm">
|
||||||
|
{ride.review_count} reviews
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Quick Stats */}
|
||||||
|
<div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4 mb-8">
|
||||||
|
{ride.max_speed_kmh && (
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<Zap className="w-6 h-6 text-primary mx-auto mb-2" />
|
||||||
|
<div className="text-2xl font-bold text-primary">{ride.max_speed_kmh}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">km/h</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{ride.max_height_meters && (
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<TrendingUp className="w-6 h-6 text-accent mx-auto mb-2" />
|
||||||
|
<div className="text-2xl font-bold text-accent">{ride.max_height_meters}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">meters</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{ride.length_meters && (
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<Ruler className="w-6 h-6 text-secondary mx-auto mb-2" />
|
||||||
|
<div className="text-2xl font-bold text-secondary">{Math.round(ride.length_meters)}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">meters long</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{ride.duration_seconds && (
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<Timer className="w-6 h-6 text-primary mx-auto mb-2" />
|
||||||
|
<div className="text-2xl font-bold text-primary">{Math.floor(ride.duration_seconds / 60)}:{(ride.duration_seconds % 60).toString().padStart(2, '0')}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">duration</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{ride.capacity_per_hour && (
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<Users className="w-6 h-6 text-accent mx-auto mb-2" />
|
||||||
|
<div className="text-2xl font-bold text-accent">{ride.capacity_per_hour}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">riders/hour</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{ride.inversions && ride.inversions > 0 && (
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<div className="text-2xl mb-2">🔄</div>
|
||||||
|
<div className="text-2xl font-bold">{ride.inversions}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">inversions</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Requirements & Warnings */}
|
||||||
|
{(ride.height_requirement || ride.age_requirement) && (
|
||||||
|
<Card className="mb-8 border-orange-200 bg-orange-50 dark:border-orange-800 dark:bg-orange-950">
|
||||||
|
<CardContent className="p-4">
|
||||||
|
<div className="flex items-start gap-3">
|
||||||
|
<AlertTriangle className="w-5 h-5 text-orange-600 mt-0.5" />
|
||||||
|
<div>
|
||||||
|
<h3 className="font-semibold text-orange-800 dark:text-orange-200 mb-2">
|
||||||
|
Ride Requirements
|
||||||
|
</h3>
|
||||||
|
<div className="text-sm space-y-1">
|
||||||
|
{ride.height_requirement && (
|
||||||
|
<div>Minimum height: {ride.height_requirement}cm</div>
|
||||||
|
)}
|
||||||
|
{ride.age_requirement && (
|
||||||
|
<div>Minimum age: {ride.age_requirement} years</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Main Content */}
|
||||||
|
<Tabs defaultValue="overview" className="w-full">
|
||||||
|
<TabsList className="grid w-full grid-cols-4">
|
||||||
|
<TabsTrigger value="overview">Overview</TabsTrigger>
|
||||||
|
<TabsTrigger value="specs">Specifications</TabsTrigger>
|
||||||
|
<TabsTrigger value="reviews">Reviews</TabsTrigger>
|
||||||
|
<TabsTrigger value="photos">Photos</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
|
|
||||||
|
<TabsContent value="overview" className="mt-6">
|
||||||
|
<div className="grid lg:grid-cols-3 gap-6">
|
||||||
|
<div className="lg:col-span-2 space-y-6">
|
||||||
|
{/* Description */}
|
||||||
|
{ride.description && (
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>About {ride.name}</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<p className="text-muted-foreground leading-relaxed">
|
||||||
|
{ride.description}
|
||||||
|
</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-6">
|
||||||
|
{/* Ride Information */}
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>Ride Information</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="space-y-4">
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<div className="text-2xl">{getRideIcon(ride.category)}</div>
|
||||||
|
<div>
|
||||||
|
<div className="font-medium">Category</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
{formatCategory(ride.category)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{ride.opening_date && (
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Clock className="w-4 h-4 text-muted-foreground" />
|
||||||
|
<div>
|
||||||
|
<div className="font-medium">Opened</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
{new Date(ride.opening_date).getFullYear()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{ride.manufacturer && (
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Users className="w-4 h-4 text-muted-foreground" />
|
||||||
|
<div>
|
||||||
|
<div className="font-medium">Manufacturer</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
{ride.manufacturer.name}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{ride.designer && (
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Users className="w-4 h-4 text-muted-foreground" />
|
||||||
|
<div>
|
||||||
|
<div className="font-medium">Designer</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
{ride.designer.name}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div className="font-medium">Located at</div>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
className="w-full justify-start"
|
||||||
|
onClick={() => navigate(`/parks/${ride.park?.slug}`)}
|
||||||
|
>
|
||||||
|
<MapPin className="w-4 h-4 mr-2" />
|
||||||
|
{ride.park.name}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="specs" className="mt-6">
|
||||||
|
<div className="grid md:grid-cols-2 gap-6">
|
||||||
|
{/* Performance Stats */}
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>Performance</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="space-y-4">
|
||||||
|
{ride.max_speed_kmh && (
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span>Maximum Speed</span>
|
||||||
|
<span className="font-medium">{ride.max_speed_kmh} km/h</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{ride.max_height_meters && (
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span>Maximum Height</span>
|
||||||
|
<span className="font-medium">{ride.max_height_meters}m</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{ride.length_meters && (
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span>Track Length</span>
|
||||||
|
<span className="font-medium">{Math.round(ride.length_meters)}m</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{ride.duration_seconds && (
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span>Ride Duration</span>
|
||||||
|
<span className="font-medium">{Math.floor(ride.duration_seconds / 60)}:{(ride.duration_seconds % 60).toString().padStart(2, '0')}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{ride.inversions && ride.inversions > 0 && (
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span>Inversions</span>
|
||||||
|
<span className="font-medium">{ride.inversions}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
{/* Operational Info */}
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>Operational Details</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="space-y-4">
|
||||||
|
{ride.capacity_per_hour && (
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span>Capacity</span>
|
||||||
|
<span className="font-medium">{ride.capacity_per_hour} riders/hour</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{ride.height_requirement && (
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span>Height Requirement</span>
|
||||||
|
<span className="font-medium">{ride.height_requirement}cm minimum</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{ride.age_requirement && (
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span>Age Requirement</span>
|
||||||
|
<span className="font-medium">{ride.age_requirement}+ years</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span>Status</span>
|
||||||
|
<Badge className={getStatusColor(ride.status)}>
|
||||||
|
{ride.status.replace('_', ' ')}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="reviews" className="mt-6">
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<Star className="w-16 h-16 text-muted-foreground mx-auto mb-4" />
|
||||||
|
<h3 className="text-xl font-semibold mb-2">Reviews Coming Soon</h3>
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
User reviews and ratings will be available soon
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="photos" className="mt-6">
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<Camera className="w-16 h-16 text-muted-foreground mx-auto mb-4" />
|
||||||
|
<h3 className="text-xl font-semibold mb-2">Photo Gallery Coming Soon</h3>
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
Photo galleries and media uploads will be available soon
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
</Tabs>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user