mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-14 08:06:47 +02:00
213 lines
11 KiB
Twig
213 lines
11 KiB
Twig
{% extends "layouts/app.twig" %}
|
|
|
|
{% block content %}
|
|
<div class="px-4 py-6 sm:px-0">
|
|
<!-- Game Header -->
|
|
<div class="bg-white shadow rounded-lg mb-6">
|
|
<div class="px-6 py-4 border-b border-gray-200">
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex items-center">
|
|
{% if main_game.image_url %}
|
|
<img class="h-16 w-16 rounded-lg object-cover mr-4" src="images/playnite/{{ main_game.image_url }}" alt="{{ main_game.title }}">
|
|
{% else %}
|
|
<div class="h-16 w-16 rounded-lg bg-gray-200 flex items-center justify-center mr-4">
|
|
<svg class="h-8 w-8 text-gray-400" 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>
|
|
<h1 class="text-2xl font-bold text-gray-900">{{ main_game.title }}</h1>
|
|
<div class="flex items-center space-x-4 mt-1">
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
|
{{ platform_versions|length }} platform{{ platform_versions|length > 1 ? 's' : '' }}
|
|
</span>
|
|
{% if main_game.genre %}
|
|
<span class="text-sm text-gray-500">{{ main_game.genre }}</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<a href="{{ path_for('games.index') }}" class="text-indigo-600 hover:text-indigo-900 text-sm font-medium">
|
|
← Back to Games
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Platform Tabs -->
|
|
<div class="bg-white shadow rounded-lg">
|
|
<div class="border-b border-gray-200">
|
|
<nav class="-mb-px flex space-x-8 px-6" aria-label="Tabs">
|
|
{% for version in platform_versions %}
|
|
<button
|
|
class="platform-tab whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm {{ loop.first ? 'border-indigo-500 text-indigo-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300' }}"
|
|
data-platform="{{ version.platform }}"
|
|
data-source="{{ version.source_id }}"
|
|
>
|
|
{{ version.platform }}
|
|
{% if version.source_name %}
|
|
<span class="ml-1 text-xs text-gray-400">({{ version.source_name }})</span>
|
|
{% endif %}
|
|
</button>
|
|
{% endfor %}
|
|
</nav>
|
|
</div>
|
|
|
|
<!-- Platform Content -->
|
|
{% for version in platform_versions %}
|
|
<div class="platform-content {{ loop.first ? '' : 'hidden' }}" data-platform="{{ version.platform }}" data-source="{{ version.source_id }}">
|
|
<div class="px-6 py-6">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<!-- Game Info -->
|
|
<div>
|
|
<h3 class="text-lg font-medium text-gray-900 mb-4">Game Information</h3>
|
|
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
|
|
{% if version.developer %}
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Developer</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ version.developer }}</dd>
|
|
</div>
|
|
{% endif %}
|
|
{% if version.publisher %}
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Publisher</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ version.publisher }}</dd>
|
|
</div>
|
|
{% endif %}
|
|
{% if version.release_date %}
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Release Date</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ version.release_date|date('M j, Y') }}</dd>
|
|
</div>
|
|
{% endif %}
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Playtime</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ version.playtime_minutes|format_duration }}</dd>
|
|
</div>
|
|
{% if version.rating %}
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Rating</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ version.rating }}/10</dd>
|
|
</div>
|
|
{% endif %}
|
|
{% if version.completion_percentage > 0 %}
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Completion</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ version.completion_percentage }}%</dd>
|
|
</div>
|
|
{% endif %}
|
|
</dl>
|
|
</div>
|
|
|
|
<!-- Platform Stats -->
|
|
<div>
|
|
<h3 class="text-lg font-medium text-gray-900 mb-4">Platform Statistics</h3>
|
|
<dl class="grid grid-cols-1 gap-x-4 gap-y-4">
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Source</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ version.source_name }}</dd>
|
|
</div>
|
|
{% if version.last_played_at %}
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Last Played</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ version.last_played_at|date('M j, Y') }}</dd>
|
|
</div>
|
|
{% endif %}
|
|
{% if version.is_installed %}
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Status</dt>
|
|
<dd class="mt-1">
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
|
Installed
|
|
</span>
|
|
</dd>
|
|
</div>
|
|
{% endif %}
|
|
{% if version.is_favorite %}
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">Favorite</dt>
|
|
<dd class="mt-1">
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
|
|
Yes
|
|
</span>
|
|
</dd>
|
|
</div>
|
|
{% endif %}
|
|
</dl>
|
|
|
|
<!-- Platform-specific metadata -->
|
|
{% set metadata = version.metadata|json_decode %}
|
|
{% if metadata %}
|
|
<div class="mt-6">
|
|
<h4 class="text-sm font-medium text-gray-900 mb-2">Platform Details</h4>
|
|
<div class="bg-gray-50 rounded-md p-3">
|
|
<dl class="grid grid-cols-1 gap-x-4 gap-y-2 text-sm">
|
|
{% if metadata.appid %}
|
|
<div>
|
|
<dt class="font-medium text-gray-500">App ID</dt>
|
|
<dd class="text-gray-900">{{ metadata.appid }}</dd>
|
|
</div>
|
|
{% endif %}
|
|
{% if metadata.playtime_windows or metadata.playtime_mac or metadata.playtime_linux %}
|
|
<div>
|
|
<dt class="font-medium text-gray-500">Platform Playtime</dt>
|
|
<dd class="text-gray-900">
|
|
{% if metadata.playtime_windows %}<span>Windows: {{ metadata.playtime_windows|format_duration }}</span>{% endif %}
|
|
{% if metadata.playtime_mac %}<span class="ml-2">Mac: {{ metadata.playtime_mac|format_duration }}</span>{% endif %}
|
|
{% if metadata.playtime_linux %}<span class="ml-2">Linux: {{ metadata.playtime_linux|format_duration }}</span>{% endif %}
|
|
</dd>
|
|
</div>
|
|
{% endif %}
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
{% if version.description %}
|
|
<div class="mt-6">
|
|
<h3 class="text-lg font-medium text-gray-900 mb-2">Description</h3>
|
|
<p class="text-sm text-gray-600">{{ version.description }}</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Platform tab switching functionality
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const tabs = document.querySelectorAll('.platform-tab');
|
|
const contents = document.querySelectorAll('.platform-content');
|
|
|
|
tabs.forEach(tab => {
|
|
tab.addEventListener('click', function() {
|
|
const platform = this.dataset.platform;
|
|
const source = this.dataset.source;
|
|
|
|
// Update tab styles
|
|
tabs.forEach(t => {
|
|
t.classList.remove('border-indigo-500', 'text-indigo-600');
|
|
t.classList.add('border-transparent', 'text-gray-500');
|
|
});
|
|
this.classList.remove('border-transparent', 'text-gray-500');
|
|
this.classList.add('border-indigo-500', 'text-indigo-600');
|
|
|
|
// Update content visibility
|
|
contents.forEach(content => {
|
|
if (content.dataset.platform === platform && content.dataset.source === source) {
|
|
content.classList.remove('hidden');
|
|
} else {
|
|
content.classList.add('hidden');
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|