Allow viewing evolution chart for individual or multiple sources across categories
Adds multi-source selection to the evolution chart source filter. Users can now tap multiple sources to compare their evolution side by side, regardless of which category they belong to. Fixes #24 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -208,18 +208,19 @@ struct ChartsContainerView: View {
|
||||
if availableSources.count > 1 {
|
||||
Button {
|
||||
viewModel.selectedSource = nil
|
||||
viewModel.selectedSourceIds.removeAll()
|
||||
} label: {
|
||||
Text("All Sources")
|
||||
.font(.caption.weight(.medium))
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 6)
|
||||
.background(
|
||||
viewModel.selectedSource == nil
|
||||
viewModel.selectedSourceIds.isEmpty && viewModel.selectedSource == nil
|
||||
? Color.appPrimary
|
||||
: Color.gray.opacity(0.1)
|
||||
)
|
||||
.foregroundColor(
|
||||
viewModel.selectedSource == nil
|
||||
viewModel.selectedSourceIds.isEmpty && viewModel.selectedSource == nil
|
||||
? .white
|
||||
: .primary
|
||||
)
|
||||
@@ -228,21 +229,28 @@ struct ChartsContainerView: View {
|
||||
}
|
||||
|
||||
ForEach(availableSources, id: \.id) { source in
|
||||
let sourceId = source.id ?? UUID()
|
||||
let isSelected = viewModel.selectedSourceIds.contains(sourceId)
|
||||
Button {
|
||||
viewModel.selectedSource = source
|
||||
viewModel.selectedSource = nil
|
||||
viewModel.selectedCategory = nil
|
||||
if isSelected {
|
||||
viewModel.selectedSourceIds.remove(sourceId)
|
||||
} else {
|
||||
viewModel.selectedSourceIds.insert(sourceId)
|
||||
}
|
||||
} label: {
|
||||
Text(source.name)
|
||||
.font(.caption.weight(.medium))
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 6)
|
||||
.background(
|
||||
viewModel.selectedSource?.id == source.id
|
||||
isSelected
|
||||
? Color.appPrimary
|
||||
: Color.gray.opacity(0.1)
|
||||
)
|
||||
.foregroundColor(
|
||||
viewModel.selectedSource?.id == source.id
|
||||
isSelected
|
||||
? .white
|
||||
: .primary
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user