manual submission redesign phase D

This commit is contained in:
Joren de Graaf
2026-10-06 19:50:52 +02:00
parent e555023587
commit dda5cd9c84
7 changed files with 103 additions and 22 deletions
@@ -1,5 +1,5 @@
{% load i18n %}
<div class="manual-direction-panel{% if measuring %} manual-direction-panel--measuring{% endif %}" id="manual-direction-panel">
<div class="manual-direction-panel{% if measuring %} manual-direction-panel--open{% endif %}" id="manual-direction-panel" data-state="{% if measuring %}ready{% else %}idle{% endif %}">
{% if measuring %}
<div class="manual-direction-panel__topline">
<strong class="manual-direction-panel__heading">{% trans "Capture direction" %}</strong>
@@ -5,7 +5,7 @@
<h2 class="manual-report__title" id="manual-report-title">{% trans "Report fireworks now" %}</h2>
<p class="manual-report__intro">{% trans "Choose how many times you heard fireworks, then send it straight to Pending. The report is timestamped now." %}</p>
</header>
<form id="manual-report-form" action="{% url "fireworks_detect:submit_manual_pending" %}" method="post" enctype="multipart/form-data" hx-post="{% url "fireworks_detect:submit_manual_pending" %}" hx-target="#manual-submission" hx-swap="outerHTML">
<form id="manual-report-form" action="{% url "fireworks_detect:submit_manual_pending" %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
<input id="manual-latitude" name="latitude" type="hidden">
<input id="manual-longitude" name="longitude" type="hidden">
@@ -21,7 +21,7 @@
</div>
</div>
{% include "fireworks_detect/includes/manual_direction_panel.html" %}
<button id="manual-submit" class="manual-report__submit" type="button"><span aria-hidden="true">🔥</span> {% trans "I heard fireworks" %}</button>
<button id="manual-submit" class="manual-report__submit" type="button"><span aria-hidden="true">🔥</span> <span id="manual-submit-label">{% trans "I heard fireworks" %}</span></button>
</div>
<section class="manual-report__supporting" data-state="off" aria-labelledby="manual-listening-title">
<div class="manual-report__supporting-header">
@@ -1,8 +1,17 @@
{% load i18n %}
<div id="manual-submission" role="status">
<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 %}">
{% if error %}
<strong>{% trans "Could not report fireworks" %}</strong><p>{{ error }}</p>
<span class="manual-submission__icon" aria-hidden="true">!</span>
<strong>{% trans "Could not report fireworks" %}</strong>
<p>{{ error }}</p>
{% else %}
<strong>{% trans "Report sent to Pending" %}</strong><p>{% blocktrans count count=pending.occurrences with time=pending.created_at|date:"H:i" %}{{ count }} occurrence reported at {{ time }}.{% plural %}{{ count }} occurrences reported at {{ time }}.{% endblocktrans %}</p>
<span class="manual-submission__icon" aria-hidden="true">✓</span>
<strong>{% trans "Report received!" %}</strong>
<p>{% trans "Thank you. Your report helps map fireworks nearby." %}</p>
<p class="manual-submission__summary">
{{ pending.created_at|date:"H:i" }} ·
{% blocktrans count count=pending.occurrences %}{{ count }} occurrence{% plural %}{{ count }} occurrences{% endblocktrans %}
{% if pending.direction_degrees is not None %} · {{ pending.direction_cardinal }} {{ pending.direction_degrees|floatformat:0 }}°{% endif %}
</p>
{% endif %}
</div>