mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
xbvr sync
This commit is contained in:
@@ -140,6 +140,40 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Size slider -->
|
||||
<div class="flex items-center gap-2 bg-gray-100 rounded-lg px-3 py-2" x-data="{
|
||||
size: localStorage.getItem('gameCardSize') || 'medium',
|
||||
sizes: {
|
||||
small: { label: 'S', cols: 'grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6', scale: 'scale-90' },
|
||||
medium: { label: 'M', cols: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', scale: 'scale-100' },
|
||||
large: { label: 'L', cols: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3', scale: 'scale-110' },
|
||||
xlarge: { label: 'XL', cols: 'grid-cols-1 md:grid-cols-2', scale: 'scale-125' }
|
||||
},
|
||||
updateSize(newSize) {
|
||||
this.size = newSize;
|
||||
localStorage.setItem('gameCardSize', newSize);
|
||||
// Dispatch custom event to update grid
|
||||
window.dispatchEvent(new CustomEvent('gameCardSizeChanged', { detail: { sizeKey: newSize, sizeData: this.sizes[newSize] } }));
|
||||
}
|
||||
}" @mounted="updateSize(size)">
|
||||
<svg class="h-4 w-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"/>
|
||||
</svg>
|
||||
<span class="text-xs font-medium text-gray-600 hidden sm:inline mr-1">Size:</span>
|
||||
<div class="flex items-center gap-1">
|
||||
<template x-for="(sizeData, sizeKey) in sizes" :key="sizeKey">
|
||||
<button
|
||||
@click="updateSize(sizeKey)"
|
||||
:class="size === sizeKey ? 'bg-blue-600 text-white shadow-sm' : 'text-gray-600 hover:text-gray-900 hover:bg-gray-200'"
|
||||
class="px-2 py-1 text-xs font-medium rounded transition-all duration-200"
|
||||
:title="'Set card size to ' + sizeKey"
|
||||
>
|
||||
<span x-text="sizeData.label"></span>
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sort dropdown -->
|
||||
<div class="relative gap-1 bg-gray-100 rounded-lg p-1" x-data="{ open: false }">
|
||||
<button @click="open = !open" class="inline-flex items-center px-3 py-2 text-sm font-medium rounded-md transition-all duration-200 {{ view_mode == mode ? 'bg-white text-blue-600 shadow-sm' : 'text-gray-600 hover:text-gray-900 hover:bg-gray-200' }}">
|
||||
@@ -330,194 +364,213 @@
|
||||
|
||||
{% 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 or filters.features or filters.playtime %}
|
||||
{% 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 %}
|
||||
{% if filters.features %}
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 ml-2">{{ filters.features|join(', ') }}</span>
|
||||
{% endif %}
|
||||
{% if filters.playtime %}
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800 ml-2">
|
||||
{% if filters.playtime == 'none' %}No playtime{% elseif filters.playtime == 'under_1h' %}Under 1h{% elseif filters.playtime == '1h_5h' %}1-5h{% elseif filters.playtime == '5h_10h' %}5-10h{% elseif filters.playtime == '10h_20h' %}10-20h{% elseif filters.playtime == 'over_20h' %}20h+{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<div class="min-h-screen bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50">
|
||||
<div class="p-6">
|
||||
<!-- Header -->
|
||||
<div class="mb-8">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 class="text-4xl font-bold bg-gradient-to-r from-slate-900 via-blue-900 to-indigo-900 bg-clip-text text-transparent">Games Library</h1>
|
||||
{% if pagination.total_items > 0 %}
|
||||
<div class="text-slate-600 text-sm mt-2 flex items-center gap-2">
|
||||
<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="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
|
||||
</svg>
|
||||
{{ pagination.total_items }} games from {{ games|reduce((carry, game) => carry + game.platform_count, 0) }} platforms
|
||||
{% if search %}
|
||||
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
||||
<svg class="w-3 h-3 mr-1" 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>
|
||||
"{{ search }}"
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if pagination.total_items > 0 %}
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{% if filters.genres %}
|
||||
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-gradient-to-r from-blue-500 to-blue-600 text-white shadow-sm">
|
||||
<svg class="w-3 h-3 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a.997.997 0 01-1.414 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"/>
|
||||
</svg>
|
||||
{{ filters.genres|join(', ') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if filters.platforms %}
|
||||
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-gradient-to-r from-gray-500 to-gray-600 text-white shadow-sm">
|
||||
<svg class="w-3 h-3 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
{{ filters.platforms|join(', ') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if filters.features %}
|
||||
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-gradient-to-r from-green-500 to-green-600 text-white shadow-sm">
|
||||
<svg class="w-3 h-3 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
{{ filters.features|join(', ') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if filters.playtime %}
|
||||
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-gradient-to-r from-purple-500 to-purple-600 text-white shadow-sm">
|
||||
<svg class="w-3 h-3 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
{% if filters.playtime == 'none' %}No playtime{% elseif filters.playtime == 'under_1h' %}Under 1h{% elseif filters.playtime == '1h_5h' %}1-5h{% elseif filters.playtime == '5h_10h' %}5-10h{% elseif filters.playtime == '10h_20h' %}10-20h{% elseif filters.playtime == 'over_20h' %}20h+{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if games is empty %}
|
||||
<div class="text-center py-5">
|
||||
<svg class="mx-auto text-muted mb-3" 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>
|
||||
<h3 class="h5 fw-medium text-dark">
|
||||
{% if search or filters.genres or filters.platforms or filters.features or filters.playtime %}
|
||||
No games found matching your criteria
|
||||
{% else %}
|
||||
No games found
|
||||
<!-- Enhanced empty state -->
|
||||
<div class="flex flex-col items-center justify-center py-16 px-4">
|
||||
<div class="relative mb-8">
|
||||
<!-- Animated background circles -->
|
||||
<div class="absolute inset-0 flex items-center justify-center">
|
||||
<div class="w-32 h-32 bg-gradient-to-br from-blue-100 to-indigo-100 rounded-full animate-pulse"></div>
|
||||
<div class="absolute w-24 h-24 bg-gradient-to-br from-indigo-100 to-purple-100 rounded-full animate-pulse animation-delay-1000"></div>
|
||||
<div class="absolute w-16 h-16 bg-gradient-to-br from-purple-100 to-pink-100 rounded-full animate-pulse animation-delay-2000"></div>
|
||||
</div>
|
||||
|
||||
<!-- Main icon -->
|
||||
<div class="relative bg-white rounded-2xl shadow-xl p-8 border border-gray-100">
|
||||
<svg class="w-20 h-20 text-slate-400 mx-auto" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" 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>
|
||||
</div>
|
||||
|
||||
<div class="text-center max-w-md">
|
||||
<h3 class="text-2xl font-bold text-gray-900 mb-3">
|
||||
{% if search or filters.genres or filters.platforms or filters.features or filters.playtime %}
|
||||
No games found
|
||||
{% else %}
|
||||
Your library is empty
|
||||
{% endif %}
|
||||
</h3>
|
||||
|
||||
<p class="text-slate-600 text-lg mb-8 leading-relaxed">
|
||||
{% if search or filters.genres or filters.platforms or filters.features or filters.playtime %}
|
||||
We couldn't find any games matching your current search and filter criteria. Try adjusting your filters or search terms to discover more games.
|
||||
{% else %}
|
||||
Start building your gaming library by syncing with Playnite or other gaming platforms. Your games will appear here once synced.
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<div class="flex flex-col sm:flex-row gap-4 justify-center">
|
||||
{% if search or filters.genres or filters.platforms or filters.features or filters.playtime %}
|
||||
<a href="{{ path_for('games.index') }}"
|
||||
class="inline-flex items-center px-6 py-3 bg-gradient-to-r from-blue-600 to-blue-700 text-white font-semibold rounded-xl hover:from-blue-700 hover:to-blue-800 transition-all duration-200 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5">
|
||||
<svg class="w-5 h-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
||||
</svg>
|
||||
Clear Filters
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ path_for('admin.index') }}"
|
||||
class="inline-flex items-center px-6 py-3 bg-gradient-to-r from-indigo-600 to-purple-600 text-white font-semibold rounded-xl hover:from-indigo-700 hover:to-purple-700 transition-all duration-200 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5">
|
||||
<svg class="w-5 h-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
|
||||
</svg>
|
||||
Setup Sync
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<a href="{{ path_for('search.index') }}"
|
||||
class="inline-flex items-center px-6 py-3 bg-white text-gray-700 font-semibold rounded-xl border-2 border-gray-200 hover:border-gray-300 hover:bg-gray-50 transition-all duration-200 shadow-sm hover:shadow-md">
|
||||
<svg class="w-5 h-5 mr-2" 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>
|
||||
Search All Media
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Additional help text -->
|
||||
{% if not (search or filters.genres or filters.platforms or filters.features or filters.playtime) %}
|
||||
<div class="mt-8 p-4 bg-blue-50 rounded-lg border border-blue-200">
|
||||
<div class="flex items-start">
|
||||
<svg class="w-5 h-5 text-blue-600 mt-0.5 mr-3 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
<div class="text-left">
|
||||
<p class="text-sm font-medium text-blue-900 mb-1">Need help getting started?</p>
|
||||
<p class="text-sm text-blue-700">Check out the Playnite plugin documentation or contact support for assistance with syncing your gaming libraries.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</h3>
|
||||
<p class="text-muted">
|
||||
{% if search or filters.genres or filters.platforms or filters.features or filters.playtime %}
|
||||
Try adjusting your search terms or filters.
|
||||
{% else %}
|
||||
Start syncing your gaming libraries to see your games here.
|
||||
{% endif %}
|
||||
</p>
|
||||
{% if search or filters.genres or filters.platforms or filters.features or filters.playtime %}
|
||||
<a href="{{ path_for('games.index') }}" class="btn btn-primary mt-3">
|
||||
Clear filters
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<!-- Games content based on view mode -->
|
||||
{% if view_mode == 'list' %}
|
||||
<!-- List view -->
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200">
|
||||
<ul class="divide-y divide-gray-200">
|
||||
<!-- Enhanced list view using component -->
|
||||
<div class="bg-white rounded-xl shadow-lg border border-gray-100 overflow-hidden">
|
||||
<ul class="divide-y divide-gray-100">
|
||||
{% for game in games %}
|
||||
<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 mr-3" style="width: 64px; height: 64px; object-fit: cover;" src="/images/playnite/{{ game.image_url }}" alt="{{ game.title }}">
|
||||
{% else %}
|
||||
<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-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="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="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 %}
|
||||
<span>{{ game.total_playtime|format_duration }} played</span>
|
||||
{% if game.max_completion > 0 %}
|
||||
<span>{{ game.max_completion }}% complete</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if game.genres %}
|
||||
<div class="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>
|
||||
</li>
|
||||
{% include 'components/game-card.twig' with {'game': game, 'view_mode': 'list'} %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{% elseif view_mode == 'covers' %}
|
||||
<!-- Cover grid view -->
|
||||
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4">
|
||||
<!-- Enhanced cover grid view using component with dynamic sizing -->
|
||||
<div
|
||||
class="grid gap-6 transition-all duration-300"
|
||||
x-data="{
|
||||
currentSize: localStorage.getItem('gameCardSize') || 'medium',
|
||||
sizeClasses: {
|
||||
small: 'grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-8',
|
||||
medium: 'grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6',
|
||||
large: 'grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5',
|
||||
xlarge: 'grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4'
|
||||
}
|
||||
}"
|
||||
:class="sizeClasses[currentSize]"
|
||||
x-init="
|
||||
window.addEventListener('gameCardSizeChanged', (e) => {
|
||||
currentSize = e.detail.sizeKey;
|
||||
});
|
||||
// Set initial class
|
||||
$el.classList.add(...sizeClasses[currentSize].split(' '));
|
||||
"
|
||||
>
|
||||
{% for game in games %}
|
||||
<div class="bg-white rounded-lg shadow-md border border-gray-200 overflow-hidden h-full">
|
||||
{% if game.image_url %}
|
||||
<div class="relative {{ game.cover_aspect_ratio ? 'aspect-custom' : 'aspect-[3/4]' }} overflow-hidden"{% if game.cover_aspect_ratio %} style="padding-bottom: {{ (1 / game.cover_aspect_ratio) * 100 }}%;"{% endif %}>
|
||||
<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>
|
||||
{% include 'components/game-card.twig' with {'game': game, 'view_mode': 'covers'} %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<!-- Default grid view -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<!-- Enhanced grid view using component with dynamic sizing -->
|
||||
<div
|
||||
class="grid gap-6 transition-all duration-300"
|
||||
x-data="{
|
||||
currentSize: localStorage.getItem('gameCardSize') || 'medium',
|
||||
sizeClasses: {
|
||||
small: 'grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6',
|
||||
medium: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
large: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
|
||||
xlarge: 'grid-cols-1 md:grid-cols-2'
|
||||
}
|
||||
}"
|
||||
:class="sizeClasses[currentSize]"
|
||||
x-init="
|
||||
window.addEventListener('gameCardSizeChanged', (e) => {
|
||||
currentSize = e.detail.sizeKey;
|
||||
});
|
||||
// Set initial class
|
||||
$el.classList.add(...sizeClasses[currentSize].split(' '));
|
||||
"
|
||||
>
|
||||
{% for game in games %}
|
||||
<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>
|
||||
{% include 'components/game-card.twig' with {'game': game, 'view_mode': 'grid'} %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -639,6 +692,23 @@
|
||||
.select2-selection__choice__remove:hover {
|
||||
color: #f8f9fa !important;
|
||||
}
|
||||
|
||||
/* Animation delays for empty state */
|
||||
.animation-delay-1000 {
|
||||
animation-delay: 1s;
|
||||
}
|
||||
|
||||
.animation-delay-2000 {
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
/* Line clamping utilities */
|
||||
.line-clamp-2 {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user