Files
MediaCollectorLibary/resources/views/search/index.twig
Lars Behrends 929ee43001 first commit
2025-10-17 13:29:28 +02:00

111 lines
4.7 KiB
Twig

{% extends "layouts/app.twig" %}
{% block content %}
<div class="px-4 py-3">
<div class="mb-4">
<h1 class="display-4 fw-bold text-dark">Search</h1>
{% if search %}
<p class="lead text-muted">Search results for "{{ search }}"</p>
{% else %}
<p class="lead text-muted">Search across all your media collections</p>
{% endif %}
</div>
<!-- Search Form -->
<form method="GET" class="mb-4">
<div class="input-group">
<input
type="text"
name="q"
value="{{ search }}"
placeholder="Search movies, games, and more..."
class="form-control form-control-lg"
autofocus
>
<button type="submit" class="btn btn-primary">
<svg class="me-2" 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>
Search
</button>
</div>
</form>
{% if search and results %}
<!-- Search Results -->
{% if results.movies %}
<div class="mb-4">
<h2 class="h5 fw-semibold text-dark mb-3">Movies ({{ results.movies|length }})</h2>
<div class="row g-3">
{% for movie in results.movies %}
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
<div class="card h-100">
{% if movie.poster_url %}
<div style="aspect-ratio: 2/3; background-color: #f8f9fa; border-radius: 0.375rem 0.375rem 0 0; overflow: hidden;">
<img src="{{ movie.poster_url }}" alt="{{ movie.title }}" class="w-100 h-100" style="object-fit: cover;">
</div>
{% endif %}
<div class="card-body">
<h6 class="card-title text-truncate">
<a href="/media/movies/{{ movie.id }}" class="text-decoration-none">
{{ movie.title }}
</a>
</h6>
<p class="card-text small text-muted">{{ movie.source_name }}</p>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% if results.games %}
<div class="mb-4">
<h2 class="h5 fw-semibold text-dark mb-3">Games ({{ results.games|length }})</h2>
<div class="row g-3">
{% for game in results.games %}
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
<div class="card h-100">
{% if game.image_url %}
<div style="aspect-ratio: 16/9; background-color: #f8f9fa; border-radius: 0.375rem 0.375rem 0 0; overflow: hidden;">
<img src="{{ game.image_url }}" alt="{{ game.name }}" class="w-100 h-100" style="object-fit: cover;">
</div>
{% endif %}
<div class="card-body">
<h6 class="card-title text-truncate">
<a href="/media/games/{{ game.game_key }}" class="text-decoration-none">
{{ game.name }}
</a>
</h6>
<p class="card-text small text-muted">{{ game.source_name }}</p>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% if not results.movies and not results.games %}
<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="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
<h3 class="h5 fw-medium text-dark">No results found</h3>
<p class="text-muted">Try adjusting your search terms or browse categories directly.</p>
</div>
{% endif %}
{% elseif search %}
<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="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
<h3 class="h5 fw-medium text-dark">No results found</h3>
<p class="text-muted">Try adjusting your search terms or browse categories directly.</p>
</div>
{% endif %}
</div>
{% endblock %}