Session editor and live sessions!

This commit is contained in:
marc
2025-03-21 19:42:43 +01:00
parent 6c83d11e5b
commit ac54453b7f
54 changed files with 1247 additions and 173 deletions

View File

@@ -606,11 +606,20 @@ video {
margin: 1.5rem;
}
.m-8 {
margin: 2rem;
}
.mx-1 {
margin-left: 0.25rem;
margin-right: 0.25rem;
}
.mx-12 {
margin-left: 3rem;
margin-right: 3rem;
}
.mx-2 {
margin-left: 0.5rem;
margin-right: 0.5rem;
@@ -661,6 +670,14 @@ video {
margin-top: 0.75rem;
}
.mt-4 {
margin-top: 1rem;
}
.mt-8 {
margin-top: 2rem;
}
.inline-block {
display: inline-block;
}
@@ -936,14 +953,14 @@ video {
padding-bottom: 0.5rem;
}
.pl-10 {
padding-left: 2.5rem;
}
.pl-5 {
padding-left: 1.25rem;
}
.pt-4 {
padding-top: 1rem;
}
.text-left {
text-align: left;
}
@@ -994,6 +1011,11 @@ video {
color: rgb(178 124 9 / var(--tw-text-opacity, 1));
}
.text-brown {
--tw-text-opacity: 1;
color: rgb(62 56 52 / var(--tw-text-opacity, 1));
}
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity, 1));

View File

@@ -1,5 +1,8 @@
<div class="h-4/5 min-h-[400px] flex flex-col items-center justify-center">
<img src = "{{ url_for('static', path='img/folkugat.svg') }}" class="{% if animate %} opacity-0 animate-fade-in-one {% endif %} m-3" width="100" alt="Folkugat"/>
<img src="{{ url_for('static', path='img/folkugat.svg') }}"
class="{% if animate %} opacity-0 animate-fade-in-one {% endif %} m-3"
width="100"
alt="Folkugat"/>
<h1 class="text-3xl sm:text-8xl text-beige m-3 {% if animate %} opacity-0 animate-fade-in-one {% endif %}">{{ page_title }}</h1>
<h2 class="text-center sm:text-3xl m-6 {% if animate %} opacity-0 animate-fade-in-two {% endif %}">Sessions de folk a Sant Cugat</h2>
</div>

View File

@@ -1,6 +1,9 @@
{% if session %}
<div class="bg-beige text-white mt-2 py-2 text-xl overflow-hidden">
{% if current_set is not none %}
<a href="/live">
{% else %}
<a href="/sessio/{{ session.id }}">
{% endif %}
<div class="animate-marquee whitespace-nowrap">
{% for _ in (1, 2, 3) %}
<span class="inline-block mx-4">
@@ -9,14 +12,25 @@
<span class="inline-block mx-4">
</span>
<span class="inline-block mx-4">
Està sonant <i>Pasdoble de Muntanya</i>
</span>
<span class="inline-block mx-4">
</span>
{% if current_set is not none %}
<span class="inline-block mx-4">
Estem tocant
{% for tema_in_set in current_set.temes %}
{% if loop.index != 1 %}
+
{% endif %}
{% if tema_in_set.tema is not none %}
<i>{{ tema_in_set.tema.title }}</i>
{% else %}
<i> ??? </i>
{% endif %}
{% endfor %}
</span>
<span class="inline-block mx-4">
</span>
{% endif %}
{% endfor %}
</div>
</a>
</div>
{% endif %}

View File

@@ -0,0 +1,2 @@
{% include "fragments/menu.html" %}
{% include "fragments/sessio/live/set_page.html" %}

View File

@@ -0,0 +1,5 @@
<div hx-get="/api/content/live/set"
hx-trigger="every 20s"
hx-swap="outerHTML">
{% include "fragments/sessio/set/set_page.html" %}
</div>"

View File

@@ -1,5 +1,5 @@
<button title="Inicia una sessió"
class="text-beige mx-1"
class="text-beige m-2"
hx-put="/api/sessio/{{ session.id }}/live"
hx-swap="outerHTML">
<i class="fa fa-play" aria-hidden="true"></i>

View File

@@ -1,5 +1,5 @@
<button title="Atura una sessió"
class="text-beige mx-1"
class="text-beige m-2"
hx-delete="/api/sessio/{{ session.id }}/live"
hx-swap="outerHTML">
<i class="fa fa-stop" aria-hidden="true"></i>

View File

