mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 12:11:13 -05:00
309 lines
20 KiB
HTML
309 lines
20 KiB
HTML
{% extends "base/base.html" %}
|
|
{% load static %}
|
|
{% load cotton %}
|
|
|
|
{% block title %}Parks{% endblock %}
|
|
|
|
{% block content %}
|
|
{# Skip Navigation Links for Keyboard Users #}
|
|
<a href="#main-content" class="sr-only focus:not-sr-only focus:absolute focus:top-4 focus:left-4 z-50 px-4 py-2 bg-blue-600 text-white font-semibold rounded-lg shadow-lg focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-all duration-200">
|
|
Skip to main content
|
|
</a>
|
|
<a href="#search-form" class="sr-only focus:not-sr-only focus:absolute focus:top-4 focus:left-32 z-50 px-4 py-2 bg-blue-600 text-white font-semibold rounded-lg shadow-lg focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-all duration-200">
|
|
Skip to search
|
|
</a>
|
|
|
|
{# Enhanced Mobile-First Container with Better Spacing and Landmarks #}
|
|
<div class="container mx-auto px-3 sm:px-4 lg:px-6 py-4 sm:py-6" x-data="parkListState()">
|
|
{# Enhanced Mobile-First Header Section #}
|
|
<header class="mb-6 sm:mb-8" aria-labelledby="page-title">
|
|
<div class="flex flex-col gap-4 sm:gap-6">
|
|
{# Enhanced Mobile-First Title Section with Proper Heading #}
|
|
<div class="text-center sm:text-left">
|
|
<h1 id="page-title" class="text-2xl sm:text-3xl lg:text-4xl font-bold text-gray-900 dark:text-white leading-tight">
|
|
Theme Parks
|
|
</h1>
|
|
<p class="mt-1 sm:mt-2 text-base sm:text-lg text-gray-600 dark:text-gray-400" id="page-description">
|
|
Discover amazing theme parks around the world
|
|
</p>
|
|
</div>
|
|
|
|
{# Enhanced Mobile-First Quick Stats with Better Touch Targets and Landmarks #}
|
|
<section aria-labelledby="park-statistics" class="grid grid-cols-3 gap-3 sm:gap-4 lg:gap-6">
|
|
<h2 id="park-statistics" class="sr-only">Park Statistics Summary</h2>
|
|
<div class="text-center p-3 sm:p-4 bg-white/50 dark:bg-gray-800/50 rounded-lg border border-gray-200/50 dark:border-gray-700/50" role="img" aria-labelledby="total-parks-stat" tabindex="0">
|
|
<div id="total-parks-stat" class="font-bold text-lg sm:text-xl lg:text-2xl text-gray-900 dark:text-white" aria-label="{{ filter_counts.total_parks|default:0 }} total parks in database">{{ filter_counts.total_parks|default:0 }}</div>
|
|
<div class="text-xs sm:text-sm text-gray-600 dark:text-gray-400 mt-1">Total Parks</div>
|
|
</div>
|
|
<div class="text-center p-3 sm:p-4 bg-white/50 dark:bg-gray-800/50 rounded-lg border border-gray-200/50 dark:border-gray-700/50" role="img" aria-labelledby="operating-parks-stat" tabindex="0">
|
|
<div id="operating-parks-stat" class="font-bold text-lg sm:text-xl lg:text-2xl text-gray-900 dark:text-white" aria-label="{{ filter_counts.operating_parks|default:0 }} currently operating parks">{{ filter_counts.operating_parks|default:0 }}</div>
|
|
<div class="text-xs sm:text-sm text-gray-600 dark:text-gray-400 mt-1">Operating</div>
|
|
</div>
|
|
<div class="text-center p-3 sm:p-4 bg-white/50 dark:bg-gray-800/50 rounded-lg border border-gray-200/50 dark:border-gray-700/50" role="img" aria-labelledby="coaster-parks-stat" tabindex="0">
|
|
<div id="coaster-parks-stat" class="font-bold text-lg sm:text-xl lg:text-2xl text-gray-900 dark:text-white" aria-label="{{ filter_counts.parks_with_coasters|default:0 }} parks with roller coasters">{{ filter_counts.parks_with_coasters|default:0 }}</div>
|
|
<div class="text-xs sm:text-sm text-gray-600 dark:text-gray-400 mt-1">With Coasters</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</header>
|
|
|
|
{# Enhanced Mobile-First Search and Filter Bar with Proper Landmarks #}
|
|
<section class="bg-white dark:bg-gray-800 rounded-xl shadow-lg border border-gray-200 dark:border-gray-700 p-4 sm:p-6 mb-6 sm:mb-8" aria-labelledby="search-filters-heading" role="search">
|
|
<h2 id="search-filters-heading" class="sr-only">Search and Filter Parks</h2>
|
|
<div class="space-y-4 sm:space-y-6">
|
|
{# Enhanced Mobile-First Main Search Row #}
|
|
<div class="space-y-3 sm:space-y-0 sm:flex sm:flex-col lg:flex-row gap-4">
|
|
{# Enhanced Search Input with Better Mobile UX and Form Landmark #}
|
|
<div class="flex-1" id="search-form">
|
|
<label for="park-search" class="sr-only">Search parks by name, location, or features</label>
|
|
<c-enhanced_search
|
|
placeholder="Search parks by name, location, or features..."
|
|
current_value="{{ search_query }}"
|
|
autocomplete_url="{% url 'parks:park_autocomplete' %}"
|
|
class="w-full"
|
|
/>
|
|
</div>
|
|
|
|
{# Enhanced Mobile-First Controls Row with Better Touch Targets and Navigation #}
|
|
<nav class="flex items-center justify-between sm:justify-start gap-2 sm:gap-3" aria-label="View and sort controls">
|
|
{# Sort Controls with Mobile Optimization #}
|
|
<div class="flex-1 sm:flex-none min-w-0">
|
|
<c-sort_controls
|
|
current_sort="{{ current_ordering }}"
|
|
class="w-full sm:w-auto"
|
|
/>
|
|
</div>
|
|
|
|
{# View Toggle with Better Mobile Touch Target #}
|
|
<div class="flex-shrink-0">
|
|
<c-view_toggle
|
|
current_view="{{ view_mode }}"
|
|
class=""
|
|
/>
|
|
</div>
|
|
|
|
{# Enhanced Mobile Filter Toggle Button with Better Design #}
|
|
<button
|
|
type="button"
|
|
class="lg:hidden inline-flex items-center px-3 py-2.5 sm:px-4 sm:py-2 border border-gray-300 dark:border-gray-600 rounded-lg shadow-sm bg-white dark:bg-gray-700 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all duration-200 min-w-[44px] min-h-[44px] justify-center"
|
|
@click="showFilters = !showFilters"
|
|
:aria-expanded="showFilters"
|
|
aria-label="Toggle filters"
|
|
:class="{ 'bg-blue-50 dark:bg-blue-900/20 border-blue-300 dark:border-blue-600 text-blue-700 dark:text-blue-300': showFilters }"
|
|
>
|
|
<svg class="w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-200"
|
|
:class="{ 'rotate-180': showFilters }"
|
|
fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
|
|
</svg>
|
|
<span class="ml-1 sm:ml-2 hidden sm:inline">Filters</span>
|
|
<span class="sr-only sm:hidden" x-text="showFilters ? 'Hide filters' : 'Show filters'"></span>
|
|
</button>
|
|
</nav>
|
|
</div>
|
|
|
|
{# Enhanced Mobile-First Advanced Filters with Better Touch Interaction #}
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4"
|
|
x-show="showFilters"
|
|
x-transition:enter="transition ease-out duration-300"
|
|
x-transition:enter-start="opacity-0 transform scale-95 -translate-y-2"
|
|
x-transition:enter-end="opacity-100 transform scale-100 translate-y-0"
|
|
x-transition:leave="transition ease-in duration-200"
|
|
x-transition:leave-start="opacity-100 transform scale-100 translate-y-0"
|
|
x-transition:leave-end="opacity-0 transform scale-95 -translate-y-2">
|
|
|
|
{# Enhanced Mobile-First Status Filter #}
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
|
|
Status
|
|
</label>
|
|
<select
|
|
name="status"
|
|
class="block w-full px-3 py-3 sm:py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-base sm:text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors duration-200 min-h-[44px] appearance-none cursor-pointer"
|
|
hx-get="{% url 'parks:park_list' %}"
|
|
hx-target="#park-results"
|
|
hx-include="[name='search'], [name='view_mode'], [name='ordering'], [name='operator'], [name='park_type']"
|
|
hx-push-url="true"
|
|
hx-indicator="#search-spinner"
|
|
>
|
|
<option value="">All Statuses</option>
|
|
<option value="OPERATING" {% if request.GET.status == 'OPERATING' %}selected{% endif %}>🟢 Operating</option>
|
|
<option value="CLOSED_TEMP" {% if request.GET.status == 'CLOSED_TEMP' %}selected{% endif %}>🟡 Temporarily Closed</option>
|
|
<option value="CLOSED_PERM" {% if request.GET.status == 'CLOSED_PERM' %}selected{% endif %}>🔴 Permanently Closed</option>
|
|
<option value="UNDER_CONSTRUCTION" {% if request.GET.status == 'UNDER_CONSTRUCTION' %}selected{% endif %}>🚧 Under Construction</option>
|
|
</select>
|
|
</div>
|
|
|
|
{# Enhanced Mobile-First Operator Filter #}
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
|
|
Operator
|
|
</label>
|
|
<select
|
|
name="operator"
|
|
class="block w-full px-3 py-3 sm:py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-base sm:text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors duration-200 min-h-[44px] appearance-none cursor-pointer"
|
|
hx-get="{% url 'parks:park_list' %}"
|
|
hx-target="#park-results"
|
|
hx-include="[name='search'], [name='view_mode'], [name='ordering'], [name='status'], [name='park_type']"
|
|
hx-push-url="true"
|
|
hx-indicator="#search-spinner"
|
|
>
|
|
<option value="">All Operators</option>
|
|
{% for operator in filter_counts.top_operators %}
|
|
<option value="{{ operator.operator__id }}"
|
|
{% if request.GET.operator == operator.operator__id|stringformat:"s" %}selected{% endif %}>
|
|
{{ operator.operator__name }} ({{ operator.park_count }})
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
{# Enhanced Mobile-First Park Type Filter #}
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
|
|
Park Type
|
|
</label>
|
|
<select
|
|
name="park_type"
|
|
class="block w-full px-3 py-3 sm:py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-base sm:text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors duration-200 min-h-[44px] appearance-none cursor-pointer"
|
|
hx-get="{% url 'parks:park_list' %}"
|
|
hx-target="#park-results"
|
|
hx-include="[name='search'], [name='view_mode'], [name='ordering'], [name='status'], [name='operator']"
|
|
hx-push-url="true"
|
|
hx-indicator="#search-spinner"
|
|
>
|
|
<option value="">All Types</option>
|
|
<option value="disney" {% if request.GET.park_type == 'disney' %}selected{% endif %}>🏰 Disney Parks</option>
|
|
<option value="universal" {% if request.GET.park_type == 'universal' %}selected{% endif %}>🎬 Universal Parks</option>
|
|
<option value="six_flags" {% if request.GET.park_type == 'six_flags' %}selected{% endif %}>🎢 Six Flags</option>
|
|
<option value="cedar_fair" {% if request.GET.park_type == 'cedar_fair' %}selected{% endif %}>🌲 Cedar Fair</option>
|
|
<option value="independent" {% if request.GET.park_type == 'independent' %}selected{% endif %}>⭐ Independent</option>
|
|
</select>
|
|
</div>
|
|
|
|
{# Enhanced Mobile-First Quick Filters with Better Touch Targets #}
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
|
|
Quick Filters
|
|
</label>
|
|
<div class="space-y-3">
|
|
<label class="flex items-center p-2 -m-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer transition-colors duration-200">
|
|
<input
|
|
type="checkbox"
|
|
name="has_coasters"
|
|
value="true"
|
|
{% if request.GET.has_coasters %}checked{% endif %}
|
|
class="w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 focus:ring-offset-2 dark:bg-gray-700 dark:focus:ring-offset-gray-800 transition-colors duration-200"
|
|
hx-get="{% url 'parks:park_list' %}"
|
|
hx-target="#park-results"
|
|
hx-include="[name='search'], [name='view_mode'], [name='ordering'], [name='status'], [name='operator'], [name='park_type']"
|
|
hx-push-url="true"
|
|
hx-indicator="#search-spinner"
|
|
/>
|
|
<span class="ml-3 text-sm text-gray-700 dark:text-gray-300 select-none">
|
|
🎢 Has Roller Coasters
|
|
</span>
|
|
</label>
|
|
<label class="flex items-center p-2 -m-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer transition-colors duration-200">
|
|
<input
|
|
type="checkbox"
|
|
name="big_parks_only"
|
|
value="true"
|
|
{% if request.GET.big_parks_only %}checked{% endif %}
|
|
class="w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 focus:ring-offset-2 dark:bg-gray-700 dark:focus:ring-offset-gray-800 transition-colors duration-200"
|
|
hx-get="{% url 'parks:park_list' %}"
|
|
hx-target="#park-results"
|
|
hx-include="[name='search'], [name='view_mode'], [name='ordering'], [name='status'], [name='operator'], [name='park_type']"
|
|
hx-push-url="true"
|
|
hx-indicator="#search-spinner"
|
|
/>
|
|
<span class="ml-3 text-sm text-gray-700 dark:text-gray-300 select-none">
|
|
🏢 Major Parks (10+ rides)
|
|
</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{# Enhanced Mobile-First Active Filter Chips #}
|
|
{% if active_filters %}
|
|
<div class="border-t border-gray-200 dark:border-gray-700 pt-3 sm:pt-4">
|
|
<div class="flex items-center justify-between mb-2 sm:mb-3">
|
|
<h3 class="text-sm font-medium text-gray-700 dark:text-gray-300">
|
|
Active Filters
|
|
</h3>
|
|
<button
|
|
type="button"
|
|
@click="clearAllFilters()"
|
|
class="text-xs sm:text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium focus:outline-none focus:underline transition-colors duration-200 min-h-[44px] px-2 py-1 sm:min-h-auto sm:px-0 sm:py-0"
|
|
>
|
|
Clear All
|
|
</button>
|
|
</div>
|
|
<c-filter_chips
|
|
filters=active_filters
|
|
base_url="{% url 'parks:park_list' %}"
|
|
class="flex-wrap gap-2"
|
|
/>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
{# Enhanced Mobile-First Results Section #}
|
|
<div class="space-y-4 sm:space-y-6">
|
|
{# Enhanced Mobile-First Results Statistics #}
|
|
<c-result_stats
|
|
total_results="{{ total_results }}"
|
|
page_obj="{{ page_obj }}"
|
|
search_query="{{ search_query }}"
|
|
is_search="{{ is_search }}"
|
|
filter_count="{{ filter_count }}"
|
|
/>
|
|
|
|
{# Enhanced Mobile-First Loading Overlay #}
|
|
<div id="loading-overlay" class="htmx-indicator">
|
|
<div class="fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center p-4">
|
|
<div class="bg-white dark:bg-gray-800 rounded-xl p-4 sm:p-6 shadow-xl max-w-sm w-full">
|
|
<div class="flex flex-col items-center space-y-3 text-center">
|
|
<svg class="animate-spin h-8 w-8 sm:h-10 sm:w-10 text-blue-600 dark:text-blue-400" fill="none" viewBox="0 0 24 24">
|
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
</svg>
|
|
<div>
|
|
<div class="text-base sm:text-lg font-medium text-gray-900 dark:text-white">Loading parks...</div>
|
|
<div class="text-sm text-gray-600 dark:text-gray-400 mt-1">Please wait a moment</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{# Enhanced Mobile-First Park Results Container #}
|
|
<div id="park-results"
|
|
hx-indicator="#loading-overlay"
|
|
class="min-h-[300px] sm:min-h-[400px]">
|
|
{% include "parks/partials/park_list.html" %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- AlpineJS Component Definition (HTMX + AlpineJS Only) -->
|
|
<div x-data="{
|
|
showFilters: window.innerWidth >= 1024,
|
|
viewMode: '{{ view_mode }}',
|
|
searchQuery: '{{ search_query }}',
|
|
isLoading: false,
|
|
error: null,
|
|
clearAllFilters() {
|
|
window.location.href = '{% url \"parks:park_list\" %}';
|
|
}
|
|
}"
|
|
@htmx:before-request="isLoading = true; error = null"
|
|
@htmx:after-request="isLoading = false"
|
|
@htmx:response-error="isLoading = false; error = 'Failed to load results'"
|
|
style="display: none;">
|
|
<!-- Park list functionality handled by AlpineJS + HTMX -->
|
|
</div>
|
|
{% endblock %}
|