Skip to content

Commit

Permalink
Remove search bolding. (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
bolsinga committed Jun 16, 2024
1 parent 785104b commit 7d98884
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 94 deletions.
3 changes: 1 addition & 2 deletions Sources/Site/Music/UI/ArtistList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ struct ArtistList: View {
items: digests, sectioner: sectioner,
title: String(localized: "Artists", bundle: .module),
associatedRankName: String(localized: "Sort By Venue Count", bundle: .module),
associatedRankSectionHeader: { $0.venuesCountView },
itemLabelView: { Text($0.name.emphasizedAttributed(matching: searchString)) }, sort: $sort
associatedRankSectionHeader: { $0.venuesCountView }, sort: $sort
)
.archiveSearchable(
searchPrompt: String(localized: "Artist Names", bundle: .module),
Expand Down
13 changes: 5 additions & 8 deletions Sources/Site/Music/UI/RankableSortList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

import SwiftUI

struct RankableSortList<T, SectionHeaderContent: View, LabelContent: View>: View
where T: Rankable, T.ID == String {
struct RankableSortList<T, SectionHeaderContent: View>: View where T: Rankable, T.ID == String {
let items: [T]
let sectioner: LibrarySectioner
let title: String
let associatedRankName: String
@ViewBuilder let associatedRankSectionHeader: (Ranking) -> SectionHeaderContent
@ViewBuilder let itemLabelView: ((T) -> LabelContent)

@Binding var sort: RankingSort

Expand All @@ -28,14 +26,14 @@ where T: Rankable, T.ID == String {
items: items,
rankingMapBuilder: { sectioner.sectionMap(for: $0) },
itemContentView: { showCount(for: $0) },
sectionHeaderView: { $0.representingView }, itemLabelView: itemLabelView)
sectionHeaderView: { $0.representingView })
} else if sort.isFirstSeen {
RankingList(
items: items,
rankingMapBuilder: { $0.firstSeen },
rankSorted: PartialDate.compareWithUnknownsMuted(lhs:rhs:),
itemContentView: { Text($0.firstSet.rank.formatted(.hash)) },
sectionHeaderView: { Text($0.formatted(.compact)) }, itemLabelView: itemLabelView)
sectionHeaderView: { Text($0.formatted(.compact)) })
} else {
RankingList(
items: items,
Expand All @@ -48,7 +46,7 @@ where T: Rankable, T.ID == String {
default:
$0.sectionHeader(for: sort)
}
}, itemLabelView: itemLabelView)
})
}
}

Expand All @@ -71,8 +69,7 @@ where T: Rankable, T.ID == String {
RankableSortList(
items: vaultPreviewData.venueDigests, sectioner: vaultPreviewData.sectioner,
title: "Venues", associatedRankName: "Sort By Artist Count",
associatedRankSectionHeader: { $0.artistsCountView }, itemLabelView: { Text($0.name) },
sort: .constant(.alphabetical)
associatedRankSectionHeader: { $0.artistsCountView }, sort: .constant(.alphabetical)
)
.musicDestinations(vaultPreviewData)
}
Expand Down
11 changes: 4 additions & 7 deletions Sources/Site/Music/UI/RankingList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

import SwiftUI

struct RankingList<T, R, ItemContent: View, SectionHeader: View, LabelContent: View>: View
struct RankingList<T, R, ItemContent: View, SectionHeader: View>: View
where T: LibraryComparable, T: Hashable, T: PathRestorable, R: Comparable, R: Hashable {
let items: [T]
let rankingMapBuilder: ([T]) -> [R: [T]]
var rankSorted: ((R, R) -> Bool)?
@ViewBuilder let itemContentView: (T) -> ItemContent
@ViewBuilder let sectionHeaderView: (R) -> SectionHeader
@ViewBuilder let itemLabelView: ((T) -> LabelContent)

var body: some View {
let rankingMap = rankingMapBuilder(items)
Expand All @@ -27,7 +26,7 @@ where T: LibraryComparable, T: Hashable, T: PathRestorable, R: Comparable, R: Ha
LabeledContent {
itemContentView(item)
} label: {
itemLabelView(item)
Text(item.name)
}
}
}
Expand All @@ -54,8 +53,7 @@ where T: LibraryComparable, T: Hashable, T: PathRestorable, R: Comparable, R: Ha
},
sectionHeaderView: { section in
Text("Artists")
},
itemLabelView: { Text($0.name) }
}
)
.navigationTitle("Artists")
.musicDestinations(vaultPreviewData)
Expand All @@ -72,8 +70,7 @@ where T: LibraryComparable, T: Hashable, T: PathRestorable, R: Comparable, R: Ha
itemContentView: { _ in },
sectionHeaderView: { section in
Text("Venues")
},
itemLabelView: { Text($0.name) }
}
)
.navigationTitle("Venues")
.musicDestinations(vaultPreviewData)
Expand Down
3 changes: 1 addition & 2 deletions Sources/Site/Music/UI/VenueList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ struct VenueList: View {
items: digests, sectioner: sectioner,
title: String(localized: "Venues", bundle: .module),
associatedRankName: String(localized: "Sort By Artist Count", bundle: .module),
associatedRankSectionHeader: { $0.artistsCountView },
itemLabelView: { Text($0.name.emphasizedAttributed(matching: searchString)) }, sort: $sort
associatedRankSectionHeader: { $0.artistsCountView }, sort: $sort
)
.archiveSearchable(
searchPrompt: String(localized: "Venue Names", bundle: .module),
Expand Down
35 changes: 0 additions & 35 deletions Sources/Site/Utility/String+EmphasizedMatching.swift

This file was deleted.

40 changes: 0 additions & 40 deletions Tests/SiteTests/EmphasizedMatchingTests.swift

This file was deleted.

0 comments on commit 7d98884

Please sign in to comment.