@@ -1,19 +1,19 @@
{% include "fragments/menu.html" %}
<div class="flex justify-center">
<div class="m-12 grow max-w-4xl text-center">
<h3 class="text-3xl p-4">
<div class="m-12 grow max-w-4xl">
<h3 class="text-center text-3xl p-4">
{% set dn = date_names(session.date) %}
{{ dn.day_name }} {{ dn.day }} {{ dn.month_name }} de {{ dn.year }}
{% if logged_in %}
{% if session.is_live %}
{% include "fragments/sessio/live/stop.html" %}
{% else %}
{% include "fragments/sessio/live/start.html" %}
{% endif %}
{% endif %}
</h3>
{% if logged_in %}
{% if session.is_live %}
{% include "fragments/sessions/live/stop.html" %}
{% else %}
{% include "fragments/sessions/live/start.html" %}
{% endif %}
{% endif %}
<div class="text-left">
<h4 class="text-xl text-beige">Horari i lloc</h4>
<h4 class="pt-4 text-xl text-beige">Horari i lloc</h4>
De {{ session.start_time.strftime("%H:%M") }}
a {{ session.end_time.strftime("%H:%M") }}
{% if session.venue.name %}
@@ -29,5 +29,11 @@
{% endif %}
{% endif %}
</div>
{% if logged_in or playlist.sets %}
<div class="text-left">
<h4 class="pt-4 text-xl text-beige mt-2">Temes tocats</h4>
{% include "fragments/sessio/playlist.html" %}
</div>
{% endif %}
</div>
</div>

View File

@@ -0,0 +1,17 @@
<ul id="playlist-{{ session.id }}" class="">
{% for set_entry in playlist.sets %}
{% set set_id = set_entry.id %}
{% include "fragments/sessio/set_entry.html" %}
{% endfor %}
</ul>
{% if logged_in %}
<div class="flex flex-col items-center">
<button class="text-beige mt-2"
hx-post="/api/sessio/{{ session.id }}/set"
hx-target="#playlist-{{ session.id }}"
hx-swap="beforeend transition:true">
<i class="fa fa-plus" aria-hidden="true"></i>
Afegeix set
</button>
</div>
{% endif %}

View File

@@ -0,0 +1,2 @@
{% include "fragments/menu.html" %}
{% include "fragments/sessio/set/set_page.html" %}

View File

@@ -0,0 +1,30 @@
{% if session is not none %}
<div class="text-beige m-3">
{% set dn = date_names(session.date) %}
<a href="/sessio/{{ session.id }}">
<i class="fa fa-chevron-left px-2" aria-hidden="true"></i>
<i>
Tocat el {{ dn.day_name }} {{ dn.day }} {{ dn.month_name }} de {{ dn.year }}
</i>
</a>
</div>
{% endif %}
{% for tema_in_set in set.temes %}
{% if loop.index != 1 %}
<div class="mx-12">
<hr class="h-px mt-1 mb-3 bg-beige border-0">
</div>
{% endif %}
{% if tema_in_set.tema is not none %}
{% set tema = tema_in_set.tema %}
{% include "fragments/sessio/set/tema.html"%}
{% else %}
<h3 class="text-center text-3xl p-4">
<i>Desconegut</i>
</h3>
<div class="text-center">
<i>No sabem quin tema és aquest</i>
</div>
{% endif %}
<div class="m-8"> </div>
{% endfor %}

View File

@@ -0,0 +1,25 @@
<h3 class="text-center text-3xl p-4">
{{ tema.title }}
<a class="text-beige"
º href="/tema/{{ tema.id }}">
<i class="fa fa-chevron-right px-2" aria-hidden="true"></i>
</a>
</h3>
<div class="mx-12 text-left">
{% if tema.score() is not none %}
{% include "fragments/tema/score.html" %}
{% endif %}
{% if tema.lyrics %}
{% set lyric = tema.lyrics[0] %}
<div>
<h4 class="mt-4 text-xl text-beige">Lletra</h4>
<hr class="h-px mt-1 mb-3 bg-beige border-0">
<div class="text-center">
{{ lyric.content.replace('\n', '<br>') | safe }}
</div>
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,46 @@
<li class="flex flex-row grow items-center
border border-beige rounded
px-2 py-1 my-1"
id="set-entry-{{ set_id }}"
hx-get="/api/sessio/{{ session_id }}/set/{{ set_id }}"
hx-target="#set-entry-{{ set_id }}"
hx-swap="outerHTML"
hx-trigger="reload-set-{{ set_id }}">
<div class="flex-1 flex flex-col items-center">
{% if logged_in %}
<button class="text-beige mt-2"
hx-delete="/api/sessio/{{ session_id }}/set/{{ set_id }}"
hx-target="#set-entry-{{ set_id }}"
hx-swap="outerHTML">
<i class="fa fa-times" aria-hidden="true"></i>
Esborra el set
</button>
{% endif %}
<ol id="set-entry-{{ set_id }}-list"
class="flex flex-col items-center">
{% for tema_entry in set_entry.temes %}
{% if new_entry %}
{% include "fragments/sessio/tema_editor.html" %}
{% else %}
{% include "fragments/sessio/tema_entry.html" %}
{% endif %}
{% endfor %}
</ol>
{% if logged_in %}
<button class="text-beige mt-2"
hx-post="/api/sessio/{{ session_id }}/set/{{ set_id }}"
hx-target="#set-entry-{{ set_id }}-list"
hx-swap="beforeend transition:true">
<i class="fa fa-plus" aria-hidden="true"></i>
Afegeix un tema
</button>
{% endif %}
</div>
<div class="ml-auto">
<a title="Mostra els temes"
class="text-beige"
href="/sessio/{{ session_id }}/set/{{ set_id }}">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</a>
</div>
</li>

