Improved navigation. Search tags
MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/SearchBarViewModel.cs
WalletWasabi.Fluent/ViewModels/SearchBar/SearchBarViewModel.cs
using System.Collections.ObjectModel;
+using System.Linq;
using System.Reactive.Linq;
using DynamicData;
using ReactiveUI;
@@ -40,5 +41,18 @@ public class SearchBarViewModel : ReactiveObject
set => this.RaiseAndSetIfChanged(ref _searchText, value);
}
- private static Func<SearchItem, bool> SearchItemFilterFunc(string text) => searchItem => string.IsNullOrEmpty(text) || searchItem.Name.ToLower().Contains(text.ToLower());
+ private static Func<SearchItem, bool> SearchItemFilterFunc(string? text)
+ {
+ return searchItem =>
+ {
+ if (text is null)
+ {
+ return true;
+ }
+
+ var containsName = searchItem.Name.Contains(text, StringComparison.InvariantCultureIgnoreCase);
+ var containsAnyTag = searchItem.Keywords.Any(s => s.Contains(text, StringComparison.InvariantCultureIgnoreCase));
+ return containsName || containsAnyTag;
+ };
+ }
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItem.cs
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItem.cs
+using System.Collections.Generic;
+using System.Linq;
using System.Windows.Input;
namespace WalletWasabi.Fluent.ViewModels.SearchBar;
@@ -6,12 +8,13 @@ public class SearchItem
{
public ICommand Command { get; }
- public SearchItem(string name, string description, ICommand command, string category)
+ public SearchItem(string name, string description, ICommand command, string category, IEnumerable<string>? keywords = null)
{
Name = name;
Description = description;
Command = command;
Category = category;
+ Keywords = keywords ?? Enumerable.Empty<string>();
}
public string Name { get; }
@@ -19,4 +22,5 @@ public class SearchItem
public ComposedKey Key => new(Name);
public string Icon { get; set; }
public string Category { get; }
+ public IEnumerable<string> Keywords { get; }
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItemProvider.cs
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItemProvider.cs
@@ -14,7 +14,10 @@ public static class SearchItemProvider
.Select(m =>
{
var command = CreateCommand(m);
- var searchItem = new SearchItem(m.Title, m.Caption, command, m.Category ?? "No category"){ Icon = m.IconName };
+ var searchItem = new SearchItem(m.Title, m.Caption, command, m.Category ?? "No category", m.Keywords)
+ {
+ Icon = m.IconName,
+ };
return searchItem;
});
@@ -28,6 +31,10 @@ public static class SearchItemProvider
return ReactiveCommand.CreateFromTask(async () =>
{
var vm = await NavigationManager.MaterialiseViewModelAsync(navigationMetaData);
+ if (vm is null)
+ {
+ return;
+ }
Navigate(vm.DefaultTarget).To(vm);
});
}

MODIFY
WalletWasabi.Fluent/Views/SearchBar/SearchBarDropdown.axaml
WalletWasabi.Fluent/Views/SearchBar/SearchBarDropdown.axaml
<searchBar:SearchBarDesignViewModel />
</Design.DataContext>
+ <UserControl.Styles>
+ <Style Selector="Button">
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ <Setter Property="VerticalAlignment" Value="Stretch" />
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate>
+ <ContentPresenter Content="{TemplateBinding Content}" />
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </UserControl.Styles>
+
<ScrollViewer>
<ItemsControl Items="{Binding Groups}">
<ItemsControl.ItemTemplate>

Improved navigation. Search tags