feat: Display most recent recording time
Add `recorded_at_iso` and `time_hms_utc` to `CasePageTemplate` to display the timestamp of the most recent recording. Introduce a new partial `partials/time_format.js` for consistent date and time formatting in the browser. Update templates to use the new partial for rendering timestamps and group headings.
This commit is contained in:
@@ -134,6 +134,12 @@ struct CasePageTemplate {
|
||||
case_id: String,
|
||||
case_id_short: String,
|
||||
oneliner: Option<String>,
|
||||
/// RFC3339 UTC timestamp of the most recent recording. `None` iff the
|
||||
/// case has no recordings at all. Drives the datetime header under the
|
||||
/// title; browser JS formats it to "Heute 11:34" / "13.12.2022 11:34".
|
||||
recorded_at_iso: Option<String>,
|
||||
/// UTC `HH:MM` as a no-JS fallback inside the `<time>` element.
|
||||
time_hms_utc: String,
|
||||
/// Rendered document HTML (already passed through `md_to_html`). `Some`
|
||||
/// iff `document.md` exists at render time — template prioritises this
|
||||
/// over status/analyzing placeholders.
|
||||
@@ -315,10 +321,16 @@ pub async fn handle_case_page(
|
||||
let case_id_short = case_id_str.chars().take(8).collect();
|
||||
let is_admin = user.is_admin();
|
||||
|
||||
let most_recent = recordings.last().map(|r| r.filename.as_str());
|
||||
let recorded_at_iso = most_recent.map(recorded_at_iso_of).filter(|s| !s.is_empty());
|
||||
let time_hms_utc = most_recent.map(extract_hhmm_utc).unwrap_or_default();
|
||||
|
||||
CasePageTemplate {
|
||||
case_id: case_id_str,
|
||||
case_id_short,
|
||||
oneliner,
|
||||
recorded_at_iso,
|
||||
time_hms_utc,
|
||||
document_html,
|
||||
recordings_count,
|
||||
transcribed_count,
|
||||
|
||||
Reference in New Issue
Block a user