View File

@@ -0,0 +1,30 @@
<li id="tune-entry-{{ tema_entry.id }}"
class="flex flex-col items-center my-1">
<div class="flex flex-row">
<input
name="query"
{% if tema_entry.tema %}
value="{{ tema_entry.tema.title }}"
{% else %}
value=""
{% endif %}
placeholder="Busca un tema..."
class="border border-beige focus:outline-none
rounded text-center
bg-brown p-1 m-1"
hx-get="/api/sessio/{{ session_id }}/set/{{ set_id }}/tema/{{ tema_entry.id }}/busca"
hx-trigger="revealed, keyup delay:500ms changed"
hx-target="#tune-entry-{{ tema_entry.id }}-search-results"
hx-swap="outerHTML"/>
<button title="Descarta els canvis"
class="text-beige mx-1"
hx-get="/api/sessio/{{ session_id }}/set/{{ set_id }}/tema/{{ tema_entry.id }}"
hx-target="#tune-entry-{{ tema_entry.id }}"
hx-swap="outerHTML">
<i class="fa fa-times" aria-hidden="true"></i>
</button>
</div>
<ul id="tune-entry-{{ tema_entry.id }}-search-results"
class="flex flex-wrap">
</ul>
</li>

View File

@@ -0,0 +1,29 @@
<li id="tune-entry-{{ tema_entry.id }}"
class="flex flex-row my-1">
<div class="mx-1 text-center">
{% if tema_entry.tema is none %}
<i class="fa fa-question" aria-hidden="true"></i>
<i>(Desconegut)</i>
{% else %}
<a href="/sessio/{{ session_id }}/set/{{ set_id }}">
{{ tema_entry.tema.title }}
</a>
{% endif %}
</div>
{% if logged_in %}
<button title="Edita el tema"
class="text-beige mx-1"
hx-get="/api/sessio/{{ session_id }}/set/{{ set_id }}/tema/{{ tema_entry.id }}/editor"
hx-target="#tune-entry-{{ tema_entry.id }}"
hx-swap="outerHTML">
<i class="fa fa-pencil" aria-hidden="true"></i>
</button>
<button title="Esborra el tema"
class="text-beige mx-1"
hx-delete="/api/sessio/{{ session_id }}/set/{{ set_id }}/tema/{{ tema_entry.id }}"
hx-target="#tune-entry-{{ tema_entry.id }}"
hx-swap="outerHTML">
<i class="fa fa-times" aria-hidden="true"></i>
</button>
{% endif %}
</li>

View File

@@ -0,0 +1,36 @@
<ul id="tune-entry-{{ entry_id }}-search-results"
class="flex flex-wrap items-center justify-center">
{% for tema in results %}
<li>
<button class="bg-beige text-brown rounded
m-1 px-2"
hx-put="/api/sessio/{{ session_id }}/set/{{ set_id }}/tema/{{ entry_id }}"
hx-vals='{"tema_id": "{{ tema.id }}"}'
hx-target="#tune-entry-{{ entry_id }}"
hx-swap="outerHTML">
{{ tema.title }}
</button>
</li>
{% endfor %}
<li>
<button class="border border-beige text-beige rounded
m-1 px-2"
hx-put="/api/sessio/{{ session_id }}/set/{{ set_id }}/tema/{{ entry_id }}/unknown"
hx-target="#tune-entry-{{ entry_id }}"
hx-swap="outerHTML">
<i class="fa fa-question" aria-hidden="true"></i>
<i>(Desconegut)</i>
</button>
</li>
<li>
<button class="border border-beige text-beige rounded
m-1 px-2"
hx-post="/api/sessio/{{ session_id }}/set/{{ set_id }}/tema/{{ entry_id }}"
hx-vals='{"title": "{{ query }}"}'
hx-target="#tune-entry-{{ entry_id }}"
hx-swap="outerHTML">
<i class="fa fa-plus" aria-hidden="true"></i>
<i>{{ query }}</i>
</button>
</li>
</ul>

