Skip to content

Commit b367cdb

Browse files
committed
PluginStoreSorting: Add dropdown for sorting options
- Added new row in header - Added dropdown menu to that new row - Added localized options: "Name", "Release Date," "Updated Date" as well as a localized label "Sorting Mode:" No functionality added, only ui changes.
1 parent 3e320d5 commit b367cdb

3 files changed

Lines changed: 135 additions & 65 deletions

File tree

Flow.Launcher/Languages/en.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@
242242
<system:String x:Key="pluginStore_RecentlyUpdated">Recently Updated</system:String>
243243
<system:String x:Key="pluginStore_None">Plugins</system:String>
244244
<system:String x:Key="pluginStore_Installed">Installed</system:String>
245+
<system:String x:Key="PluginStoreSortModeDefault">Default</system:String>
246+
<system:String x:Key="PluginStoreSortModeName">Name</system:String>
247+
<system:String x:Key="PluginStoreSortModeReleaseDate">Release Date</system:String>
248+
<system:String x:Key="PluginStoreSortModeUpdatedDate">Updated Date</system:String>
249+
<system:String x:Key="PluginStoreSortingModeComboboxLabel">Sorting Mode:</system:String>
245250
<system:String x:Key="refresh">Refresh</system:String>
246251
<system:String x:Key="installbtn">Install</system:String>
247252
<system:String x:Key="uninstallbtn">Uninstall</system:String>

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@ namespace Flow.Launcher.SettingPages.ViewModels;
1212

1313
public partial class SettingsPanePluginStoreViewModel : BaseModel
1414
{
15+
public class SortModeData : DropdownDataGeneric<PluginStoreSortMode> { }
16+
17+
public List<SortModeData> SortModes { get; } =
18+
DropdownDataGeneric<PluginStoreSortMode>.GetValues<SortModeData>("PluginStoreSortMode");
19+
20+
public SettingsPanePluginStoreViewModel()
21+
{
22+
UpdateEnumDropdownLocalizations();
23+
}
24+
25+
private PluginStoreSortMode _selectedSortMode = PluginStoreSortMode.Default;
26+
public PluginStoreSortMode SelectedSortMode
27+
{
28+
get => _selectedSortMode;
29+
set
30+
{
31+
if (_selectedSortMode != value)
32+
{
33+
_selectedSortMode = value;
34+
OnPropertyChanged();
35+
}
36+
}
37+
}
38+
1539
private string filterText = string.Empty;
1640
public string FilterText
1741
{
@@ -168,4 +192,18 @@ public bool SatisfiesFilter(PluginStoreItemViewModel plugin)
168192
App.API.FuzzySearch(FilterText, plugin.Name).IsSearchPrecisionScoreMet() ||
169193
App.API.FuzzySearch(FilterText, plugin.Description).IsSearchPrecisionScoreMet();
170194
}
195+
196+
private void UpdateEnumDropdownLocalizations()
197+
{
198+
DropdownDataGeneric<PluginStoreSortMode>.UpdateLabels(SortModes);
199+
}
200+
201+
}
202+
203+
public enum PluginStoreSortMode
204+
{
205+
Default,
206+
Name,
207+
ReleaseDate,
208+
UpdatedDate
171209
}

Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml

