fix now card width

This commit is contained in:
Joren de Graaf
2026-10-14 18:17:27 +02:00
parent 7220dd564f
commit 76b42b670e
199 changed files with 1589 additions and 106 deletions
@@ -25,6 +25,7 @@
<section class="dashboard-section" aria-label="{% trans "Quick fireworks report" %}">
<div class="dashboard-report">
{% include "fireworks_detect/includes/manual_report_form.html" %}
{% if user.is_authenticated %}{% include "fireworks_detect/notes/panel.html" %}{% else %}<p><a href="{% url 'login' %}?next=/">{% trans "Sign in to add private field notes" %}</a></p>{% endif %}
</div>
</section>
@@ -30,3 +30,5 @@
<p class="empty">{% trans "No peak events returned." %}</p>
{% endfor %}
{% endif %}
{% if request.user.is_authenticated %}{% include "fireworks_detect/notes/panel.html" %}{% else %}<p><a href="{% url 'login' %}?next={{ request.path|urlencode }}">{% trans "Sign in to add private field notes" %}</a></p>{% endif %}
@@ -0,0 +1,2 @@
{% load i18n vite %}
<!doctype html><html lang="{{ request.LANGUAGE_CODE|default:'en' }}" data-theme="dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{% trans "Event · BoomCast" %}</title><script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.4/dist/htmx.min.js"></script>{% vite_asset "frontend/src/entries/events.js" %}</head><body><main class="shell">{% include "fireworks_detect/includes/navigation.html" %}<section class="panel">{% include "fireworks_detect/event_detail.html" %}</section></main></body></html>
@@ -1,2 +1,2 @@
{% load i18n vite %}
<!doctype html><html lang="{{ request.LANGUAGE_CODE|default:'en' }}" data-theme="dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{% trans "Events · Sound Signal" %}</title><script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.4/dist/htmx.min.js"></script>{% vite_asset "frontend/src/entries/events.js" %}{% include "js_translations.html" %}</head><body><main class="shell">{% include "fireworks_detect/includes/navigation.html" with active_page="events" %}<p class="eyebrow">{% trans "Reviewed signal archive" %}</p><h1>{% trans "Approved events." %}</h1><p class="lede">{% trans "This feed refreshes automatically every three seconds after a pending sample is approved in admin." %}</p><div class="grid"><section class="panel"><h2>{% trans "Latest events" %}</h2><div id="events-feed" hx-get="{% url 'fireworks_detect:events_list' %}" hx-trigger="load, every 3s" hx-swap="innerHTML"><p class="empty">{% trans "Loading events…" %}</p></div></section><section class="panel detail" id="event-detail"><h2>{% trans "Select an event" %}</h2><p class="empty">{% trans "Choose an approved event to inspect its classification details." %}</p></section></div></main></body></html>
<!doctype html><html lang="{{ request.LANGUAGE_CODE|default:'en' }}" data-theme="dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{% trans "Events · Sound Signal" %}</title><script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.4/dist/htmx.min.js"></script>{% vite_asset "frontend/src/entries/events.js" %}{% include "js_translations.html" %}</head><body><main class="shell">{% include "fireworks_detect/includes/navigation.html" with active_page="events" %}<p class="eyebrow">{% trans "Reviewed signal archive" %}</p><h1>{% trans "Approved events." %}</h1><p class="lede">{% trans "This feed refreshes automatically every three seconds after a pending sample is approved in admin." %}</p><div class="grid"><section class="panel"><h2>{% trans "Latest events" %}</h2><div id="events-feed" hx-get="{% url 'fireworks_detect:events_list' %}" hx-trigger="load, every 3s" hx-swap="innerHTML">{% include "fireworks_detect/events_list.html" %}</div></section><section class="panel detail" id="event-detail"><h2>{% trans "Select an event" %}</h2><p class="empty">{% trans "Choose an approved event to inspect its classification details." %}</p></section></div></main></body></html>
@@ -1,7 +1,7 @@
{% load i18n %}
{% if events %}
{% for event in events %}
<button class="event {% if event.source_type == "manual" %}event--manual{% else %}event--sensor{% endif %}" hx-get="{% url 'fireworks_detect:event_detail' event.id %}" hx-target="#event-detail" hx-swap="innerHTML">
<a href="{% url 'fireworks_detect:event_detail' event.id %}" class="event {% if event.source_type == "manual" %}event--manual{% else %}event--sensor{% endif %}" hx-get="{% url 'fireworks_detect:event_detail' event.id %}" hx-target="#event-detail" hx-swap="innerHTML">
<span class="event__content">
{% if event.source_type == "manual" %}
<span class="event__source">{% trans "Manual report" %}</span>
@@ -14,7 +14,7 @@
{% endif %}
</span>
<span class="badge">{% if event.source_type == "manual" %}{% trans "Manual" %} →{% else %}{{ event.primary_score }} →{% endif %}</span>
</button>
</a>
{% endfor %}
{% else %}
<p class="empty">{% trans "No approved events yet. Submit a classification, then approve it from the Pending page in admin." %}</p>
@@ -10,22 +10,32 @@
<time id="manual-report-time" class="report-clock__time" aria-label="{% trans 'Now' %}">
<span id="report-clock-hours" aria-hidden="true">--</span><span class="report-clock__colon" aria-hidden="true">:</span><span id="report-clock-minutes" aria-hidden="true">--</span>
</time>
<span class="report-clock__now" aria-hidden="true"><span class="report-clock__dot"></span>{% trans "Now" %}</span>
<div class="report-clock__controls">
<span id="report-clock-mode" class="report-clock__now"><span class="report-clock__dot" aria-hidden="true"></span><span id="report-clock-mode-label">{% trans "Now" %}</span></span>
<button id="report-clock-edit" class="report-clock__edit" type="button" aria-label="{% trans 'Edit report time' %}" aria-controls="report-clock-editor" aria-expanded="false" title="{% trans 'Edit report time' %}"><span aria-hidden="true">✎</span></button>
</div>
</div>
<span id="report-clock-date" class="report-clock__date" hidden></span>
<button id="report-clock-reset" class="report-clock__reset" type="button" hidden>{% trans "Use now" %}</button>
<div id="report-clock-editor" class="report-clock__editor" hidden>
<div class="report-clock__fields">
<div><label for="report-clock-draft-date">{% trans "Date" %}</label><input id="report-clock-draft-date" type="date" aria-describedby="report-clock-error"></div>
<div><label for="report-clock-draft-time">{% trans "Time (24-hour)" %}</label><input id="report-clock-draft-time" type="text" inputmode="numeric" autocomplete="off" placeholder="14:30" maxlength="5" aria-describedby="report-clock-error"></div>
</div>
<p id="report-clock-error" class="report-clock__error" role="alert" hidden></p>
<label class="manual-report__check"><input id="manual-time-approximate" name="time_approximate" type="checkbox" form="manual-report-form" disabled> {% trans "Time is approximate" %}</label>
<div class="report-clock__actions"><button id="report-clock-apply" type="button">{% trans "Apply" %}</button><button id="report-clock-cancel" type="button">{% trans "Cancel" %}</button></div>
</div>
</div>
</header>
<form id="manual-report-form" action="{% url "fireworks_detect:submit_manual_pending" %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
{% if note_token %}<input type="hidden" name="field_note_context" id="manual-note-context" value="{{ note_token }}">{% endif %}
<input id="manual-latitude" name="latitude" type="hidden">
<input id="manual-longitude" name="longitude" type="hidden">
<input id="manual-direction-degrees" name="direction_degrees" type="hidden">
<input id="manual-direction-accuracy" name="direction_accuracy_degrees" type="hidden">
<div class="manual-report__occurrence">
<label class="manual-report__label" for="manual-occurred-at">{% trans "When did it happen?" %}</label>
<div class="manual-report__time-row"><input id="manual-occurred-at" name="occurred_at" type="datetime-local" aria-describedby="manual-time-help"><button id="manual-use-now" type="button">{% trans "Use now" %}</button></div>
<label class="manual-report__check"><input id="manual-time-approximate" name="time_approximate" type="checkbox"> {% trans "Time is approximate" %}</label>
<small id="manual-time-help">{% trans "Leave the time empty to use the submission time." %}</small>
</div>
<input id="manual-occurred-at" name="occurred_at" type="hidden">
<div class="manual-report__primary">
<div class="manual-report__quantity">
<label class="manual-report__label" for="manual-occurrences">{% trans "How many times did you hear it?" %}</label>
@@ -8,6 +8,7 @@
<a href="{% url "fireworks_detect:map" %}"{% if active_page == "map" %} aria-current="page"{% endif %}>{% trans "Map" %}</a>
<a href="{% url "fireworks_detect:events" %}"{% if active_page == "events" %} aria-current="page"{% endif %}>{% trans "Events" %}</a>
{% if request.user.is_authenticated %}
<a href="{% url 'fireworks_detect:field_notes' %}">{% trans "Field notes" %}</a>
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button type="submit">{% trans "Sign out" %}</button>
@@ -1,5 +1,5 @@
{% load i18n %}
<div id="manual-submission" class="manual-submission{% if error %} manual-submission--error{% else %} manual-submission--success{% endif %}" role="status" data-result="{% if error %}error{% else %}success{% endif %}">
<div id="manual-submission" class="manual-submission{% if error %} manual-submission--error{% else %} manual-submission--success{% endif %}" role="status" data-next-note-token="{{ next_note_token }}" data-result="{% if error %}error{% else %}success{% endif %}">
{% if error %}
<span class="manual-submission__icon" aria-hidden="true">!</span>
<strong>{% trans "Could not report fireworks" %}</strong>
@@ -16,6 +16,7 @@
<p>{% if pending.is_burst %}{% trans "Burst Event" %}{% else %}{% trans "Ordinary report" %}{% endif %} · {% trans "Submitted" %} {{ pending.created_at|date:"j M Y, H:i" }}</p>
{% if pending.is_burst %}<p>{% trans "Duration" %}: {% if pending.observation_duration_minutes %}{{ pending.observation_duration_minutes }} {% trans "minutes (estimated)" %}{% else %}{% trans "Unknown" %}{% endif %}</p>
<p>{% trans "Intensity" %}: {% if pending.burst_intensity %}{{ pending.burst_intensity_display }} ({{ pending.bangs_per_15_minutes|floatformat:1 }} {% trans "bangs per 15 minutes" %}){% else %}{% trans "Not rated" %}{% endif %}</p>{% endif %}
{% if request.user.is_authenticated %}<p><a href="{% url 'fireworks_detect:field_notes' %}?pending={{ pending.pk }}">{% trans "Add or review field notes for this report" %}</a></p>{% endif %}
{% if editable %}<form class="manual-submission__edit" method="post" action="{% url 'fireworks_detect:update_manual_pending' pending.pk %}" hx-post="{% url 'fireworks_detect:update_manual_pending' pending.pk %}" hx-target="#manual-submission" hx-swap="outerHTML">
{% csrf_token %}
<label for="manual-edit-count">{% trans "Correct bang count" %}</label>
@@ -0,0 +1,2 @@
{% load i18n vite %}
<!doctype html><html lang="{{ request.LANGUAGE_CODE|default:'en' }}" data-theme="dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{% trans "Field notes · BoomCast" %}</title><script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.4/dist/htmx.min.js"></script>{% vite_asset "frontend/src/entries/events.js" %}</head><body><main class="shell">{% include "fireworks_detect/includes/navigation.html" %}<section class="panel">{% include "fireworks_detect/notes/panel.html" %}<p>{% trans "Exports include only reportable notes you are authorised to export. Private notes are always excluded." %}</p><a href="{% url 'fireworks_detect:export_field_notes' 'json' %}">JSON</a> · <a href="{% url 'fireworks_detect:export_field_notes' 'csv' %}">CSV</a></section></main></body></html>
@@ -0,0 +1,38 @@
{% load i18n tz %}
<section class="field-notes" id="{{ note_panel_id|default:'live-field-notes' }}" aria-label="{% trans 'Field notes' %}">
<h2>{% trans "Field notes" %} <span class="field-notes__count">({{ note_count|default:0 }})</span></h2>
<p>{% trans "Human context, separate from detection evidence. Notes are private by default. Add a follow-up to correct an earlier entry." %}</p>
{% if note_target %}<p>{% trans "Report" %} #{{ note_target.pk }} · {{ note_target.occurrences }} {% trans "bangs" %}</p>{% endif %}
{% if note_saved %}<p role="status">{% trans "Field note saved." %}</p>{% endif %}
<details {% if note_form.errors %}open{% endif %}>
<summary>{% trans "Add field note" %}</summary>
<form method="post" action="{% url 'fireworks_detect:field_notes' %}" hx-post="{% url 'fireworks_detect:field_notes' %}" hx-target="closest .field-notes" hx-swap="outerHTML">
{% csrf_token %}
{% if note_token %}<input type="hidden" name="token" value="{{ note_token }}">{% elif note_kind %}<input type="hidden" name="{{ note_kind }}" value="{{ note_value }}">{% endif %}
{{ note_form.non_field_errors }}
<div class="field-notes__field">{{ note_form.content.label_tag }}{{ note_form.content }}{{ note_form.content.errors }}</div>
<details {% if note_form.errors %}open{% endif %}><summary>{% trans "Optional details" %}</summary>
<div class="field-notes__fields">
{% for field in note_form %}{% if field.name != 'content' %}<div class="field-notes__field">{{ field.label_tag }}{{ field }}{% if field.help_text %}<small id="{{ field.auto_id }}_helptext">{{ field.help_text }}</small>{% endif %}{{ field.errors }}</div>{% endif %}{% endfor %}
</div>
</details>
<button type="submit">{% trans "Save field note" %}</button>
</form>
</details>
<ol class="field-notes__timeline">
{% for note in field_notes %}
<li>
<p class="field-notes__meta">{{ note.get_category_display }} · {{ note.author.get_username }} · {{ note.get_visibility_display }}</p>
<p class="field-notes__meta">{{ note.get_source_type_display }} · {{ note.get_verification_status_display }}</p>
<p class="field-notes__content">{{ note.content }}</p>
<p class="field-notes__meta">{% trans "Entered" %}: <time datetime="{{ note.created_at|date:'c' }}">{{ note.created_at|localtime|date:"j M Y, H:i T" }}</time>{% if note.observed_at %}<br>{% trans "Observed" %}: <time datetime="{{ note.observed_at|date:'c' }}">{{ note.observed_at|localtime|date:"j M Y, H:i T" }}</time>{% endif %}</p>
{% if note.context.event_id %}<a href="{% url 'fireworks_detect:event_detail' note.context.event_id %}">{% trans "Event" %} #{{ note.context.event_id }}</a>{% elif note.context.pending_event_id %}<a href="{% url 'fireworks_detect:field_notes' %}?pending={{ note.context.pending_event_id }}">{% trans "Pending report" %} #{{ note.context.pending_event_id }}</a>{% else %}<span>{% if note_token %}{% trans "Current observation — not yet submitted" %}{% else %}{% trans "Standalone observation" %}{% endif %}</span>{% endif %}
{% if note.context.associations.all %}<details><summary>{% trans "Association history" %}</summary><ul>{% for change in note.context.associations.all %}<li>{{ change.created_at|localtime|date:"j M Y, H:i" }} · {{ change.reason }} · {{ change.previous.kind|default:"standalone" }} {{ change.previous.id|default:"" }} → {{ change.target.kind }} {{ change.target.id }}</li>{% endfor %}</ul></details>{% endif %}
{% if not note_kind and not note.context.event_id and not note.context.pending_event_id and note.author_id == request.user.pk %}
<form method="post" action="{% url 'fireworks_detect:link_field_note' note.context_id %}">{% csrf_token %}<label for="link-{{ note.pk }}">{% trans "Link to an approved event" %}</label><select name="event" id="link-{{ note.pk }}" required><option value="">{% trans "Choose an event" %}</option>{% for item in note_events %}<option value="{{ item.pk }}">#{{ item.pk }} · {{ item.captured_at|default:item.created_at|date:"j M Y, H:i" }} · {{ item.occurrences }} {% trans "bangs" %}</option>{% endfor %}</select><button type="submit">{% trans "Link observation" %}</button></form>
{% endif %}
</li>
{% empty %}<li>{% trans "No field notes visible to you yet." %}</li>{% endfor %}
</ol>
<p><a href="{% url 'fireworks_detect:field_notes' %}">{% trans "My field notes" %}</a></p>
</section>