first commit

This commit is contained in:
Lars Behrends
2025-10-17 13:29:28 +02:00
commit 929ee43001
85 changed files with 10361 additions and 0 deletions

View File

@@ -0,0 +1,330 @@
{% extends 'layouts/app.twig' %}
{% block content %}
<div class="mb-4">
<h1 class="display-4 fw-bold text-dark">Dashboard</h1>
<p class="lead text-muted">Overview of your media collection</p>
</div>
{% if error %}
<div class="alert alert-danger mb-4">
{{ error }}
</div>
{% endif %}
<!-- Stats Grid -->
<div class="row g-3 mt-4">
<!-- Total Media -->
<div class="col-12 col-sm-6 col-lg-3">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<svg class="text-primary" width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 20h16a1 1 0 001-1V5a1 1 0 00-1-1H4a1 1 0 00-1 1v14a1 1 0 001 1z"></path>
</svg>
</div>
<div class="ms-3 flex-grow-1">
<dl>
<dt class="text-muted small fw-medium">Total Media</dt>
<dd>
<div class="h5 mb-0">{{ stats.total_media|number_format }}</div>
</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
<!-- Games -->
<div class="col-12 col-sm-6 col-lg-3">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<svg class="text-success" width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<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"></path>
</svg>
</div>
<div class="ms-3 flex-grow-1">
<dl>
<dt class="text-muted small fw-medium">Games</dt>
<dd>
<div class="h5 mb-0">{{ stats.total_games|number_format }}</div>
<div class="text-muted small">{{ stats.favorite_games }} favorites</div>
</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
<!-- Movies & TV -->
<div class="col-12 col-sm-6 col-lg-3">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<svg class="text-danger" width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 20h16a1 1 0 001-1V5a1 1 0 00-1-1H4a1 1 0 00-1 1v14a1 1 0 001 1z"></path>
</svg>
</div>
<div class="ms-3 flex-grow-1">
<dl>
<dt class="text-muted small fw-medium">Movies & TV</dt>
<dd>
<div class="h5 mb-0">
{{ (stats.total_movies + stats.total_tv_shows)|number_format }}
</div>
<div class="text-muted small">{{ stats.watched_movies }} watched</div>
</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
<!-- Music -->
<div class="col-12 col-sm-6 col-lg-3">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<svg class="text-warning" width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path>
</svg>
</div>
<div class="ms-3 flex-grow-1">
<dl>
<dt class="text-muted small fw-medium">Music</dt>
<dd>
<div class="h5 mb-0">{{ stats.total_music|number_format }}</div>
<div class="text-muted small">{{ stats.favorite_music }} favorites</div>
</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Additional Stats -->
<div class="row g-3 mt-4">
<!-- Total Playtime -->
<div class="col-12 col-md-4">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<svg class="text-info" width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<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"></path>
</svg>
</div>
<div class="ms-3 flex-grow-1">
<dl>
<dt class="text-muted small fw-medium">Total Playtime</dt>
<dd>
<div class="h5 mb-0">
{% if stats.total_playtime %}
{{ (stats.total_playtime / 60)|round }}h
{% else %}
0h
{% endif %}
</div>
</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
<!-- Total Episodes -->
<div class="col-12 col-md-4">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<svg class="text-secondary" width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"></path>
</svg>
</div>
<div class="ms-3 flex-grow-1">
<dl>
<dt class="text-muted small fw-medium">TV Episodes</dt>
<dd>
<div class="h5 mb-0">{{ stats.total_episodes|number_format }}</div>
</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
<!-- Sync Status -->
<div class="col-12 col-md-4">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<svg class="text-muted" width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<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"></path>
</svg>
</div>
<div class="ms-3 flex-grow-1">
<dl>
<dt class="text-muted small fw-medium">Sync Status</dt>
<dd>
<div class="h5 mb-0">
{% if sync_stats.successful_syncs > 0 %}
{{ sync_stats.successful_syncs }}/{{ sync_stats.total_syncs }} Success
{% else %}
No syncs yet
{% endif %}
</div>
</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Recent Activity -->
<div class="mt-4">
<h2 class="h3 fw-medium text-dark">Recent Activity</h2>
<!-- Recent Games -->
{% if recent_games %}
<div class="mt-3">
<h3 class="h5 fw-medium text-dark mb-3">Recently Played Games</h3>
<div class="card">
<ul class="list-group list-group-flush">
{% for game in recent_games %}
<li class="list-group-item">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
{% if game.image_url %}
<img class="rounded me-3" style="width: 40px; height: 40px; object-fit: cover;" src="{{ game.image_url }}" alt="">
{% else %}
<div class="bg-light rounded me-3 d-flex align-items-center justify-content-center" style="width: 40px; height: 40px;">
<svg class="text-muted" width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<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"></path>
</svg>
</div>
{% endif %}
<div>
<p class="mb-0 fw-medium">{{ game.title }}</p>
<p class="mb-0 text-muted small">{{ game.source_name }}</p>
</div>
</div>
<div class="text-muted small">
{% if game.playtime_minutes %}
{{ (game.playtime_minutes / 60)|round }}h played
{% endif %}
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
<!-- Recent Movies -->
{% if recent_movies %}
<div class="mt-3">
<h3 class="h5 fw-medium text-dark mb-3">Recently Watched Movies</h3>
<div class="card">
<ul class="list-group list-group-flush">
{% for movie in recent_movies %}
<li class="list-group-item">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
{% if movie.poster_url %}
<img class="rounded me-3" style="width: 40px; height: 40px; object-fit: cover;" src="{{ movie.poster_url }}" alt="">
{% else %}
<div class="bg-light rounded me-3 d-flex align-items-center justify-content-center" style="width: 40px; height: 40px;">
<svg class="text-muted" width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 20h16a1 1 0 001-1V5a1 1 0 00-1-1H4a1 1 0 00-1 1v14a1 1 0 001 1z"></path>
</svg>
</div>
{% endif %}
<div>
<p class="mb-0 fw-medium">{{ movie.title }}</p>
<p class="mb-0 text-muted small">{{ movie.source_name }}</p>
</div>
</div>
<div class="text-muted small">
{% if movie.watch_count %}
Watched {{ movie.watch_count }} times
{% endif %}
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
<!-- Recent Syncs -->
{% if recent_syncs %}
<div class="mt-3">
<h3 class="h5 fw-medium text-dark mb-3">Recent Sync Activities</h3>
<div class="card">
<ul class="list-group list-group-flush">
{% for sync in recent_syncs %}
<li class="list-group-item">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
{% if sync.status == 'completed' %}
<svg class="text-success" width="20" height="20" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path>
</svg>
{% elseif sync.status == 'failed' %}
<svg class="text-danger" width="20" height="20" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path>
</svg>
{% else %}
<svg class="text-warning" width="20" height="20" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M4 4a2 2 0 00-2 2v8a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2H4zm2 6a2 2 0 114 0 2 2 0 01-4 0zm8 0a2 2 0 114 0 2 2 0 01-4 0z" clip-rule="evenodd"></path>
</svg>
{% endif %}
</div>
<div class="ms-3">
<p class="mb-0 fw-medium">{{ sync.source_name }}</p>
<p class="mb-0 text-muted small">{{ sync.sync_type|title }} sync</p>
</div>
</div>
<div class="text-muted small">
{{ sync.processed_items }} items • {{ sync.created_at|date('M j, Y') }}
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% if not recent_games and not recent_movies and not recent_syncs %}
<div class="card mt-3">
<div class="card-body text-center">
<svg class="mx-auto text-muted mb-3" width="48" height="48" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<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"></path>
</svg>
<h3 class="h5 fw-medium text-dark">No recent activity</h3>
<p class="text-muted">Start adding media to see your activity here.</p>
</div>
</div>
{% endif %}
</div>
{% endblock %}