Add manual download tags - #27
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a977bb5ca
ℹ️ 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".
| private var emptyTitle: String { | ||
| switch center.selectedSidebarSelection { |
There was a problem hiding this comment.
Preserve localized empty-state resources
When the selected sidebar item is one of the built-in filters, these branches now return a plain String; because Text(emptyTitle) receives a String variable, SwiftUI renders it verbatim instead of looking up the existing Localizable.xcstrings translations that were used when this was LocalizedStringResource. In Spanish/Italian locales the filter empty-state titles (and the same pattern in emptyDescription below) regress to English; keep the filter cases localized and only build a dynamic string for tag-specific text.
Useful? React with 👍 / 👎.
| let item: DownloadItem | ||
| let center: DownloadCenter | ||
|
|
||
| @State private var newTagText = "" |
There was a problem hiding this comment.
Reset draft tag on selection changes
When the inspector remains mounted and selectedDownload changes, SwiftUI preserves this @State across different item values, so a partially typed tag from the previous download stays in the field and pressing Add writes it to the newly selected download via center.setTags(for: item.id, ...). This occurs if a user types in the tag field, selects another row, then clicks Add; clear the draft on item changes or key the section by item.id.
Useful? React with 👍 / 👎.
| enum DownloadSidebarSelection: Hashable, Identifiable { | ||
| case filter(DownloadFilter) | ||
| case tag(String) |
There was a problem hiding this comment.
Canonicalize tag selection equality
The synthesized Hashable/Equatable for .tag(String) is case-sensitive, while tags are deduplicated and filtered case-insensitively elsewhere. If a selected tag's display casing changes, such as selecting Work and then adding a new work download that becomes the first available tag, the sidebar row is tagged .tag("work") but the selection remains .tag("Work"), so the current tag row loses its selected state even though the content is still filtered; compare tag selections canonically or repair the selection after additions.
Useful? React with 👍 / 👎.
Summary
Closes #9
Verification
xcodebuild -project Harbor.xcodeproj -scheme Harbor -configuration Debug -derivedDataPath /private/tmp/HarborDerivedData build