From ae715c3b71614fad7a04d121130743a0ec33d998 Mon Sep 17 00:00:00 2001 From: Jeremy Liu Date: Thu, 19 Nov 2026 23:34:29 +0000 Subject: [PATCH 1/2] fix(web): apply playback, date format and visibility sync preferences Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- CHANGELOG.md | 5 +++++ spec/plaud.md | 3 ++- spec/ui-app.md | 1 + spec/ui-library.md | 1 + web/src/components/player/player-card.tsx | 17 ++++++++------- web/src/components/recording/details-card.tsx | 8 ++++--- .../components/recording/recording-header.tsx | 6 ++++-- .../components/recordings/library-model.ts | 21 +++---------------- .../components/recordings/recording-row.tsx | 10 +++++---- web/src/components/shell/shell-data.tsx | 15 +++++++++++++ web/src/lib/format.ts | 9 ++++++++ web/src/pages/library/library.tsx | 19 +++++++++++++++++ 12 files changed, 79 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 113da9e..fd75d1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and ## [Unreleased] +### Fixed + +- Auto-play next starts the next recording in the current library order and stops at the end. Recording dates now follow the selected relative, absolute or ISO format across library rows, detail and player views. +- Returning to the app tab syncs a connected Plaud account when enabled, with a one-minute throttle to avoid repeated syncs during rapid tab switches. + ## [1.6.0] - 2026-11-06 ### Added diff --git a/spec/plaud.md b/spec/plaud.md index b23c1fb..eb13e2d 100644 --- a/spec/plaud.md +++ b/spec/plaud.md @@ -485,10 +485,11 @@ The web app's shell calls `POST /api/plaud/sync` while a page is open and the co | sync on mount | on | One quiet sync when the app shell loads. Off when `syncOnMount` is `false`. | | interval | 5 minutes | Sync at this interval. The settings offer 1, 2, 5, 10, 15 and 30 minutes. The value is never less than 1 minute. Ticks are skipped while the page is hidden. | | enabled | on | Off when `autoSyncEnabled` is `false`. | +| sync on return | on | On `visibilitychange` to `visible`, sync quietly when `syncOnVisibilityChange` is not `false`, Plaud is enabled and connected without a reconnect requirement. At most one visibility-triggered sync per minute; events during an existing sync are skipped. This setting is independent of interval sync. | Quiet syncs show no toast on success or failure. A sync is not started while another sync from the same page is running. -The interval and on/off are saved as user settings: `syncInterval` (milliseconds), `autoSyncEnabled`, `syncOnMount`, `syncOnVisibilityChange`, `syncNotifications`. The client does not act on `syncOnVisibilityChange`; it is stored only. Browser storage is not used for these settings. +The interval and on/off are saved as user settings: `syncInterval` (milliseconds), `autoSyncEnabled`, `syncOnMount`, `syncOnVisibilityChange`, `syncNotifications`. Browser storage is not used for these settings. The visibility listener is removed when the shell unmounts or the setting or connection no longer permits sync. The worker skips users synced in the last 4 minutes, so a recent browser sync also keeps the worker from running for that user. diff --git a/spec/ui-app.md b/spec/ui-app.md index 7a70528..2aaaa29 100644 --- a/spec/ui-app.md +++ b/spec/ui-app.md @@ -324,6 +324,7 @@ Each section page has a visually hidden level 1 heading "Settings", and its own ### 4.10 Display (`display`) - "Date/time format" (`date-time-format`): "Relative", "Absolute", "ISO". Saves `dateTimeFormat`. + Library row dates (including accessible names), recording detail dates and the player's recorded range share one formatter: Relative uses the interface locale's relative time, Absolute uses the locale's date and time, and ISO uses UTC ISO 8601. Invalid dates render empty; an unset or unknown format falls back to Relative. - "Recording list sort order" (`sort-order`): "Newest first", "Oldest first", "By name". Saves `recordingListSortOrder`. - "Items per page" (`items-per-page`): a whole number from 10 to 100. Values outside the range are ignored and nothing is saved. Saves `itemsPerPage`. - "Theme" (`theme`): "Light", "Dark", "System". Applies at once and is saved (section 6). diff --git a/spec/ui-library.md b/spec/ui-library.md index 819d030..8f9537c 100644 --- a/spec/ui-library.md +++ b/spec/ui-library.md @@ -334,6 +334,7 @@ The player card has `data-testid="player"`. It contains: - Starting values come from the user's defaults: playback speed, volume (default 75), and auto-play next (when a recording ends, the next row in the list is selected if there is one). + With `autoPlayNext` enabled while the library is open, ending audio selects and plays the next recording in the current filtered and sorted list, including rows beyond the loaded page. The last row stops without wrapping; an ended recording outside that list does not advance. Turning the setting off or leaving the library removes the end listener. - Download menu (the download icon in the header on the library preview; hidden on the detail page, where the actions menu does this): "Download MP3" and "Download original" (`download-original`). "Download MP3" saves the converted file; "Download original" diff --git a/web/src/components/player/player-card.tsx b/web/src/components/player/player-card.tsx index 28022bc..b14d323 100644 --- a/web/src/components/player/player-card.tsx +++ b/web/src/components/player/player-card.tsx @@ -6,8 +6,9 @@ import { Card } from "@/components/ui/card"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { api } from "@/lib/api"; import { downloadRecordings } from "@/lib/downloads"; -import { formatBytes, formatClock } from "@/lib/format"; -import { intlLocale, useI18n } from "@/lib/i18n"; +import { formatBytes, formatClock, formatRecordingDate } from "@/lib/format"; +import { useI18n } from "@/lib/i18n"; +import { useShellData } from "@/components/shell/shell-data"; import { cn } from "@/lib/cn"; import { RECORDINGS_CHANGED } from "@/lib/recordings"; import { PLAYBACK_RATES, usePlayer } from "./player-context"; @@ -68,18 +69,18 @@ export function PlayerCard({ recording, onChanged, sectionRef, className, showHe ); } -/** "Oct 16, 2026 · 11:02 PM–11:02 PM", the start and end of the recording. */ -function recordedRange(startIso: string, durationMs: number): string { +/** The recording's start and end in the preferred date/time format. */ +function recordedRange(startIso: string, durationMs: number, dateTimeFormat: unknown): string { const start = new Date(startIso); const end = new Date(start.getTime() + durationMs); - const date = new Intl.DateTimeFormat(intlLocale(), { month: "short", day: "numeric", year: "numeric" }).format(start); - const time = new Intl.DateTimeFormat(intlLocale(), { hour: "numeric", minute: "2-digit" }); - return `${date} · ${time.format(start)}–${time.format(end)}`; + if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime())) return ""; + return `${formatRecordingDate(start, dateTimeFormat)}–${formatRecordingDate(end, dateTimeFormat)}`; } /** Title, recorded range, length and size, with the audio download on the right. */ function PlayerHeader({ recording }: { recording: PlayerCardRecording }) { const { t } = useI18n(); + const { settings } = useShellData(); const { id, filename, duration, startTime, filesize } = recording; const facts: string[] = [formatClock(duration / 1000)]; if (filesize) facts.push(formatBytes(filesize)); @@ -90,7 +91,7 @@ function PlayerHeader({ recording }: { recording: PlayerCardRecording }) {