View File

@@ -1,24 +1,11 @@
<p>
{% if session == None %}
<a> L'últim Dimecres de cada mes </a>
{% else %}
<a>
{% set dn = date_names(session.date) %}
{{ dn.day_name }} {{ dn.day }} {{ dn.month_name }}
</a>
de {{ session.start_time.strftime("%H:%M") }}
a {{ session.end_time.strftime("%H:%M") }}
{% if session.venue.name %}
a {{ session.venue.name }}
<!-- {% if session.venue.url %} -->
<!-- <a href="{{ session.venue.url }}" -->
<!-- class="text-beige" -->
<!-- target="_blank"> -->
<!-- {{ session.venue.name }} -->
<!-- </a> -->
<!-- {% else %} -->
<!-- {{ session.venue.name }} -->
<!-- {% endif %} -->
{% endif %}
{% if session == None %}
L'últim Dimecres de cada mes
{% else %}
{% set dn = date_names(session.date) %}
{{ dn.day_name }} {{ dn.day }} {{ dn.month_name }}
de {{ session.start_time.strftime("%H:%M") }}
a {{ session.end_time.strftime("%H:%M") }}
{% if session.venue.name %}
a {{ session.venue.name }}
{% endif %}
</p>
{% endif %}

View File

@@ -4,15 +4,17 @@
relative"
id="session-row-{{session.id}}">
<a href="/session/{{session.id}}">
<div class="flex flex-row grow justify-center pl-10">
<div class="flex flex-row grow items-center">
<div class="flex-1">
<a href="/sessio/{{session.id}}/">
{% include "fragments/sessions/session_date.html" %}
</a>
</div>
<div class="ml-auto">
<a title="Més informació"
class="text-beige mx-1"
href="/sessio/{{session.id}}/">
<i class="fa fa-info-circle" aria-hidden="true"></i>
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</a>
{% if logged_in %}
<button title="Edita la sessió"

View File

@@ -9,6 +9,8 @@
{% include "icons/pdf.svg" %}
{% elif link.content_type == ContentType.AUDIO %}
{% include "icons/notes.svg" %}
{% elif link.content_type == ContentType.PARTITURA %}
{% include "icons/notes.svg" %}
{% else %}
{% include "icons/link.svg" %}
{% endif %}

View File

@@ -1,5 +1,5 @@
{% if logged_in or tema.links %}
<h4 class="text-xl text-beige">Enllaços</h4>
<h4 class="pt-4 text-xl text-beige">Enllaços</h4>
<hr class="h-px mt-1 mb-3 bg-beige border-0">
<ul class="flex flex-col justify-center"
id="new-link-target">

View File

@@ -1,5 +1,5 @@
{% if logged_in or tema.lyrics %}
<h4 class="text-xl text-beige">Lletra</h4>
<h4 class="pt-4 text-xl text-beige">Lletra</h4>
{% endif %}
{% if tema.lyrics %}

View File

@@ -1,20 +1,17 @@
{% include "fragments/menu.html" %}
<div class="flex justify-center">
<div class="m-12 grow max-w-4xl text-center">
<div class="flex flex-col justify-center">
<div class="mt-8">
{% include "fragments/tema/title.html" %}
<div class="text-left">
</div>
<div class="p-12 text-left">
<div id="tema-{{ tema.id }}-score"
hx-get="/api/tema/{{ tema.id }}/score"
hx-trigger="load, reload-tema-{{ tema.id }}-score from:body"
hx-swap="innerHTML"
>
hx-get="/api/tema/{{ tema.id }}/score"
hx-trigger="load, reload-tema-{{ tema.id }}-score from:body"
hx-swap="innerHTML"
>
</div>
{% include "fragments/tema/lyrics.html" %}
{% include "fragments/tema/links.html" %}
{% include "fragments/tema/properties.html" %}
</div>
</div>
</div>

View File

