[website] Personal Playground: Backup reminder UI #3162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #3157.
Motivation for the change, related issues
Personal Playgrounds store data in the browser's Origin Private File System (OPFS), which can be cleared unexpectedly by the browser. Users need a gentle reminder to back up their work periodically to avoid data loss.
This PR adds a backup status indicator that tracks usage days since the last backup and prompts users to download backups based on urgency.
Screenshots
(No button when the backup is up to date)
Implementation details
New files:
backup-status-indicator.tsx- Component showing days since last backup with color-coded urgency (green ≤1 day, yellow 2-4 days, red 5+ days)backup-status-indicator.module.css- Styles for the indicator buttonuse-backup.ts- Hook that handles backup creation usingzipWpContentandfile-saverModified files:
slice-sites.ts- Added metadata fields:backupHistory- Array of recent backups (filename + timestamp)lastAccessDate- Timestamp for tracking usage daysdaysUsedSinceLastBackup- Counter reset on backuppersistent-browser-chrome/index.tsx- Added BackupStatusIndicator to toolbarBehavior:
Testing Instructions (or ideally a Blueprint)
{site-name}-backup-{date}-{time}.zipdaysUsedSinceLastBackupto 5 - indicator should appear in red