Files
thrillwiki_django_no_react/templates/pages/rides/detail.html
pacnpal b9063ff4f8 feat: Add detailed park and ride pages with HTMX integration
- Implemented park detail page with dynamic content loading for rides and weather.
- Created park list page with filters and search functionality.
- Developed ride detail page showcasing ride stats, reviews, and similar rides.
- Added ride list page with filtering options and dynamic loading.
- Introduced search results page with tabs for parks, rides, and users.
- Added HTMX tests for global search functionality.
2025-12-19 19:53:20 -05:00

178 lines
10 KiB
HTML

{% extends "base/htmx-base.html" %}
{% load static %}
{% block title %}{{ ride.name }} - {{ ride.park.name }} - ThrillWiki{% endblock %}
{% block main %}
<div class="container py-8">
<!-- Breadcrumbs -->
<nav class="flex mb-6 text-sm text-muted-foreground">
<a href="{% url 'home' %}" class="hover:text-foreground">Home</a>
<span class="mx-2">/</span>
<a href="{% url 'parks:park_list' %}" class="hover:text-foreground">Parks</a>
<span class="mx-2">/</span>
<a href="{% url 'parks:park_detail' ride.park.id %}" class="hover:text-foreground">{{ ride.park.name }}</a>
<span class="mx-2">/</span>
<span class="text-foreground">{{ ride.name }}</span>
</nav>
<div class="grid grid-cols-1 gap-8 lg:grid-cols-3">
<!-- Main Content -->
<div class="space-y-8 lg:col-span-2">
<!-- Ride Header -->
<div class="relative overflow-hidden border rounded-lg shadow-sm bg-card text-card-foreground">
<div class="relative aspect-video">
{% if ride.image %}
<img src="{{ ride.image.url }}" alt="{{ ride.name }}" class="object-cover w-full h-full">
{% else %}
<div class="flex items-center justify-center w-full h-full bg-muted">
<span class="text-muted-foreground">No image available</span>
</div>
{% endif %}
<div class="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"></div>
<div class="absolute text-white bottom-6 left-6">
<h1 class="mb-2 text-4xl font-bold">{{ ride.name }}</h1>
<div class="flex items-center gap-4 text-sm">
<span class="flex items-center gap-1">
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
</svg>
{{ ride.park.name }}
</span>
<span class="px-2 py-0.5 rounded-full bg-white/20 backdrop-blur-sm border border-white/20">
{{ ride.get_status_display }}
</span>
</div>
</div>
</div>
<div class="p-6">
<div class="flex items-center justify-between mb-6">
<div class="flex items-center gap-4">
<div class="flex flex-col items-center p-3 rounded-lg bg-muted/50">
<span class="text-2xl font-bold">{{ ride.average_rating|default:"-" }}</span>
<span class="text-xs text-muted-foreground">Rating</span>
</div>
<div class="flex flex-col items-center p-3 rounded-lg bg-muted/50">
<span class="text-2xl font-bold">{{ ride.top_speed|default:"-" }}</span>
<span class="text-xs text-muted-foreground">mph</span>
</div>
<div class="flex flex-col items-center p-3 rounded-lg bg-muted/50">
<span class="text-2xl font-bold">{{ ride.height|default:"-" }}</span>
<span class="text-xs text-muted-foreground">ft</span>
</div>
</div>
<div class="flex gap-2">
{% include "components/ui/button.html" with label="Rate Ride" variant="outline" icon='<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z" /></svg>' %}
{% include "components/ui/button.html" with label="Add to Credits" variant="default" icon='<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" /></svg>' %}
</div>
</div>
<div class="prose dark:prose-invert max-w-none">
<h3 class="mb-2 text-lg font-semibold">Description</h3>
<p class="text-muted-foreground">{{ ride.description }}</p>
</div>
</div>
</div>
<!-- Stats Grid -->
<div class="grid grid-cols-2 gap-4 md:grid-cols-4">
<div class="p-4 border rounded-lg shadow-sm bg-card text-card-foreground">
<dt class="text-sm font-medium text-muted-foreground">Manufacturer</dt>
<dd class="mt-1 text-lg font-semibold">{{ ride.manufacturer.name|default:"Unknown" }}</dd>
</div>
<div class="p-4 border rounded-lg shadow-sm bg-card text-card-foreground">
<dt class="text-sm font-medium text-muted-foreground">Opened</dt>
<dd class="mt-1 text-lg font-semibold">{{ ride.opening_date|date:"Y"|default:"Unknown" }}</dd>
</div>
<div class="p-4 border rounded-lg shadow-sm bg-card text-card-foreground">
<dt class="text-sm font-medium text-muted-foreground">Length</dt>
<dd class="mt-1 text-lg font-semibold">{{ ride.length|default:"-" }} ft</dd>
</div>
<div class="p-4 border rounded-lg shadow-sm bg-card text-card-foreground">
<dt class="text-sm font-medium text-muted-foreground">Inversions</dt>
<dd class="mt-1 text-lg font-semibold">{{ ride.inversions|default:"0" }}</dd>
</div>
</div>
<!-- Reviews Section -->
<div class="space-y-6">
<div class="flex items-center justify-between">
<h2 class="text-2xl font-bold tracking-tight">Reviews</h2>
<div class="flex items-center gap-2">
<span class="text-sm text-muted-foreground">{{ ride.review_count }} reviews</span>
</div>
</div>
<div id="reviews-list"
hx-get="{% url 'api:ride-reviews' ride.id %}"
hx-trigger="load"
hx-swap="innerHTML">
<!-- Loading State -->
{% for i in "123"|make_list %}
<div class="p-6 space-y-4 border rounded-lg shadow-sm bg-card text-card-foreground">
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-full bg-muted animate-pulse"></div>
<div class="space-y-2">
<div class="w-24 h-4 rounded bg-muted animate-pulse"></div>
<div class="w-16 h-3 rounded bg-muted animate-pulse"></div>
</div>
</div>
<div class="w-16 h-8 rounded bg-muted animate-pulse"></div>
</div>
<div class="space-y-2">
<div class="w-full h-4 rounded bg-muted animate-pulse"></div>
<div class="w-5/6 h-4 rounded bg-muted animate-pulse"></div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<!-- Sidebar -->
<div class="space-y-6">
<!-- Similar Rides -->
<div class="border rounded-lg shadow-sm bg-card text-card-foreground">
<div class="p-4 border-b">
<h3 class="font-semibold">Similar Rides</h3>
</div>
<div class="divide-y"
hx-get="{% url 'api:ride-similar' ride.id %}"
hx-trigger="load"
hx-swap="innerHTML">
{% for i in "123"|make_list %}
<div class="flex gap-4 p-4">
<div class="w-16 h-16 rounded bg-muted animate-pulse shrink-0"></div>
<div class="flex-1 space-y-2">
<div class="w-3/4 h-4 rounded bg-muted animate-pulse"></div>
<div class="w-1/2 h-3 rounded bg-muted animate-pulse"></div>
</div>
</div>
{% endfor %}
</div>
</div>
<!-- POV Video -->
{% if ride.pov_video_url %}
<div class="overflow-hidden border rounded-lg shadow-sm bg-card text-card-foreground">
<div class="p-4 border-b">
<h3 class="font-semibold">On-Ride POV</h3>
</div>
<div class="relative aspect-video bg-muted">
<!-- Video Embed -->
<iframe src="{{ ride.pov_video_url }}"
class="absolute inset-0 w-full h-full"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}