Add servers as filter to pick entities in the EntityPicker flow (#3444)

This commit is contained in:
Bruno Pantaleão Gonçalves
2025-02-19 17:10:17 +01:00
committed by GitHub
parent ded3413817
commit 057c9d0845
7 changed files with 154 additions and 52 deletions

View File

@@ -90,7 +90,10 @@ struct ClientEventsLogView: View {
Button {
viewModel.resetTypeFilter()
} label: {
filterPill(L10n.ClientEvents.EventType.all, selected: viewModel.typeFilter == nil)
PillView(
text: L10n.ClientEvents.EventType.all,
selected: viewModel.typeFilter == nil
)
}
ForEach(ClientEvent.EventType.allCases.sorted { e1, e2 in
e1.displayText < e2.displayText
@@ -98,7 +101,10 @@ struct ClientEventsLogView: View {
Button {
viewModel.typeFilter = type
} label: {
filterPill(type.displayText, selected: viewModel.typeFilter == type)
PillView(
text: type.displayText,
selected: viewModel.typeFilter == type
)
}
}
}
@@ -124,15 +130,6 @@ struct ClientEventsLogView: View {
}
}
private func filterPill(_ text: String, selected: Bool) -> some View {
Text(text)
.foregroundStyle(selected ? .white : Color(uiColor: .label))
.padding(Spaces.one)
.padding(.horizontal)
.background(selected ? Color.asset(Asset.Colors.haPrimary) : Color.secondary.opacity(0.1))
.clipShape(Capsule())
}
private func listItem(_ event: ClientEvent) -> some View {
NavigationLink {
eventDescription(event)