@@ -1,5 +1,5 @@
{% if logged_in or tema.properties %}
<h4 class="text-xl mt-3 text-beige">Informació</h4>
<h4 class="pt-4 text-xl mt-3 text-beige">Informació</h4>
<hr class="h-px mt-1 mb-3 bg-beige border-0">
<ul class="flex flex-col"

View File

@@ -1,15 +1,15 @@
{% set score = tema.score() %}
{% if score %}
<h4 class="text-xl text-beige">Partitura</h4>
<h4 class="mp-4 text-xl text-beige">Partitura</h4>
<hr class="h-px mt-1 mb-3 bg-beige border-0">
{% if score.link_type == LinkType.PDF %}
{% set pdf_url = score.url %}
{% include "fragments/pdf_viewer.html" %}
{% elif score.link_type == LinkType.IMAGE %}
<div class="flex justify-center">
<img class="m-2"
src="{{ score.url }}"
/>
<a href="{{ score.url }}" target="_blank">
<img class="m-2" src="{{ score.url }}" />
</a>
</div>
{% endif %}
{% endif %}

View File

@@ -1,6 +1,6 @@
<div class="flex flex-row flex-wrap justify-center"
id="tema-title">
<h3 class="text-3xl p-4">{{ tema.title }}</h3>
<h3 class="text-3xl text-center p-4">{{ tema.title }}</h3>
{% if logged_in %}
<button title="Canvia el títol"
class="text-beige text-2xl mx-2"

View File

@@ -10,7 +10,8 @@
p-2 m-2"
hx-get="/api/temes/busca"
hx-trigger="revealed, keyup delay:500ms changed"
hx-target="#search-results">
hx-target="#search-results"
hx-swap="outerHTML">
{% if logged_in %}
<button title="Afegeix un tema"
class="text-beige m-2"

View File

@@ -4,19 +4,9 @@
<li class="px-2 text-beige">
<a href="{{ link.url }}" target="_blank">
{% if link.content_type == ContentType.AUDIO %}
{% if link.link_type == LinkType.SPOTIFY %}
<i class="fa fa-music" aria-hidden="true"></i>
{% elif link.link_type == LinkType.YOUTUBE %}
<i class="fa fa-play" aria-hidden="true"></i>
{% else %}
<i class="fa fa-music" aria-hidden="true"></i>
{% endif %}
<i class="fa fa-volume-up" aria-hidden="true"></i>
{% elif link.content_type == ContentType.PARTITURA %}
{% if link.link_type == LinkType.PDF %}
<i class="fa fa-file" aria-hidden="true"></i>
{% else %}
<i class="fa fa-link" aria-hidden="true"></i>
{% endif %}
<i class="fa fa-music" aria-hidden="true"></i>
{% else %}
<i class="fa fa-link" aria-hidden="true"></i>
{% endif %}

View File

@@ -1,19 +1,41 @@
<table id="search-results"
class="text-left min-w-full w-full">
<tr class="border-b border-beige">
<td class="font-bold py-2 px-4">Nom</td>
<td class="font-bold py-2 px-4">Enllaços</td>
</tr>
{% for tema in temes %}
<tr class="border-b border-beige">
<td class="py-2 px-4">
<a href="/tema/{{ tema.id }}">
{{ tema.title }}
</a>
</td>
<td class="py-2 px-4">
{% include "fragments/temes/result_links.html" %}
</td>
</tr>
{% endfor %}
</table>
<div id="search-results"
class="min-w-full w-full">
<table class="text-left min-w-full w-full">
<tr class="border-b border-beige">
<td class="font-bold py-2 px-4">Nom</td>
<td class="font-bold py-2 px-4">Enllaços</td>
</tr>
{% for tema in temes %}
<tr class="border-b border-beige">
<td class="py-2 px-4">
<a href="/tema/{{ tema.id }}">
{{ tema.title }}
</a>
</td>
<td class="py-2 px-4">
{% include "fragments/temes/result_links.html" %}
</td>
</tr>
{% endfor %}
</table>
{% if prev_offset is not none or next_offset is not none %}
<div class="py-2">
{% if prev_offset is not none %}
<button class="text-beige mx-2"
hx-get="/api/temes/busca?query={{ query }}&offset={{ prev_offset }}"
hx-target="#search-results"
hx-swap="outerHTML">
<i class="fa fa-chevron-left" aria-hidden="true"></i>
</button>
{% endif %}
{% if next_offset is not none %}
<button class="text-beige mx-2"
hx-get="/api/temes/busca?query={{ query }}&offset={{ next_offset }}"
hx-target="#search-results"
hx-swap="outerHTML">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</button>
{% endif %}
</div>
{% endif %}
</div>