redesign clock card on manual submission
This commit is contained in:
Binary file not shown.
@@ -4,7 +4,15 @@
|
|||||||
<p class="eyebrow">{% trans "Quick report" %}</p>
|
<p class="eyebrow">{% trans "Quick report" %}</p>
|
||||||
<div class="manual-report__heading-row"><span class="manual-report__fire" aria-hidden="true">🔥</span><h2 class="manual-report__title" id="manual-report-title">{% trans "Report fireworks now" %}</h2></div>
|
<div class="manual-report__heading-row"><span class="manual-report__fire" aria-hidden="true">🔥</span><h2 class="manual-report__title" id="manual-report-title">{% trans "Report fireworks now" %}</h2></div>
|
||||||
<p class="manual-report__intro">{% trans "Did you hear a bang? Report what you heard in a few taps." %}</p>
|
<p class="manual-report__intro">{% trans "Did you hear a bang? Report what you heard in a few taps." %}</p>
|
||||||
<p class="manual-report__context"><span aria-hidden="true">◷</span> <time id="manual-report-time">{% trans "Now" %}</time></p>
|
<div class="report-clock" role="group" aria-label="{% trans 'Report time' %}">
|
||||||
|
<span class="report-clock__label" aria-hidden="true">{% trans "Report time" %}</span>
|
||||||
|
<div class="report-clock__display">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<form id="manual-report-form" action="{% url "fireworks_detect:submit_manual_pending" %}" method="post" enctype="multipart/form-data">
|
<form id="manual-report-form" action="{% url "fireworks_detect:submit_manual_pending" %}" method="post" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
const compassRose = document.querySelector("#manual-compass-rose");
|
const compassRose = document.querySelector("#manual-compass-rose");
|
||||||
const compassHeading = document.querySelector("#manual-compass-heading");
|
const compassHeading = document.querySelector("#manual-compass-heading");
|
||||||
const reportTime = document.querySelector("#manual-report-time");
|
const reportTime = document.querySelector("#manual-report-time");
|
||||||
|
const reportHours = document.querySelector("#report-clock-hours");
|
||||||
|
const reportMinutes = document.querySelector("#report-clock-minutes");
|
||||||
let orientationListener;
|
let orientationListener;
|
||||||
let compassUnavailableTimeout;
|
let compassUnavailableTimeout;
|
||||||
let compassRotation = null;
|
let compassRotation = null;
|
||||||
@@ -34,7 +36,13 @@
|
|||||||
if (!reportTime) return;
|
if (!reportTime) return;
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
reportTime.dateTime = now.toISOString();
|
reportTime.dateTime = now.toISOString();
|
||||||
reportTime.textContent = now.toLocaleTimeString(document.documentElement.lang || undefined, { hour: "2-digit", minute: "2-digit" });
|
const parts = new Intl.DateTimeFormat(document.documentElement.lang || undefined, { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }).formatToParts(now);
|
||||||
|
const hours = parts.find((part) => part.type === "hour")?.value;
|
||||||
|
const minutes = parts.find((part) => part.type === "minute")?.value;
|
||||||
|
if (!hours || !minutes || !reportHours || !reportMinutes) return;
|
||||||
|
reportHours.textContent = hours;
|
||||||
|
reportMinutes.textContent = minutes;
|
||||||
|
reportTime.setAttribute("aria-label", `${hours}:${minutes}`);
|
||||||
};
|
};
|
||||||
updateReportTime();
|
updateReportTime();
|
||||||
if (reportTime) window.setInterval(updateReportTime, 60000);
|
if (reportTime) window.setInterval(updateReportTime, 60000);
|
||||||
|
|||||||
@@ -151,8 +151,39 @@
|
|||||||
|
|
||||||
.manual-report__heading-row { display: flex; align-items: center; gap: .7rem; }
|
.manual-report__heading-row { display: flex; align-items: center; gap: .7rem; }
|
||||||
.manual-report__fire { flex: none; font-size: clamp(1.8rem, 5vw, 2.5rem); filter: drop-shadow(0 .2rem .65rem #ff703b88); }
|
.manual-report__fire { flex: none; font-size: clamp(1.8rem, 5vw, 2.5rem); filter: drop-shadow(0 .2rem .65rem #ff703b88); }
|
||||||
.manual-report__context { display: flex; align-items: center; gap: .35rem; margin: -.65rem 0 1.25rem; color: #bdafd8; font-size: .88rem; font-variant-numeric: tabular-nums; }
|
.manual-report__intro, .dashboard-report .manual-report__intro { margin-bottom: .85rem; }
|
||||||
.manual-report__context span { font-size: 1.1rem; }
|
.report-clock {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 36rem;
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
padding: .65rem .95rem .7rem;
|
||||||
|
border: 1px solid #69539d;
|
||||||
|
border-radius: .85rem;
|
||||||
|
background: linear-gradient(115deg, #17162d, #10182c);
|
||||||
|
box-shadow: inset 0 1px #ffffff0a;
|
||||||
|
}
|
||||||
|
.report-clock__label { color: #cbbce5; font-size: .66rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
|
||||||
|
.report-clock__display { display: flex; align-items: end; justify-content: space-between; gap: .75rem; }
|
||||||
|
.report-clock__time {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
color: #ffbf72;
|
||||||
|
font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
|
||||||
|
font-size: clamp(2rem, 9vw, 2.45rem);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.1;
|
||||||
|
letter-spacing: 0;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
text-shadow: 0 0 .7rem #ff963b55;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.report-clock__time span { display: inline-block; }
|
||||||
|
.report-clock__time #report-clock-hours, .report-clock__time #report-clock-minutes { width: 2ch; }
|
||||||
|
.report-clock__colon { width: 1ch; flex: none; margin-inline: -.08em; line-height: 1; text-align: center; transform: translateY(-.06em); animation: report-clock-blink 2s steps(1, end) infinite; }
|
||||||
|
.report-clock__now { display: inline-flex; align-items: center; gap: .4rem; flex: none; padding: .2rem .45rem; border: 1px solid #93634d; border-radius: 999px; color: #ffd2a2; font-size: .7rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
|
||||||
|
.report-clock__dot { width: .4rem; height: .4rem; border-radius: 50%; background: #ffab5d; }
|
||||||
|
@keyframes report-clock-blink { 50% { opacity: 0; } }
|
||||||
.manual-direction-panel__open { width: 100%; text-align: left; }
|
.manual-direction-panel__open { width: 100%; text-align: left; }
|
||||||
.manual-direction-panel--open .manual-compass { width: 100%; margin: .5rem auto 1rem; }
|
.manual-direction-panel--open .manual-compass { width: 100%; margin: .5rem auto 1rem; }
|
||||||
.manual-direction-panel--open .manual-compass__dial { width: min(100%, 12rem); border-color: #8b67d4; background: radial-gradient(circle, #302054 0 20%, #17132d 70%); box-shadow: 0 0 0 .35rem #6640a228, 0 0 2rem #ac6aff35; }
|
.manual-direction-panel--open .manual-compass__dial { width: min(100%, 12rem); border-color: #8b67d4; background: radial-gradient(circle, #302054 0 20%, #17132d 70%); box-shadow: 0 0 0 .35rem #6640a228, 0 0 2rem #ac6aff35; }
|
||||||
@@ -178,9 +209,10 @@
|
|||||||
:root[data-theme="dark"] .manual-direction-panel[data-state="captured"] { border-color: #68dba1; }
|
:root[data-theme="dark"] .manual-direction-panel[data-state="captured"] { border-color: #68dba1; }
|
||||||
:root[data-theme="dark"] .manual-direction-panel[data-state="unavailable"] { border-color: #d38b7a; }
|
:root[data-theme="dark"] .manual-direction-panel[data-state="unavailable"] { border-color: #d38b7a; }
|
||||||
|
|
||||||
:root[data-theme="light"] .manual-report__context { color: #70466d; }
|
:root[data-theme="light"] .report-clock { border-color: #8b6bab; background: linear-gradient(115deg, #221b37, #182039); }
|
||||||
:root[data-theme="light"] .manual-direction-panel--open .manual-compass__dial { background: radial-gradient(circle, #f8ebf8 0 25%, #e8d7e9 75%); }
|
:root[data-theme="light"] .manual-direction-panel--open .manual-compass__dial { background: radial-gradient(circle, #f8ebf8 0 25%, #e8d7e9 75%); }
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
.manual-report__stepper button, .manual-direction-panel__open, .manual-direction-panel__close, .manual-report__submit { transition: none; }
|
.manual-report__stepper button, .manual-direction-panel__open, .manual-direction-panel__close, .manual-report__submit { transition: none; }
|
||||||
.manual-submission--success .manual-submission__icon { animation: none; }
|
.manual-submission--success .manual-submission__icon { animation: none; }
|
||||||
|
.report-clock__colon { animation: none; opacity: 1; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { JSDOM } from "jsdom";
|
|||||||
|
|
||||||
test("compass stays hidden until permission and a heading, then rotates and hides when stopped", async () => {
|
test("compass stays hidden until permission and a heading, then rotates and hides when stopped", async () => {
|
||||||
const dom = new JSDOM(`<!doctype html><html><body>
|
const dom = new JSDOM(`<!doctype html><html><body>
|
||||||
|
<time id="manual-report-time"><span id="report-clock-hours">--</span><span class="report-clock__colon">:</span><span id="report-clock-minutes">--</span></time>
|
||||||
<form id="manual-report-form" action="/submit">
|
<form id="manual-report-form" action="/submit">
|
||||||
<input id="manual-latitude"><input id="manual-longitude">
|
<input id="manual-latitude"><input id="manual-longitude">
|
||||||
<input id="manual-direction-degrees"><input id="manual-direction-accuracy">
|
<input id="manual-direction-degrees"><input id="manual-direction-accuracy">
|
||||||
@@ -32,6 +33,10 @@ test("compass stays hidden until permission and a heading, then rotates and hide
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await import("../src/scripts/manual-report.js?compass=visual");
|
await import("../src/scripts/manual-report.js?compass=visual");
|
||||||
|
const reportTime = window.document.querySelector("#manual-report-time");
|
||||||
|
assert.match(reportTime.getAttribute("aria-label"), /^\d{2}:\d{2}$/);
|
||||||
|
assert.equal(reportTime.querySelector(".report-clock__colon").textContent, ":");
|
||||||
|
assert.match(reportTime.dateTime, /^\d{4}-\d{2}-\d{2}T/);
|
||||||
const compass = window.document.querySelector("#manual-compass");
|
const compass = window.document.querySelector("#manual-compass");
|
||||||
const rose = window.document.querySelector("#manual-compass-rose");
|
const rose = window.document.querySelector("#manual-compass-rose");
|
||||||
const button = window.document.querySelector("#manual-capture-direction");
|
const button = window.document.querySelector("#manual-capture-direction");
|
||||||
|
|||||||
Binary file not shown.
@@ -1296,6 +1296,9 @@ msgstr "Heb je een knal gehoord? Meld in een paar tikken wat je hoorde."
|
|||||||
msgid "Now"
|
msgid "Now"
|
||||||
msgstr "Nu"
|
msgstr "Nu"
|
||||||
|
|
||||||
|
msgid "Report time"
|
||||||
|
msgstr "Tijdstip melding"
|
||||||
|
|
||||||
msgid "How many times did you hear it?"
|
msgid "How many times did you hear it?"
|
||||||
msgstr "Hoe vaak hoorde je het?"
|
msgstr "Hoe vaak hoorde je het?"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
/* empty css */import"./fireworks-home.js-BqdOneRR.js";import"./map.js-BLPiBo7S.js";import"../../../manual-report-CDq_SjV-.js";import"../../../theme-DXAi27ON.js";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/* empty css */import"./fireworks-home.js-BqdOneRR.js";import"./map.js-BLPiBo7S.js";import"../../../manual-report-CUpfqH8W.js";import"../../../theme-DXAi27ON.js";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/* empty css */import"./fireworks-home.js-BqdOneRR.js";import"./map.js-BLPiBo7S.js";import"../../../manual-report-4E-uuYx3.js";import"../../../theme-DXAi27ON.js";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/* empty css */import"./fireworks-home.js-BqdOneRR.js";import"./map.js-BLPiBo7S.js";import"../../../manual-report-DlPvmnuS.js";import"../../../theme-DXAi27ON.js";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
import"../../../manual-report-CDq_SjV-.js";import"../../../theme-DXAi27ON.js";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
import"../../../manual-report-CUpfqH8W.js";import"../../../theme-DXAi27ON.js";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
import"../../../manual-report-DlPvmnuS.js";import"../../../theme-DXAi27ON.js";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
import"../../../manual-report-4E-uuYx3.js";import"../../../theme-DXAi27ON.js";
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user