Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>

This commit is contained in:
Matt Bruce 2025-09-08 15:18:32 -05:00
parent 102b0b7c05
commit 0baed76275

View File

@ -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)