Lines changed: 92 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<ColumnDefinition Width="*" />
3333
</Grid.ColumnDefinitions>
3434
<Grid.RowDefinitions>
35-
<RowDefinition Height="72" />
35+
<RowDefinition Height="Auto" />
3636
<RowDefinition Height="*" />
3737
</Grid.RowDefinitions>
3838
<Border
@@ -50,77 +50,104 @@
5050
<DockPanel
5151
Grid.Row="0"
5252
Grid.Column="1"
53-
Margin="5 24 0 0">
54-
53+
Margin="5 24 0 8">
5554
<ikw:SimpleStackPanel
5655
HorizontalAlignment="Right"
5756
VerticalAlignment="Center"
5857
DockPanel.Dock="Right"
59-
Orientation="Horizontal"
58+
Orientation="Vertical"
6059
Spacing="8">
61-
<Button
62-
Height="34"
63-
Margin="0 5 0 5"
64-
Padding="12 4"
60+
<ikw:SimpleStackPanel
6561
HorizontalAlignment="Right"
66-
VerticalAlignment="Center"
67-
Command="{Binding RefreshExternalPluginsCommand}"
68-
Content="{DynamicResource refresh}"
69-
FontSize="13" />
70-
<Button Height="34">
71-
<ui:FontIcon FontSize="14" Glyph="&#xe71c;" />
72-
<ui:FlyoutService.Flyout>
73-
<ui:MenuFlyout x:Name="FilterFlyout" Placement="Bottom">
74-
<MenuItem
75-
Header=".Net"
76-
IsCheckable="True"
77-
IsChecked="{Binding ShowDotNet, Mode=TwoWay}"
78-
StaysOpenOnClick="True" />
79-
<MenuItem
80-
Header="Python"
81-
IsCheckable="True"
82-
IsChecked="{Binding ShowPython, Mode=TwoWay}"
83-
StaysOpenOnClick="True" />
84-
<MenuItem
85-
Header="Node.js"
86-
IsCheckable="True"
87-
IsChecked="{Binding ShowNodeJs, Mode=TwoWay}"
88-
StaysOpenOnClick="True" />
89-
<MenuItem
90-
Header="Exe"
91-
IsCheckable="True"
92-
IsChecked="{Binding ShowExecutable, Mode=TwoWay}"
93-
StaysOpenOnClick="True" />
94-
</ui:MenuFlyout>
95-
</ui:FlyoutService.Flyout>
96-
</Button>
97-
<Button
98-
Height="34"
99-
Command="{Binding InstallPluginCommand}"
100-
ToolTip="{DynamicResource installLocalPluginTooltip}">
101-
<ui:FontIcon FontSize="14" Glyph="&#xE8DA;" />
102-
</Button>
103-
<Button
104-
Height="34"
105-
Command="{Binding CheckPluginUpdatesCommand}"
106-
ToolTip="{DynamicResource checkPluginUpdatesTooltip}">
107-
<ui:FontIcon FontSize="14" Glyph="&#xecc5;" />
108-
</Button>
109-
<TextBox
110-
Name="PluginStoreFilterTextbox"
111-
Width="150"
112-
Height="34"
113-
Margin="0 0 26 0"
62+
Orientation="Horizontal"
63+
Spacing="8">
64+
<Button
65+
Height="34"
66+
Padding="12 4"
67+
HorizontalAlignment="Right"
68+
VerticalAlignment="Center"
69+
Command="{Binding RefreshExternalPluginsCommand}"
70+
Content="{DynamicResource refresh}"
71+
FontSize="13" />
72+
<Button Height="34">
73+
<ui:FontIcon FontSize="14" Glyph="&#xe71c;" />
74+
<ui:FlyoutService.Flyout>
75+
<ui:MenuFlyout x:Name="FilterFlyout" Placement="Bottom">
76+
<MenuItem
77+
Header=".Net"
78+
IsCheckable="True"
79+
IsChecked="{Binding ShowDotNet, Mode=TwoWay}"
80+
StaysOpenOnClick="True" />
81+
<MenuItem
82+
Header="Python"
83+
IsCheckable="True"
84+
IsChecked="{Binding ShowPython, Mode=TwoWay}"
85+
StaysOpenOnClick="True" />
86+
<MenuItem
87+
Header="Node.js"
88+
IsCheckable="True"
89+
IsChecked="{Binding ShowNodeJs, Mode=TwoWay}"
90+
StaysOpenOnClick="True" />
91+
<MenuItem
92+
Header="Exe"
93+
IsCheckable="True"
94+
IsChecked="{Binding ShowExecutable, Mode=TwoWay}"
95+
StaysOpenOnClick="True" />
96+
</ui:MenuFlyout>
97+
</ui:FlyoutService.Flyout>
98+
</Button>
99+
<Button
100+
Height="34"
101+
Command="{Binding InstallPluginCommand}"
102+
ToolTip="{DynamicResource installLocalPluginTooltip}">
103+
<ui:FontIcon FontSize="14" Glyph="&#xE8DA;" />
104+
</Button>
105+
<Button
106+
Height="34"
107+
Command="{Binding CheckPluginUpdatesCommand}"
108+
ToolTip="{DynamicResource checkPluginUpdatesTooltip}">
109+
<ui:FontIcon FontSize="14" Glyph="&#xecc5;" />
110+
</Button>
111+
<TextBox
112+
Name="PluginStoreFilterTextbox"
113+
Width="150"
114+
Height="34"
115+
Margin="0 0 26 0"
116+
HorizontalAlignment="Right"
117+
VerticalContentAlignment="Center"
118+
ui:ControlHelper.PlaceholderText="{DynamicResource searchplugin}"
119+
ContextMenu="{StaticResource TextBoxContextMenu}"
120+
DockPanel.Dock="Right"
121+
FontSize="14"
122+
Text="{Binding FilterText, UpdateSourceTrigger=PropertyChanged}"
123+
ToolTip="{DynamicResource searchpluginToolTip}"
124+
ToolTipService.InitialShowDelay="200"
125+
ToolTipService.Placement="Top" />
126+
</ikw:SimpleStackPanel>
127+
128+
<ikw:SimpleStackPanel
114129
HorizontalAlignment="Right"
115-
VerticalContentAlignment="Center"
116-
ui:ControlHelper.PlaceholderText="{DynamicResource searchplugin}"
117-
ContextMenu="{StaticResource TextBoxContextMenu}"
118-
DockPanel.Dock="Right"
119-
FontSize="14"
120-
Text="{Binding FilterText, UpdateSourceTrigger=PropertyChanged}"
121-
ToolTip="{DynamicResource searchpluginToolTip}"
122-
ToolTipService.InitialShowDelay="200"
123-
ToolTipService.Placement="Top" />
130+
Margin="0 0 26 0"
131+
Orientation="Horizontal"
132+
Spacing="8">
133+
<TextBlock
134+
VerticalAlignment="Center"
135+
FontSize="14"
136+
Foreground="{DynamicResource Color15B}"
137+
Text="{DynamicResource PluginStoreSortingModeComboboxLabel}" />
138+
<ComboBox
139+
x:Name="SortModeComboBox"
140+
Width="Auto"
141+
Height="34"
142+
MinWidth="150"
143+
MaxWidth="150"
144+
HorizontalContentAlignment="Left"
145+
Background="{DynamicResource Color00B}"
146+
ItemsSource="{Binding SortModes}"
147+
DisplayMemberPath="Display"
148+
SelectedValuePath="Value"
149+
SelectedValue="{Binding SelectedSortMode, Mode=TwoWay}"/>
150+
</ikw:SimpleStackPanel>
124151
</ikw:SimpleStackPanel>
125152
</DockPanel>
126153

0 commit comments

Comments
 (0)