3.4 KiB
3.4 KiB
Feature 4: Status Screen
Context
The status screen is the default view when the user clicks the tray icon. It gives a quick overview of backup health and provides shortcuts to key actions.
Dependencies
- Depends on: Feature 0 (config), Feature 1 (screen routing), Feature 3 (SchedulerState, BackupHistory)
- Depended on by: Feature 5 (Restore — navigated to from status screen)
Implementation Steps
Step 1: Create the StatusViewModel
Files to create:
composeApp/src/jvmMain/kotlin/com/rukira/wowbackup/ui/status/StatusViewModel.kt
Collects state from:
BackupScheduler.state(StateFlow) — last backup, next backup, running status, progress, WoW statusConfigManager.config(StateFlow) — to check if configuredBackupHistory.listBackups()— for backup count summary
Exposes a single StatusUiState:
data class StatusUiState(
val isConfigured: Boolean,
val lastBackupTime: String?, // human-readable relative time ("2 hours ago")
val lastBackupStatus: String?, // "Success" or "Failed: <reason>"
val nextBackupTime: String?, // "Today at 03:00" or "Tomorrow at 03:00"
val isWoWRunning: Boolean,
val forceBackupEnabled: Boolean,
val isBackupRunning: Boolean,
val backupProgress: BackupProgress?,
val totalBackups: Int,
)
Step 2: Build the StatusScreen composable
Files to create:
composeApp/src/jvmMain/kotlin/com/rukira/wowbackup/ui/status/StatusScreen.kt
Layout (Material3 Card-based):
Missing Config Warning (if !isConfigured)
- Warning banner: "Configuration incomplete. Set up WoW Backup to get started."
- "Open Settings" button
Last Backup Card
- Icon + "Last backup: 2 hours ago" (or "Never" if no backups)
- Status badge: green "Success" / red "Failed: reason"
Next Backup Card
- "Next backup: Today at 03:00"
- If WoW is running: yellow indicator "WoW is running" + note about force backup status
Backup Progress (if running)
LinearProgressIndicatorwith file count ("142 / 350 files")- Current file name (truncated)
Action Buttons Row
- Backup Now — triggers immediate backup (disabled if already running)
- Open Backup Folder — opens backup directory in OS file manager
- Settings — navigates to config screen
- Restore — navigates to restore screen
Step 3: "Open folder" utility
Files to create:
composeApp/src/jvmMain/kotlin/com/rukira/wowbackup/platform/DesktopActions.kt
object DesktopActions {
fun openFolder(path: File) {
Desktop.getDesktop().open(path)
}
}
Uses java.awt.Desktop.open() — works cross-platform.
Step 4: Wire into App.kt routing
Files to modify:
composeApp/src/jvmMain/kotlin/com/rukira/wowbackup/App.kt
Replace status placeholder with StatusScreen(viewModel, onNavigateToConfig, onNavigateToRestore).
Verification
- Status screen shows "Never backed up" on first run
- After a successful backup, shows correct time and "Success" status
- After a failed backup, shows failure reason in red
- While backup is running, progress bar and file count update live
- "Backup Now" triggers immediate backup
- "Open Backup Folder" opens the correct directory in Finder/Explorer
- "Settings" navigates to config screen
- "Restore" navigates to restore screen
- Missing config warning shows when config is incomplete
- WoW running indicator updates in real-time