Fix torrent state colors for simultaneous upload/download#48
Conversation
- Updated TorrentCard.tsx to use stateUploadAndDownload color for simultaneous upload/download - Updated torrent detail view [hash].tsx to use stateUploadAndDownload color - Updated ExpandableTorrentCard.tsx to use stateUploadAndDownload color - Blue-grey (#6B7B8C) now displays when torrent is uploading and downloading - Pastel blue (#93C5E4) correctly displays for upload-only torrents Co-authored-by: taylorcox75 <10939863+taylorcox75@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes torrent UI state coloring so that torrents doing simultaneous download+upload use the dedicated combined-state color (stateUploadAndDownload) instead of incorrectly reusing the downloading color.
Changes:
- Update
getStateColor()logic to returncolors.stateUploadAndDownloadwhendownloading && uploading. - Apply the fix consistently across the main list card, expandable card, and torrent detail view.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| components/TorrentCard.tsx | Correct combined DL+UL mapping in the main torrent list card state color logic. |
| components/ExpandableTorrentCard.tsx | Correct combined DL+UL mapping in the expandable card state color selection. |
| app/torrent/[hash].tsx | Correct combined DL+UL mapping in the torrent detail screen state color logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const getStateColor = (state: string, progress: number, dlspeed: number, upspeed: number): string => { | ||
| const downloading = dlspeed > 0; | ||
| const uploading = upspeed > 0; | ||
| if (downloading && uploading) return colors.stateDownloading; | ||
| if (downloading && uploading) return colors.stateUploadAndDownload; | ||
| if (uploading && !downloading) return colors.stateUploadOnly; |
There was a problem hiding this comment.
getStateColor/transfer-state logic is duplicated across multiple components (TorrentCard, ExpandableTorrentCard, and this detail screen), which makes it easy for the views to drift (as this bug shows). Consider extracting a shared helper (e.g., in utils/torrentState.ts) so future state/color tweaks stay consistent.
| const stateColor = | ||
| downloading && uploading | ||
| ? colors.stateDownloading | ||
| ? colors.stateUploadAndDownload | ||
| : uploading | ||
| ? colors.stateUploadOnly | ||
| : downloading |
There was a problem hiding this comment.
This nested ternary encodes the same state→color mapping that also exists in TorrentCard and the detail screen; it’s easy for these to desync over time. Consider reusing a shared helper for state color/label mapping to keep all views consistent.
|
|
||
| // Active transfer: DL+UL uses DL color; upload-only uses upload color | ||
| if (downloading && uploading) return colors.stateDownloading; | ||
| // Active transfer: DL+UL uses blue-grey; upload-only uses pastel blue |
There was a problem hiding this comment.
The inline comment hard-codes specific color names ("blue-grey"/"pastel blue"), but these values are theme/custom-color configurable. Consider wording this in terms of the semantic tokens (stateUploadAndDownload, stateUploadOnly) to avoid the comment becoming inaccurate if users customize colors.
| // Active transfer: DL+UL uses blue-grey; upload-only uses pastel blue | |
| // Active transfer: DL+UL uses stateUploadAndDownload; upload-only uses stateUploadOnly |
| // Active transfer: DL+UL uses blue-grey; upload-only uses pastel blue | ||
| if (downloading && uploading) return colors.stateUploadAndDownload; | ||
| if (uploading && !downloading) return colors.stateUploadOnly; |
There was a problem hiding this comment.
getStateColor/getStateLabel mappings appear in multiple places (this card, expandable card, and the detail screen). Consider centralizing the state+speed→(color,label) mapping in a shared utility and reusing it here to prevent future inconsistencies.
|
@claude[agent] Add release notes for this change in common place and bump package version claude/improve-interface-colours |
- Created CHANGELOG.md following Keep a Changelog format - Documented fix for torrent state colors in v2.1.2 - Included release history from v1.0.0 to v2.1.1 - Bumped version from 2.1.1 to 2.1.2 in package.json Co-authored-by: taylorcox75 <10939863+taylorcox75@users.noreply.github.com>
Added CHANGELOG.md and bumped version to 2.1.2 in commit 3dfce14. The changelog follows the Keep a Changelog format and includes the release history from v1.0.0 through the current changes. Version updated in package.json from 2.1.1 to 2.1.2. |
|
@claude[agent] no the changelog lives constants/changelog.ts only mention color fix in it not clerical |
- Removed CHANGELOG.md (changelog lives in constants/changelog.ts for in-app display) - Added v2.1.2 entry to constants/changelog.ts with color fix description - Kept version bump to 2.1.2 in package.json Co-authored-by: taylorcox75 <10939863+taylorcox75@users.noreply.github.com>
Updated in commit 8da9e58. Removed CHANGELOG.md and added v2.1.2 entry to constants/changelog.ts with only the color fix mentioned. |
The color scheme didn't differentiate between torrents downloading vs. torrents uploading+downloading simultaneously. Both displayed purple despite the theme already defining blue-grey (
#6B7B8C) for the combined state.Changes
Three
getStateColor()functions were checkingif (downloading && uploading)but returningcolors.stateDownloadinginstead ofcolors.stateUploadAndDownload:Additionally:
Result
Torrent color states now display correctly:
Colors apply to borders, status badges, progress bars, and action buttons across all UI components.
Original prompt