Skip to content

Commit 6a80bcd

Browse files
0x5bfayaira2
andcommitted
Updated the root item's UX
Co-Authored-By: Yair <[email protected]>
1 parent b9d2698 commit 6a80bcd

File tree

3 files changed

+49
-12
lines changed

3 files changed

+49
-12
lines changed

src/Files.App/UserControls/NavigationToolbar.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@
435435
<!-- Right Side Action Buttons -->
436436
<StackPanel
437437
Grid.Column="2"
438+
Margin="0,0,4,0"
438439
Orientation="Horizontal"
439440
Spacing="4">
440441

src/Files.App/UserControls/NavigationToolbar.xaml.cs

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,31 +273,67 @@ private async void Omnibar_TextChanged(Omnibar sender, OmnibarTextChangedEventAr
273273

274274
private async void BreadcrumbBar_ItemClicked(Controls.BreadcrumbBar sender, Controls.BreadcrumbBarItemClickedEventArgs args)
275275
{
276+
// Navigation to the current folder should not happen
277+
if (args.Index == ViewModel.PathComponents.Count - 1 ||
278+
ViewModel.PathComponents[args.Index].Path is not { } path)
279+
return;
280+
276281
if (args.IsRootItem)
277282
{
278283
await ViewModel.HandleItemNavigationAsync("Home");
279284
return;
280285
}
281286

282-
await ViewModel.HandleFolderNavigationAsync(ViewModel.PathComponents[args.Index].Path);
287+
await ViewModel.HandleFolderNavigationAsync(path);
283288
}
284289

285290
private async void BreadcrumbBar_ItemDropDownFlyoutOpening(object sender, BreadcrumbBarItemDropDownFlyoutEventArgs e)
286291
{
287292
if (e.IsRootItem)
288293
{
289-
// TODO: Populate a different flyout for the root item
294+
IHomeFolder homeFolder = new HomeFolder();
295+
290296
e.Flyout.Items.Add(new MenuFlyoutHeaderItem() { Text = "Quick access" });
291-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Desktop" });
292-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Download" });
293-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Documents" });
294-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Pictures" });
295-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Music" });
296-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Videos" });
297-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Recycle bin" });
297+
298+
await foreach (var storable in homeFolder.GetQuickAccessFolderAsync())
299+
{
300+
if (storable is not IWindowsStorable windowsStorable)
301+
continue;
302+
303+
var flyoutItem = new MenuFlyoutItem()
304+
{
305+
Text = windowsStorable.GetDisplayName(Windows.Win32.UI.Shell.SIGDN.SIGDN_PARENTRELATIVEFORUI),
306+
Icon = new FontIcon { Glyph = "\uE8B7" }, // Use font icon as placeholder
307+
};
308+
309+
e.Flyout.Items.Add(flyoutItem);
310+
311+
windowsStorable.TryGetThumbnail((int)(16f * App.AppModel.AppWindowDPI), Windows.Win32.UI.Shell.SIIGBF.SIIGBF_ICONONLY, out var thumbnailData);
312+
flyoutItem.Icon = new ImageIcon() { Source = await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() => thumbnailData.ToBitmapAsync(), Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal) };
313+
314+
windowsStorable.Dispose();
315+
}
316+
298317
e.Flyout.Items.Add(new MenuFlyoutHeaderItem() { Text = "Drives" });
299-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Local Disk (C:)" });
300-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Local Disk (D:)" });
318+
319+
await foreach (var storable in homeFolder.GetLogicalDrivesAsync())
320+
{
321+
if (storable is not IWindowsStorable windowsStorable)
322+
continue;
323+
324+
var flyoutItem = new MenuFlyoutItem()
325+
{
326+
Text = windowsStorable.GetDisplayName(Windows.Win32.UI.Shell.SIGDN.SIGDN_PARENTRELATIVEFORUI),
327+
Icon = new FontIcon { Glyph = "\uE8B7" }, // Use font icon as placeholder
328+
};
329+
330+
e.Flyout.Items.Add(flyoutItem);
331+
332+
windowsStorable.TryGetThumbnail((int)(16f * App.AppModel.AppWindowDPI), Windows.Win32.UI.Shell.SIIGBF.SIIGBF_ICONONLY, out var thumbnailData);
333+
flyoutItem.Icon = new ImageIcon() { Source = await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() => thumbnailData.ToBitmapAsync(), Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal) };
334+
335+
windowsStorable.Dispose();
336+
}
301337

302338
return;
303339
}

src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ public async Task SetPathBoxDropDownFlyoutAsync(MenuFlyout flyout, PathBoxItem p
859859
{
860860
Icon = new FontIcon { Glyph = "\uE8B7" }, // Use font icon as placeholder
861861
Text = childFolder.Item.Name,
862-
FontSize = 12,
862+
FontSize = 12
863863
};
864864

865865
if (workingPath != childFolder.Path)

0 commit comments

Comments
 (0)