{startTime ? ( - {t("library.player.recorded")} + {t("library.player.recorded")} ) : null} {facts.map((fact) => ( diff --git a/web/src/components/recording/details-card.tsx b/web/src/components/recording/details-card.tsx index 941d4f8..5b4b041 100644 --- a/web/src/components/recording/details-card.tsx +++ b/web/src/components/recording/details-card.tsx @@ -1,15 +1,17 @@ import { type ReactNode, useState } from "react"; import { ChevronUp } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { formatBytes, formatClock } from "@/lib/format"; +import { formatBytes, formatClock, formatRecordingDate } from "@/lib/format"; +import { useShellData } from "@/components/shell/shell-data"; import type { Recording } from "@/lib/recordings"; -import { intlLocale, t, useI18n } from "@/lib/i18n"; +import { t, useI18n } from "@/lib/i18n"; /** Read-only facts about the recording file */ export function DetailsCard({ recording }: { recording: Recording }) { const { t } = useI18n(); const [expanded, setExpanded] = useState(true); - const date = new Date(recording.startTime).toLocaleDateString(intlLocale()); + const { settings } = useShellData(); + const date = formatRecordingDate(recording.startTime, settings?.dateTimeFormat); const rows: [string, ReactNode][] = [ [t("recording.details.duration"), formatClock(recording.duration / 1000)], [t("recording.details.fileSize"), fileSize(recording)], diff --git a/web/src/components/recording/recording-header.tsx b/web/src/components/recording/recording-header.tsx index 8fea3cc..7fd0cdd 100644 --- a/web/src/components/recording/recording-header.tsx +++ b/web/src/components/recording/recording-header.tsx @@ -13,7 +13,8 @@ import { } from "@/components/ui/dropdown-menu"; import { errorMessage } from "@/lib/api"; import { downloadRecordings } from "@/lib/downloads"; -import { formatClock, formatDateTime } from "@/lib/format"; +import { formatClock, formatRecordingDate } from "@/lib/format"; +import { useShellData } from "@/components/shell/shell-data"; import { cn } from "@/lib/cn"; import { deleteRecording, type Recording, renameRecording, setStarred, sourceOf } from "@/lib/recordings"; import { buildSrt, buildTranscriptJson, buildVtt, downloadText, safeFileName } from "./exports"; @@ -90,8 +91,9 @@ export function RecordingHeader({ variant, recording, transcript, busy, onTransc const Heading = variant === "page" ? "h1" : "h2"; const hasTimeline = Boolean(transcript?.timeline?.length); + const { settings } = useShellData(); const meta = [ - formatDateTime(recording.startTime), + formatRecordingDate(recording.startTime, settings?.dateTimeFormat), formatClock(recording.duration / 1000), sourceOf(recording) === "upload" ? t("dashboard.sourceUpload") : t("dashboard.sourcePlaud"), ]; diff --git a/web/src/components/recordings/library-model.ts b/web/src/components/recordings/library-model.ts index 9a18f90..2ee073a 100644 --- a/web/src/components/recordings/library-model.ts +++ b/web/src/components/recordings/library-model.ts @@ -1,5 +1,5 @@ import { recordingStage, RECORDING_STAGE_LABELS, type RecordingStage } from "@/components/recording/pipeline-labels"; -import { formatDate, formatDuration, formatTime } from "@/lib/format"; +import { formatDate, formatDuration, formatRecordingDate } from "@/lib/format"; import { sourceOf, type Recording } from "@/lib/recordings"; import { t, tn, type MessageKey } from "@/lib/i18n"; @@ -187,25 +187,10 @@ export function statusOf(r: Recording): RowStatus { return { stage, label: t(RECORDING_STAGE_LABELS[stage]) }; } -/** Relative time in the row's meta line, for example "less than a minute ago" or "12 minutes ago". */ -export function formatAgo(value: string, now: number = Date.now()): string { - const time = Date.parse(value); - if (Number.isNaN(time)) return ""; - const seconds = Math.max(0, (now - time) / 1000); - if (seconds < 60) return t("library.lessThanMinute"); - const minutes = Math.floor(seconds / 60); - if (minutes < 60) return tn("library.minutesAgo", minutes); - const hours = Math.floor(minutes / 60); - if (hours < 24) return tn("library.hoursAgo", hours); - const days = Math.floor(hours / 24); - if (days < 30) return tn("library.daysAgo", days); - return formatDate(value, { dateStyle: "medium" }); -} - /** The row's full accessible name: name, starred, date, duration, source and status. */ -export function rowLabel(r: Recording): string { +export function rowLabel(r: Recording, dateTimeFormat?: unknown): string { const status = statusOf(r); - const when = `${formatDate(r.startTime, { month: "short", day: "numeric", year: "numeric" })}, ${formatTime(r.startTime)}`; + const when = formatRecordingDate(r.startTime, dateTimeFormat); return [r.filename, r.starredAt ? t("library.starred") : null, `${formatClipDuration(r.duration)}`, when, sourceLabel(r), status.label] .filter(Boolean) .join(", "); diff --git a/web/src/components/recordings/recording-row.tsx b/web/src/components/recordings/recording-row.tsx index 0e2b94e..df69eb7 100644 --- a/web/src/components/recordings/recording-row.tsx +++ b/web/src/components/recordings/recording-row.tsx @@ -6,9 +6,10 @@ import { RecordingStatusBadge } from "@/components/ui/status-badge"; import { recordingStage } from "@/components/recording/pipeline-labels"; import { cn } from "@/lib/cn"; import { downloadRecordings } from "@/lib/downloads"; -import { formatClock } from "@/lib/format"; +import { formatClock, formatRecordingDate } from "@/lib/format"; +import { useShellData } from "@/components/shell/shell-data"; import type { Recording } from "@/lib/recordings"; -import { formatAgo, rowLabel, sourceLabel } from "./library-model"; +import { rowLabel, sourceLabel } from "./library-model"; import { useI18n } from "@/lib/i18n"; export interface RowActions { @@ -40,7 +41,8 @@ export interface RecordingRowProps { */ export function RecordingRow({ recording: r, selected, selectMode, checked, compact, transcribing, onActivate, actions }: RecordingRowProps) { const stage = recordingStage(r); - const ago = formatAgo(r.startTime); + const { settings } = useShellData(); + const ago = formatRecordingDate(r.startTime, settings?.dateTimeFormat); const meta = ago ? `${ago} · ${sourceLabel(r)}` : sourceLabel(r); const onSelected = selected && !selectMode; @@ -48,7 +50,7 @@ export function RecordingRow({ recording: r, selected, selectMode, checked, comp

) : ( <> - 0} /> + 0} /> )} @@ -257,23 +257,28 @@ function RowStatus({ recording }: { recording: Recording }) { return ; } -function SetUp({ plaudDone, providerDone }: { plaudDone: boolean; providerDone: boolean }) { - if (plaudDone && providerDone) return null; +function SetUp({ plaudDone, plaudSkipped, providerDone }: { plaudDone: boolean; plaudSkipped: boolean; providerDone: boolean }) { + if ((plaudDone || plaudSkipped) && providerDone) return null; return (

{t("dashboard.setUp")}

    - +
); } -function SetUpRow({ done, title, to }: { done: boolean; title: string; to: string }): ReactNode { - const body = done ? ( +function SetUpRow({ done, skipped = false, title, to }: { done: boolean; skipped?: boolean; title: string; to: string }): ReactNode { + const body = skipped ? ( + <> +