mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
dont know ?
This commit is contained in:
@@ -1,172 +1,224 @@
|
||||
{% extends "layouts/app.twig" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Sidebar with filters -->
|
||||
<div class="col-lg-3 col-xl-2">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Filters</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- Filter form -->
|
||||
<form method="GET" id="filterForm">
|
||||
<input type="hidden" name="view" value="{{ view_mode }}">
|
||||
<input type="hidden" name="per_page" value="{{ pagination.per_page }}">
|
||||
<input type="hidden" name="search" value="{{ search }}">
|
||||
{% block nav_controls %}
|
||||
<!-- Search form -->
|
||||
<form method="GET" class="flex gap-2">
|
||||
<input type="hidden" name="view" value="{{ view_mode }}">
|
||||
<input type="hidden" name="per_page" value="{{ pagination.per_page }}">
|
||||
{% for genre in filters.genres %}
|
||||
<input type="hidden" name="genres[]" value="{{ genre }}">
|
||||
{% endfor %}
|
||||
{% for platform in filters.platforms %}
|
||||
<input type="hidden" name="platforms[]" value="{{ platform }}">
|
||||
{% endfor %}
|
||||
<div class="relative">
|
||||
<input
|
||||
type="text"
|
||||
name="search"
|
||||
value="{{ search }}"
|
||||
placeholder="Search games..."
|
||||
class="pl-10 pr-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500 w-64 bg-gray-800 text-white placeholder-gray-400"
|
||||
>
|
||||
<svg class="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
|
||||
Search
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- Genre filter -->
|
||||
{% if available_filters.genres %}
|
||||
<div class="mb-4">
|
||||
<h6 class="fw-bold text-dark mb-2">Genres</h6>
|
||||
<select class="form-select select2" name="genres[]" multiple data-placeholder="Select genres...">
|
||||
{% for genre in available_filters.genres %}
|
||||
<option value="{{ genre }}" {{ genre in filters.genres ? 'selected' : '' }}>
|
||||
{{ genre }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- View mode switcher -->
|
||||
<div class="flex gap-1" role="group">
|
||||
{% for mode in view_modes %}
|
||||
<a
|
||||
href="?view={{ mode }}&sort={{ sort }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}"
|
||||
class="inline-flex items-center px-3 py-2 border border-gray-300 bg-gray-800 text-gray-300 hover:bg-gray-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 {{ view_mode == mode ? 'bg-blue-600 border-blue-500 text-white' : '' }}"
|
||||
title="{{ mode|title }} View"
|
||||
>
|
||||
{% if mode == 'grid' %}
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
{% if mode == 'list' %}
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
{% if mode == 'covers' %}
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
<span class="hidden sm:inline ml-1">{{ mode|title }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Platform filter -->
|
||||
{% if available_filters.platforms %}
|
||||
<div class="mb-4">
|
||||
<h6 class="fw-bold text-dark mb-2">Platforms</h6>
|
||||
<select class="form-select select2" name="platforms[]" multiple data-placeholder="Select platforms...">
|
||||
{% for platform in available_filters.platforms %}
|
||||
<option value="{{ platform }}" {{ platform in filters.platforms ? 'selected' : '' }}>
|
||||
{{ platform }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Filter actions -->
|
||||
<div class="d-grid gap-2">
|
||||
<button type="submit" class="btn btn-primary btn-sm">
|
||||
Apply Filters
|
||||
</button>
|
||||
<a href="{{ path_for('games.index') }}" class="btn btn-outline-secondary btn-sm">
|
||||
Clear All
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Sort dropdown -->
|
||||
<div class="relative" x-data="{ open: false }">
|
||||
<button @click="open = !open" class="inline-flex items-center px-3 py-2 border border-gray-300 rounded-md bg-gray-800 text-gray-300 hover:bg-gray-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
|
||||
<svg class="mr-1 h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4h14M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"/>
|
||||
</svg>
|
||||
<span class="hidden sm:inline">Sort</span>
|
||||
</button>
|
||||
<div x-show="open" @click.away="open = false" class="absolute right-0 z-50 mt-2 w-56 bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5">
|
||||
<div class="py-1">
|
||||
{% for key, label in sort_options %}
|
||||
<a class="flex items-center justify-between px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 {{ sort == key ? 'bg-gray-50' : '' }}"
|
||||
href="?sort={{ key }}&view={{ view_mode }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}">
|
||||
{{ label }}
|
||||
{% if sort == key %}
|
||||
<svg class="h-4 w-4 text-blue-600" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5zM10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5z"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
<!-- Main content area -->
|
||||
<div class="col-lg-9 col-xl-10">
|
||||
<div class="px-4 py-3">
|
||||
<!-- Header with search and view controls -->
|
||||
<div class="d-flex flex-column flex-sm-row justify-content-between align-items-start align-items-sm-center mb-4 gap-3">
|
||||
<div>
|
||||
<h1 class="display-4 fw-bold text-dark">Games</h1>
|
||||
{% if pagination.total_items > 0 %}
|
||||
<div class="text-muted small mt-1">
|
||||
{{ pagination.total_items }} games from {{ games|reduce((carry, game) => carry + game.platform_count, 0) }} platforms
|
||||
{% if search %}
|
||||
matching "{{ search }}"
|
||||
{% endif %}
|
||||
{% if filters.genres or filters.platforms %}
|
||||
{% if filters.genres %}
|
||||
<span class="badge bg-primary ms-1">{{ filters.genres|join(', ') }}</span>
|
||||
{% endif %}
|
||||
{% if filters.platforms %}
|
||||
<span class="badge bg-secondary ms-1">{{ filters.platforms|join(', ') }}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% block sidebar %}
|
||||
<div class="space-y-4">
|
||||
<!-- Filters -->
|
||||
<div class="bg-gray-50 rounded-lg p-4">
|
||||
<h3 class="text-sm font-medium text-gray-900 mb-4">Filters</h3>
|
||||
|
||||
<div class="d-flex flex-column flex-sm-row gap-3 w-100 w-sm-auto">
|
||||
<!-- Search form -->
|
||||
<form method="GET" class="d-flex gap-2">
|
||||
<input type="hidden" name="view" value="{{ view_mode }}">
|
||||
<input type="hidden" name="per_page" value="{{ pagination.per_page }}">
|
||||
{% for genre in filters.genres %}
|
||||
<input type="hidden" name="genres[]" value="{{ genre }}">
|
||||
{% endfor %}
|
||||
{% for platform in filters.platforms %}
|
||||
<input type="hidden" name="platforms[]" value="{{ platform }}">
|
||||
{% endfor %}
|
||||
<div class="position-relative">
|
||||
<input
|
||||
type="text"
|
||||
name="search"
|
||||
value="{{ search }}"
|
||||
placeholder="Search games..."
|
||||
class="form-control ps-5"
|
||||
>
|
||||
<svg class="position-absolute top-50 start-0 translate-middle-y ms-3 text-muted" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Search
|
||||
</button>
|
||||
</form>
|
||||
<!-- Filter form -->
|
||||
<form method="GET" id="filterForm">
|
||||
<input type="hidden" name="view" value="{{ view_mode }}">
|
||||
<input type="hidden" name="per_page" value="{{ pagination.per_page }}">
|
||||
<input type="hidden" name="search" value="{{ search }}">
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<!-- Sort dropdown -->
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="sortDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"/>
|
||||
</svg>
|
||||
<span class="d-none d-sm-inline">Sort</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="sortDropdown">
|
||||
{% for key, label in sort_options %}
|
||||
<li>
|
||||
<a class="dropdown-item d-flex justify-content-between align-items-center {{ sort == key ? 'active' : '' }}"
|
||||
href="?sort={{ key }}&view={{ view_mode }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}">
|
||||
{{ label }}
|
||||
{% if sort == key %}
|
||||
<svg width="16" height="16" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Genre filter -->
|
||||
{% if available_filters.genres %}
|
||||
<div class="mb-4">
|
||||
<label class="block text-xs font-medium text-gray-700 mb-1">Genres</label>
|
||||
<select class="select2 w-full text-sm border border-gray-300 rounded focus:ring-blue-500 focus:border-blue-500" name="genres[]" multiple data-placeholder="Select genres...">
|
||||
{% for genre in available_filters.genres %}
|
||||
<option value="{{ genre }}" {{ genre in filters.genres ? 'selected' : '' }}>
|
||||
{{ genre }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- View mode switcher -->
|
||||
<div class="btn-group" role="group">
|
||||
{% for mode in view_modes %}
|
||||
<a
|
||||
href="?view={{ mode }}&sort={{ sort }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}"
|
||||
class="btn btn-outline-secondary {{ view_mode == mode ? 'active' : '' }}"
|
||||
title="{{ mode|title }} View"
|
||||
>
|
||||
{% if mode == 'grid' %}
|
||||
<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
{% if mode == 'list' %}
|
||||
<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
{% if mode == 'covers' %}
|
||||
<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
<span class="d-none d-sm-inline ms-1">{{ mode|title }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Platform filter -->
|
||||
{% if available_filters.platforms %}
|
||||
<div class="mb-4">
|
||||
<label class="block text-xs font-medium text-gray-700 mb-1">Platforms</label>
|
||||
<select class="select2 w-full text-sm border border-gray-300 rounded focus:ring-blue-500 focus:border-blue-500" name="platforms[]" multiple data-placeholder="Select platforms...">
|
||||
{% for platform in available_filters.platforms %}
|
||||
<option value="{{ platform }}" {{ platform in filters.platforms ? 'selected' : '' }}>
|
||||
{{ platform }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Filter actions -->
|
||||
<div class="space-y-2">
|
||||
<button type="submit" class="w-full bg-blue-600 text-white px-3 py-2 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 text-sm">
|
||||
Apply Filters
|
||||
</button>
|
||||
<a href="{{ path_for('games.index') }}" class="w-full bg-gray-100 text-gray-700 px-3 py-2 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 block text-center text-sm">
|
||||
Clear All
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Active Filters Summary -->
|
||||
{% if filters.genres or filters.platforms or search %}
|
||||
<div class="bg-blue-50 rounded-lg p-4">
|
||||
<h3 class="text-sm font-medium text-gray-900 mb-3">Active Filters</h3>
|
||||
<div class="space-y-2">
|
||||
{% if search %}
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-sm text-gray-600">Search: "{{ search }}"</span>
|
||||
<a href="?{% for key, value in filters %}{% if key != 'search' %}{{ key }}={{ value }}&{% endif %}{% endfor %}" class="text-blue-600 hover:text-blue-800">
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% for genre in filters.genres %}
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-sm text-gray-600">Genre: {{ genre }}</span>
|
||||
<a href="?{% for key, value in filters %}{% if key != 'genres' or (key == 'genres' and value != genre) %}{{ key }}={{ value }}&{% endif %}{% endfor %}" class="text-blue-600 hover:text-blue-800">
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% for platform in filters.platforms %}
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-sm text-gray-600">Platform: {{ platform }}</span>
|
||||
<a href="?{% for key, value in filters %}{% if key != 'platforms' or (key == 'platforms' and value != platform) %}{{ key }}={{ value }}&{% endif %}{% endfor %}" class="text-blue-600 hover:text-blue-800">
|
||||
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Quick Stats -->
|
||||
<div class="bg-gray-50 rounded-lg p-4">
|
||||
<h3 class="text-sm font-medium text-gray-900 mb-3">Quick Stats</h3>
|
||||
<div class="space-y-2">
|
||||
<div class="flex justify-between text-sm">
|
||||
<span class="text-gray-600">Total Games</span>
|
||||
<span class="font-medium text-gray-900">{{ pagination.total_items }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm">
|
||||
<span class="text-gray-600">This Page</span>
|
||||
<span class="font-medium text-gray-900">{{ games|length }}</span>
|
||||
</div>
|
||||
{% if pagination.total_pages > 1 %}
|
||||
<div class="flex justify-between text-sm">
|
||||
<span class="text-gray-600">Page</span>
|
||||
<span class="font-medium text-gray-900">{{ pagination.current_page }} of {{ pagination.total_pages }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main content area -->
|
||||
<div class="p-6">
|
||||
<!-- Header -->
|
||||
<div class="mb-6">
|
||||
<h1 class="text-3xl font-bold text-gray-900">Games</h1>
|
||||
{% if pagination.total_items > 0 %}
|
||||
<div class="text-gray-500 text-sm mt-1">
|
||||
{{ pagination.total_items }} games from {{ games|reduce((carry, game) => carry + game.platform_count, 0) }} platforms
|
||||
{% if search %}
|
||||
matching "{{ search }}"
|
||||
{% endif %}
|
||||
{% if filters.genres or filters.platforms %}
|
||||
{% if filters.genres %}
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 ml-2">{{ filters.genres|join(', ') }}</span>
|
||||
{% endif %}
|
||||
{% if filters.platforms %}
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 ml-2">{{ filters.platforms|join(', ') }}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if games is empty %}
|
||||
<div class="text-center py-5">
|
||||
@@ -197,31 +249,31 @@
|
||||
<!-- Games content based on view mode -->
|
||||
{% if view_mode == 'list' %}
|
||||
<!-- List view -->
|
||||
<div class="card">
|
||||
<ul class="list-group list-group-flush">
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200">
|
||||
<ul class="divide-y divide-gray-200">
|
||||
{% for game in games %}
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="d-flex align-items-center">
|
||||
<li class="px-4 py-3">
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="flex items-center">
|
||||
{% if game.image_url %}
|
||||
<img class="rounded me-3" style="width: 64px; height: 64px; object-fit: cover;" src="/images/playnite/{{ game.image_url }}" alt="{{ game.title }}">
|
||||
<img class="rounded mr-3" style="width: 64px; height: 64px; object-fit: cover;" src="/images/playnite/{{ game.image_url }}" alt="{{ game.title }}">
|
||||
{% else %}
|
||||
<div class="bg-light rounded me-3 d-flex align-items-center justify-content-center" style="width: 64px; height: 64px;">
|
||||
<svg class="text-muted" width="32" height="32" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<div class="bg-gray-100 rounded mr-3 flex items-center justify-center" style="width: 64px; height: 64px;">
|
||||
<svg class="text-gray-600" width="32" height="32" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-7 8h12a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="flex-grow-1">
|
||||
<h3 class="h6 mb-1">
|
||||
<a href="{{ path_for('games.show', {'game_key': game.game_key}) }}" class="text-decoration-none">
|
||||
<div class="flex-1">
|
||||
<h3 class="text-sm font-semibold mb-1">
|
||||
<a href="{{ path_for('games.show', {'game_key': game.game_key}) }}" class="no-underline text-gray-900 hover:text-blue-600">
|
||||
{{ game.title }}
|
||||
</a>
|
||||
</h3>
|
||||
<div class="d-flex align-items-center gap-3 small text-muted">
|
||||
<div class="flex items-center gap-3 text-sm text-gray-600">
|
||||
<span>{{ game.platform_count }} platform{{ game.platform_count > 1 ? 's' : '' }}</span>
|
||||
{% if game.platforms %}
|
||||
<span class="badge bg-light text-dark">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
|
||||
{{ game.platforms|join(', ') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
@@ -233,9 +285,9 @@
|
||||
</div>
|
||||
</div>
|
||||
{% if game.genres %}
|
||||
<div class="d-flex flex-wrap gap-1">
|
||||
<div class="flex flex-wrap gap-1">
|
||||
{% for genre in game.genres|slice(0, 3) %}
|
||||
<span class="badge bg-primary">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
||||
{{ genre }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
@@ -249,27 +301,25 @@
|
||||
|
||||
{% elseif view_mode == 'covers' %}
|
||||
<!-- Cover grid view -->
|
||||
<div class="row g-3">
|
||||
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4">
|
||||
{% for game in games %}
|
||||
<div class="col-6 col-sm-4 col-md-3 col-lg-1">
|
||||
<div class="card h-100">
|
||||
{% if game.image_url %}
|
||||
<div class="position-relative" style="aspect-ratio: 3/4; overflow: hidden;">
|
||||
<img src="/images/playnite/{{ game.image_url }}" alt="{{ game.title }}" class="card-img-top" style="width: 100%; height: 100%; object-fit: cover;">
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="d-flex align-items-center justify-content-center bg-light" style="aspect-ratio: 3/4; min-height: 200px;">
|
||||
<svg class="text-muted" width="48" height="48" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-7 8h12a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card-body">
|
||||
<h6 class="card-title text-truncate" title="{{ game.title }}">
|
||||
{{ game.title }}
|
||||
</h6>
|
||||
<p class="card-text small text-muted">{{ game.platform_count }} platform{{ game.platform_count > 1 ? 's' : '' }}</p>
|
||||
</div>
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200 overflow-hidden h-full">
|
||||
{% if game.image_url %}
|
||||
<div class="relative aspect-[3/4] overflow-hidden">
|
||||
<img src="/images/playnite/{{ game.image_url }}" alt="{{ game.title }}" class="w-full h-full object-cover">
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="flex items-center justify-center bg-gray-100 aspect-[3/4] min-h-[200px]">
|
||||
<svg class="text-gray-600" width="48" height="48" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-7 8h12a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="p-3">
|
||||
<h6 class="text-sm font-semibold truncate" title="{{ game.title }}">
|
||||
{{ game.title }}
|
||||
</h6>
|
||||
<p class="text-xs text-gray-600 mt-1">{{ game.platform_count }} platform{{ game.platform_count > 1 ? 's' : '' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
@@ -277,56 +327,54 @@
|
||||
|
||||
{% else %}
|
||||
<!-- Default grid view -->
|
||||
<div class="row g-3">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{% for game in games %}
|
||||
<div class="col-12 col-md-6 col-lg-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="flex-shrink-0">
|
||||
{% if game.image_url %}
|
||||
<img class="rounded" style="width: 64px; height: 64px; object-fit: cover;" src="/images/playnite/{{ game.image_url }}" alt="{{ game.title }}">
|
||||
{% else %}
|
||||
<div class="bg-light rounded d-flex align-items-center justify-content-center" style="width: 64px; height: 64px;">
|
||||
<svg class="text-muted" width="32" height="32" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-7 8h12a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="ms-3 flex-grow-1">
|
||||
<h5 class="card-title mb-1">
|
||||
<a href="{{ path_for('games.show', {'game_key': game.game_key}) }}" class="text-decoration-none">
|
||||
{{ game.title }}
|
||||
</a>
|
||||
</h5>
|
||||
<p class="card-text small text-muted mb-2">
|
||||
{{ game.platform_count }} platform{{ game.platform_count > 1 ? 's' : '' }}
|
||||
{% if game.platforms %}
|
||||
<span class="badge bg-light text-dark ms-2">
|
||||
{{ game.platforms|join(', ') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<div class="d-flex justify-content-between align-items-center small text-muted">
|
||||
<span>{{ game.total_playtime|format_duration }} played</span>
|
||||
{% if game.max_completion > 0 %}
|
||||
<span>{{ game.max_completion }}% complete</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if game.genres %}
|
||||
<div class="mt-2 d-flex flex-wrap gap-1">
|
||||
{% for genre in game.genres|slice(0, 3) %}
|
||||
<span class="badge bg-primary">
|
||||
{{ genre }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200 h-full">
|
||||
<div class="p-4">
|
||||
<div class="flex items-center">
|
||||
<div class="flex-shrink-0">
|
||||
{% if game.image_url %}
|
||||
<img class="rounded" style="width: 64px; height: 64px; object-fit: cover;" src="/images/playnite/{{ game.image_url }}" alt="{{ game.title }}">
|
||||
{% else %}
|
||||
<div class="bg-gray-100 rounded flex items-center justify-center" style="width: 64px; height: 64px;">
|
||||
<svg class="text-gray-600" width="32" height="32" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-7 8h12a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="ml-3 flex-1">
|
||||
<h5 class="text-lg font-semibold mb-1">
|
||||
<a href="{{ path_for('games.show', {'game_key': game.game_key}) }}" class="no-underline text-gray-900 hover:text-blue-600">
|
||||
{{ game.title }}
|
||||
</a>
|
||||
</h5>
|
||||
<p class="text-sm text-gray-600 mb-2">
|
||||
{{ game.platform_count }} platform{{ game.platform_count > 1 ? 's' : '' }}
|
||||
{% if game.platforms %}
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 ml-2">
|
||||
{{ game.platforms|join(', ') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<div class="flex justify-between items-center text-sm text-gray-600">
|
||||
<span>{{ game.total_playtime|format_duration }} played</span>
|
||||
{% if game.max_completion > 0 %}
|
||||
<span>{{ game.max_completion }}% complete</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if game.genres %}
|
||||
<div class="mt-2 flex flex-wrap gap-1">
|
||||
{% for genre in game.genres|slice(0, 3) %}
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
||||
{{ genre }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -334,42 +382,89 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Pagination -->
|
||||
<!-- Top Pagination & Controls -->
|
||||
{% if pagination.total_pages > 1 %}
|
||||
<div class="d-flex align-items-center justify-content-between mt-4">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<label for="per_page" class="form-label mb-0">Show:</label>
|
||||
<select id="per_page" class="form-select form-select-sm w-auto">
|
||||
<option value="12" {{ pagination.per_page == 12 ? 'selected' : '' }}>12</option>
|
||||
<option value="24" {{ pagination.per_page == 24 ? 'selected' : '' }}>24</option>
|
||||
<option value="48" {{ pagination.per_page == 48 ? 'selected' : '' }}>48</option>
|
||||
<option value="100" {{ pagination.per_page == 100 ? 'selected' : '' }}>100</option>
|
||||
</select>
|
||||
<span class="text-muted small">per page</span>
|
||||
<div class="flex items-center justify-between mb-6 p-4 bg-gray-50 rounded-lg">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="text-sm text-gray-700">
|
||||
Showing {{ (pagination.current_page - 1) * pagination.per_page + 1 }} to {{ min(pagination.current_page * pagination.per_page, pagination.total_items) }} of {{ pagination.total_items }} games
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="per_page_top" class="text-sm font-medium text-gray-700">Show:</label>
|
||||
<select id="per_page_top" class="text-sm border border-gray-300 rounded px-2 py-1 focus:ring-blue-500 focus:border-blue-500">
|
||||
<option value="12" {{ pagination.per_page == 12 ? 'selected' : '' }}>12</option>
|
||||
<option value="24" {{ pagination.per_page == 24 ? 'selected' : '' }}>24</option>
|
||||
<option value="48" {{ pagination.per_page == 48 ? 'selected' : '' }}>48</option>
|
||||
<option value="100" {{ pagination.per_page == 100 ? 'selected' : '' }}>100</option>
|
||||
</select>
|
||||
<span class="text-sm text-gray-600">per page</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<div class="flex items-center space-x-2">
|
||||
<!-- Previous Button -->
|
||||
{% if pagination.has_prev %}
|
||||
<a href="?page={{ pagination.prev_page }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}"
|
||||
class="btn btn-outline-secondary btn-sm">
|
||||
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors flex items-center">
|
||||
<svg class="w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
|
||||
</svg>
|
||||
Previous
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="px-3 py-2 text-sm font-medium text-gray-300 bg-gray-100 border border-gray-200 rounded-lg cursor-not-allowed flex items-center">
|
||||
<svg class="w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
|
||||
</svg>
|
||||
Previous
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
<div class="btn-group" role="group">
|
||||
{% for page_num in range(max(1, pagination.current_page - 2), min(pagination.total_pages, pagination.current_page + 2)) %}
|
||||
<a href="?page={{ page_num }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}"
|
||||
class="btn btn-sm {{ page_num == pagination.current_page ? 'btn-primary' : 'btn-outline-secondary' }}">
|
||||
{{ page_num }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- Page Numbers -->
|
||||
{% set start_page = max(1, pagination.current_page - 2) %}
|
||||
{% set end_page = min(pagination.total_pages, pagination.current_page + 2) %}
|
||||
|
||||
{% if start_page > 1 %}
|
||||
<a href="?page=1{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}"
|
||||
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors">1</a>
|
||||
{% if start_page > 2 %}
|
||||
<span class="px-2 py-2 text-sm font-medium text-gray-500">...</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% for page_num in start_page..end_page %}
|
||||
{% if page_num == pagination.current_page %}
|
||||
<span class="px-3 py-2 text-sm font-medium text-white bg-blue-600 border border-blue-600 rounded-lg">{{ page_num }}</span>
|
||||
{% else %}
|
||||
<a href="?page={{ page_num }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}"
|
||||
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors">{{ page_num }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if end_page < pagination.total_pages %}
|
||||
{% if end_page < pagination.total_pages - 1 %}
|
||||
<span class="px-2 py-2 text-sm font-medium text-gray-500">...</span>
|
||||
{% endif %}
|
||||
<a href="?page={{ pagination.total_pages }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}"
|
||||
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors">{{ pagination.total_pages }}</a>
|
||||
{% endif %}
|
||||
|
||||
<!-- Next Button -->
|
||||
{% if pagination.has_next %}
|
||||
<a href="?page={{ pagination.next_page }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for platform in filters.platforms %}&platforms[]={{ platform }}{% endfor %}"
|
||||
class="btn btn-outline-secondary btn-sm">
|
||||
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors flex items-center">
|
||||
Next
|
||||
<svg class="w-4 h-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
|
||||
</svg>
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="px-3 py-2 text-sm font-medium text-gray-300 bg-gray-100 border border-gray-200 rounded-lg cursor-not-allowed flex items-center">
|
||||
Next
|
||||
<svg class="w-4 h-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
|
||||
</svg>
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -429,6 +524,13 @@ document.getElementById('per_page')?.addEventListener('change', function() {
|
||||
url.searchParams.set('page', '1'); // Reset to first page
|
||||
window.location = url.toString();
|
||||
});
|
||||
|
||||
document.getElementById('per_page_top')?.addEventListener('change', function() {
|
||||
const url = new URL(window.location);
|
||||
url.searchParams.set('per_page', this.value);
|
||||
url.searchParams.set('page', '1'); // Reset to first page
|
||||
window.location = url.toString();
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user