Overhaul Compose UI with sidebar navigation and component architecture#48
Overhaul Compose UI with sidebar navigation and component architecture#48
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restructure the monolithic 1,348-line App.kt into a modular component architecture with proper separation of concerns: - Add Motrix-style left sidebar navigation with status filters and task counts - Introduce custom Material 3 dark/light theme with brand color palette - Extract centralized AppState for UI state management - Split download list items into composable components (progress, actions, toggles) - Add collapsible toggle icons for speed limit, priority, schedule, and task info - Add bottom status bar showing backend info and download speed - Add comprehensive tests for format utilities and status filter logic Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 401b5ea3d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| val filteredTasks by remember( | ||
| sortedTasks, appState.statusFilter | ||
| ) { | ||
| derivedStateOf { |
There was a problem hiding this comment.
Recompute filtered task data on state transitions
filteredTasks is wrapped in remember { derivedStateOf { ... } } but the predicate reads taskStates, which is a plain MutableMap and not Compose snapshot state. When a task changes from e.g. Downloading to Completed (without being added/removed), this derived value is not invalidated, so the filtered list (and similarly the count/summary derived blocks below) can stay stale until some unrelated key changes like switching filters.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Summary
- Fixed
AppShellto rebuildtaskStatesfrom currentsortedTaskseach composition instead of mutating a long-lived state map, which naturally prunes removed task IDs and prevents stale deleted-task state from lingering. app/shared/src/commonMain/kotlin/com/linroid/kdown/app/ui/AppShell.ktL63-L68 - Updated
filteredTasksto useremember(sortedTasks, taskStates, appState.statusFilter)so filtering correctly recomputes when task state transitions happen without list membership changes. app/shared/src/commonMain/kotlin/com/linroid/kdown/app/ui/AppShell.ktL70-L82 - Updated derived sidebar/action summaries (
taskCounts,hasActive,hasPaused) to depend on currenttaskStates, keeping counts and batch-action visibility in sync with live state changes. app/shared/src/commonMain/kotlin/com/linroid/kdown/app/ui/AppShell.ktL84-L103
Testing
- ✅
curl -I https://developer.android.com/jetpack/compose/state | head - ❌
./gradlew :app:shared:allTests(failed: Gradle could not resolveorg.gradle.toolchains.foojay-resolver-convention:1.0.0from configured plugin repositories)
Committed on branch work with commit 75019fb, and I also created the follow-up PR via the make_pr tool.
| sortedTasks.forEach { task -> | ||
| val state by task.state.collectAsState() | ||
| taskStates[task.taskId] = state |
There was a problem hiding this comment.
Prune removed tasks from the cached state map
taskStates only ever inserts/updates entries and never removes IDs that disappeared from sortedTasks. After a task is deleted, its last state remains in the map, so sidebar counts, batch-action visibility, and speed/active aggregates can include tasks that no longer exist.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Summary
- Updated
AppShellto stop mutating a long-lived cachedtaskStatesmap during composition; it now rebuilds a freshtaskId -> DownloadStatemap from currentsortedTasks, which naturally drops removed tasks and avoids stale deleted entries. app/shared/src/commonMain/kotlin/com/linroid/kdown/app/ui/AppShell.ktL63-L67 - Updated
filteredTasksderivation to be remembered with explicit dependencies (sortedTasks,taskStates, andstatusFilter) so filter results recompute correctly when task states transition without list membership changes. app/shared/src/commonMain/kotlin/com/linroid/kdown/app/ui/AppShell.ktL69-L85 - Updated task-count and batch-action summary derivations (
taskCounts,hasActive,hasPaused) to key off currenttaskStates, ensuring sidebar counts and action visibility stay in sync with live state transitions. app/shared/src/commonMain/kotlin/com/linroid/kdown/app/ui/AppShell.ktL87-L106
Testing
⚠️ ./gradlew :app:shared:allTests(failed in this environment because Gradle could not resolveorg.gradle.toolchains.foojay-resolver-convention:1.0.0from configured plugin repositories).- ✅
curl -I https://plugins.gradle.org/m2/(web check executed successfully).
- Include Idle state in Downloading filter so sub-counts sum to All - Use mutableStateMapOf for reactive task state tracking and clean stale entries - Use Card onClick instead of Modifier.clickable for proper ripple clipping - Reorder sidebar filters: All, Downloading, Completed, Paused, Failed - Add copy-to-clipboard button on URL row in task info panel Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Calculate bytesPerSecond in DownloadCoordinator.buildContext using elapsed time delta (sampled every 500ms) and pass it to DownloadProgress. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace four independent AnimatedVisibility blocks with a single AnimatedContent keyed on the expanded panel enum, so panel transitions crossfade smoothly without intermediate height changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
App.ktinto 25+ modular components with proper separation of concernsAppStateclass for UI state managementTest plan
./gradlew :app:shared:allTests🤖 Generated with Claude Code