feat: enhance backup status display and tracking

Added a visual indicator for backups saved today in the admin interface. Updated the backup status type to include a boolean for today's backup existence, and modified relevant components to reflect this change. Enhanced tests to verify the new functionality.
This commit is contained in:
blake committed 2026-10-23 17:27:37 -05:00
1 parent 747e6e25e0
commit bf661673c9
6 files changed
+71 -7

No files matched your search

+14 -2
View File
@@ -169,6 +169,7 @@ export function AdminHome(props: {
exportError?: string;
backupNote: string;
backupState: 'saved' | 'waiting' | 'behind';
backupSavedToday: boolean;
newEvent?: { values: EventValues; error?: string };
}) {
const draft = props.newEvent?.values ?? {
@@ -186,8 +187,8 @@ export function AdminHome(props: {
<p class="desk-signed">
Signed in as <strong>{props.name}</strong>.
</p>
<p class="desk-note">
<BackupNote text={props.backupNote} />
<p class={props.backupSavedToday ? 'desk-note is-saved' : 'desk-note'}>
{props.backupSavedToday ? <BackupSavedToday /> : <BackupNote text={props.backupNote} />}
</p>
</header>
<Notice notice={props.notice} />
@@ -1550,6 +1551,17 @@ function LoginForm(props: { config: AppConfig; error?: string }) {
);
}
function BackupSavedToday() {
return (
<>
<svg class="desk-note-check" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
<path d="M3.2 8.4 6.4 11.5 12.8 4.8" />
</svg>
Backup saved today
</>
);
}
function BackupNote(props: { text: string }) {
const match = /^(.*?)([A-Z][a-z]+ \d{1,2}, \d{4})(.*)$/.exec(props.text);
if (!match) return <>{props.text}</>;