From 0baed76275f9f57f03ff1a55642cc418d69166d2 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 8 Sep 2025 15:18:32 -0500 Subject: [PATCH] Signed-off-by: Matt Bruce --- .../Noise/Components/SoundCategoryView.swift | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/TheNoiseClock/Views/Noise/Components/SoundCategoryView.swift b/TheNoiseClock/Views/Noise/Components/SoundCategoryView.swift index 2047591..3e341c6 100644 --- a/TheNoiseClock/Views/Noise/Components/SoundCategoryView.swift +++ b/TheNoiseClock/Views/Noise/Components/SoundCategoryView.swift @@ -35,6 +35,17 @@ struct SoundCategoryView: View { } } + // MARK: - Helper Methods + private func getCategoryCount(for category: String) -> Int { + let nonAlarmSounds = sounds.filter { $0.category != "alarm" } + + if category == "all" { + return nonAlarmSounds.count + } else { + return nonAlarmSounds.filter { $0.category == category }.count + } + } + private var categories: [String] { let nonAlarmSounds = sounds.filter { $0.category != "alarm" } let uniqueCategories = Set(nonAlarmSounds.map { $0.category }) @@ -78,6 +89,9 @@ struct SoundCategoryView: View { TextField("Search sounds...", text: $searchText) .textFieldStyle(.plain) + .foregroundColor(.primary) + .autocorrectionDisabled() + .textInputAutocapitalization(.never) } .padding(.horizontal, UIConstants.Spacing.medium) .padding(.vertical, UIConstants.Spacing.small) @@ -92,7 +106,7 @@ struct SoundCategoryView: View { CategoryTab( title: categoryDisplayName(category), isSelected: selectedCategory == category, - count: category == "all" ? filteredSounds.count : sounds.filter { $0.category == category && $0.category != "alarm" }.count + count: getCategoryCount(for: category) ) { selectedCategory = category } @@ -182,7 +196,7 @@ struct SoundCard: View { if isPreviewing { Circle() - .stroke(Color.orange, lineWidth: 2) + .stroke(UIConstants.Colors.accentColor, lineWidth: 2) .frame(width: 58, height: 58) .scaleEffect(1.02) .animation(.easeInOut(duration: 0.5).repeatForever(autoreverses: true), value: isPreviewing)