From e2f5dd07a4e7871e7b8511543f55a704a43d8336 Mon Sep 17 00:00:00 2001 From: AL <26797547+Al12rs@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:56:48 +0200 Subject: [PATCH 1/9] Add loadout grid empty state message --- .../LoadoutGrid/ILoadoutGridViewModel.cs | 3 +- .../LoadoutGrid/LoadoutGridDesignViewModel.cs | 1 + .../Pages/LoadoutGrid/LoadoutGridView.axaml | 44 ++++++++++++----- .../LoadoutGrid/LoadoutGridView.axaml.cs | 13 +++-- .../Pages/LoadoutGrid/LoadoutGridViewModel.cs | 21 +++----- .../Resources/Language.Designer.cs | 48 ++++++++++++++----- src/NexusMods.App.UI/Resources/Language.resx | 7 +++ 7 files changed, 94 insertions(+), 43 deletions(-) diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/ILoadoutGridViewModel.cs b/src/NexusMods.App.UI/Pages/LoadoutGrid/ILoadoutGridViewModel.cs index 211a281ba0..c1c6f06b3a 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/ILoadoutGridViewModel.cs +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/ILoadoutGridViewModel.cs @@ -18,9 +18,8 @@ public interface ILoadoutGridViewModel : IPageViewModelInterface { public ReadOnlyObservableCollection Mods { get; } public LoadoutId LoadoutId { get; set; } - public string LoadoutName { get; } - public IMarkdownRendererViewModel MarkdownRendererViewModel { get; } + public string? EmptyModlistTitleMessage { get; } public ReadOnlyObservableCollection> Columns { get; } diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridDesignViewModel.cs b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridDesignViewModel.cs index a426685426..6ee3600b7c 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridDesignViewModel.cs +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridDesignViewModel.cs @@ -21,6 +21,7 @@ public class LoadoutGridDesignViewModel(IWindowManager windowManager) : APageVie public LoadoutId LoadoutId { get; set; } public string LoadoutName { get; } = "Design Loadout"; public IMarkdownRendererViewModel MarkdownRendererViewModel { get; } = new MarkdownRendererDesignViewModel(); + public string EmptyModlistTitleMessage { get; } = "No mods added to Game"; public ReadOnlyObservableCollection> Columns { get; } = new([]); public ModId[] SelectedItems { get; set; } = []; public ReactiveCommand ViewModContentsCommand { get; } = ReactiveCommand.Create(_ => Unit.Default); diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml index ca12bf0f54..a8efd90f33 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml @@ -20,35 +20,57 @@ - - + + - + - + - + x:Name="ModsDataGrid" /> + - + + + + + + + + + + + + + + + - + - diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml.cs b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml.cs index 15a55ab0e8..0a3491b28b 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml.cs +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml.cs @@ -19,8 +19,8 @@ public LoadoutGridView() InitializeComponent(); this.WhenActivated(d => { - this.OneWayBind(ViewModel, vm => vm.MarkdownRendererViewModel, - view => view.EmptyModlistMessageMarkdownViewer.ViewModel) + this.OneWayBind(ViewModel, vm => vm.EmptyModlistTitleMessage, + view => view.EmptyModlistTitleTextBlock.Text) .DisposeWith(d); this.WhenAnyValue(view => view.ViewModel!.Mods) @@ -42,8 +42,13 @@ public LoadoutGridView() .DisposeWith(d); this.WhenAnyValue(view => view.ViewModel!.Mods.Count) - .Select(count => count == 0) - .BindTo(this, view => view.EmptyModlistMessageBorder.IsVisible) + .Select(count => count > 0) + .Subscribe(hasItems => + { + ModsDataGrid.IsVisible = hasItems; + EmptyModlistMessageBorder.IsVisible = !hasItems; + } + ) .DisposeWith(d); // TODO: remove these commands and move all of this into the ViewModel diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridViewModel.cs b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridViewModel.cs index 82ff0ba5ea..67a93930ff 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridViewModel.cs +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridViewModel.cs @@ -7,14 +7,13 @@ using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using NexusMods.Abstractions.GameLocators; using NexusMods.Abstractions.Loadouts; using NexusMods.Abstractions.Loadouts.Ids; using NexusMods.Abstractions.Loadouts.Mods; using NexusMods.Abstractions.MnemonicDB.Attributes; using NexusMods.Abstractions.Settings; -using NexusMods.Abstractions.Telemetry; using NexusMods.App.UI.Controls.DataGrid; -using NexusMods.App.UI.Controls.MarkdownRenderer; using NexusMods.App.UI.Controls.Navigation; using NexusMods.App.UI.Pages.LoadoutGrid.Columns.ModCategory; using NexusMods.App.UI.Pages.LoadoutGrid.Columns.ModEnabled; @@ -48,7 +47,8 @@ public class LoadoutGridViewModel : APageViewModel, ILoad private ReadOnlyObservableCollection> _filteredColumns = new([]); - public IMarkdownRendererViewModel MarkdownRendererViewModel { get; } + + [Reactive] public string? EmptyModlistTitleMessage { get; private set; } public ReadOnlyObservableCollection> Columns => _filteredColumns; [Reactive] public LoadoutId LoadoutId { get; set; } @@ -71,8 +71,6 @@ public LoadoutGridViewModel( { _conn = conn; - MarkdownRendererViewModel = provider.GetRequiredService(); - _columns = new SourceCache, LoadoutColumn>(_ => throw new NotSupportedException()); _mods = new ReadOnlyObservableCollection(new ObservableCollection()); @@ -159,7 +157,7 @@ public LoadoutGridViewModel( .WhereNotNull() .SubscribeWithErrorLogging(loadout => { - MarkdownRendererViewModel.Contents = GetEmptyModlistMarkdownString(); + EmptyModlistTitleMessage = GetEmptyModlistTitleString(loadout.Installation); }) .DisposeWith(d); @@ -186,14 +184,9 @@ public async Task DeleteMods(IEnumerable modsToDelete, string commitMessa } private const string NexusModsUrl = "https://www.nexusmods.com/{0}"; - private string GetEmptyModlistMarkdownString() + private static string GetEmptyModlistTitleString(GameInstallation gameInstallation) { - var gameDomain = _conn.Db.Get(LoadoutId).Installation.Game.Domain; - var url = NexusModsUrlBuilder.CreateGenericUri(string.Format(NexusModsUrl, gameDomain)); - const string mkString = """ -### No mods have been added -View and add your existing downloaded mods from the **Library** or [browse new mods on Nexus Mods]({0}) -"""; - return string.Format(mkString, url); + return string.Format(Language.LoadoutGridViewModel_EmptyModlistTitleString, gameInstallation.Game.Name); } + } diff --git a/src/NexusMods.App.UI/Resources/Language.Designer.cs b/src/NexusMods.App.UI/Resources/Language.Designer.cs index fab9968f1a..c68f382088 100644 --- a/src/NexusMods.App.UI/Resources/Language.Designer.cs +++ b/src/NexusMods.App.UI/Resources/Language.Designer.cs @@ -1130,6 +1130,15 @@ public static string LaunchButtonViewModel_LaunchGame_RUNNING { } } + /// + /// Looks up a localized string similar to Add your downloaded mods from the. + /// + public static string LoadoutGrid_EmptyModlistSubtitle_Add_from_library { + get { + return ResourceManager.GetString("LoadoutGrid_EmptyModlistSubtitle_Add_from_library", resourceCulture); + } + } + /// /// Looks up a localized string similar to Remove. /// @@ -1166,6 +1175,15 @@ public static string LoadoutGridView_AddMod_FileType_Archive { } } + /// + /// Looks up a localized string similar to No mods added to {0}. + /// + public static string LoadoutGridViewModel_EmptyModlistTitleString { + get { + return ResourceManager.GetString("LoadoutGridViewModel_EmptyModlistTitleString", resourceCulture); + } + } + /// /// Looks up a localized string similar to My Mods. /// @@ -1359,6 +1377,24 @@ public static string Newsfeed { } } + /// + /// Looks up a localized string similar to You can add panels for split screen viewing by selecting the. + /// + public static string NewTabPageInfoBannerText1 { + get { + return ResourceManager.GetString("NewTabPageInfoBannerText1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to button in the toolbar. + /// + public static string NewTabPageInfoBannerText2 { + get { + return ResourceManager.GetString("NewTabPageInfoBannerText2", resourceCulture); + } + } + /// /// Looks up a localized string similar to PREMIUM. /// @@ -1655,17 +1691,5 @@ public static string ViewModInfoPage_Title { return ResourceManager.GetString("ViewModInfoPage_Title", resourceCulture); } } - - public static string NewTabPageInfoBannerText1 { - get { - return ResourceManager.GetString("NewTabPageInfoBannerText1", resourceCulture); - } - } - - public static string NewTabPageInfoBannerText2 { - get { - return ResourceManager.GetString("NewTabPageInfoBannerText2", resourceCulture); - } - } } } diff --git a/src/NexusMods.App.UI/Resources/Language.resx b/src/NexusMods.App.UI/Resources/Language.resx index 81cccf3cf8..8bacc0af59 100644 --- a/src/NexusMods.App.UI/Resources/Language.resx +++ b/src/NexusMods.App.UI/Resources/Language.resx @@ -563,4 +563,11 @@ button in the toolbar + + Add your downloaded mods from the + + + No mods added to {0} + {0} is the name of the currently managed game + From a189b2702d5cc17a8b4f315ad4151655ab0f590e Mon Sep 17 00:00:00 2001 From: AL <26797547+Al12rs@users.noreply.github.com> Date: Thu, 13 Jun 2024 10:01:19 +0200 Subject: [PATCH 2/9] Update bare icon styles --- src/NexusMods.Icons/IconValues.cs | 14 ++++- .../Controls/Button/BareIconStyles.axaml | 57 ++++++------------- 2 files changed, 31 insertions(+), 40 deletions(-) diff --git a/src/NexusMods.Icons/IconValues.cs b/src/NexusMods.Icons/IconValues.cs index 0afd8ec667..1e30ff48b2 100644 --- a/src/NexusMods.Icons/IconValues.cs +++ b/src/NexusMods.Icons/IconValues.cs @@ -211,10 +211,22 @@ public static class IconValues // https://pictogrammers.com/library/mdi/icon/chevron-right/ public static readonly IconValue ChevronRight = new ProjektankerIcon("mdi-chevron-right"); + + // https://pictogrammers.com/library/mdi/icon/chevron-down/ + public static readonly IconValue ChevronDown = new ProjektankerIcon("mdi-chevron-down"); + + // https://pictogrammers.com/library/mdi/icon/chevron-up/ + public static readonly IconValue ChevronUp = new ProjektankerIcon("mdi-chevron-up"); // https://pictogrammers.com/library/mdi/icon/close/ public static readonly IconValue Close = new ProjektankerIcon("mdi-close"); - + + // https://pictogrammers.com/library/mdi/icon/window-minimize/ + public static readonly IconValue WindowMinimize = new ProjektankerIcon("mdi-window-minimize"); + + // https://pictogrammers.com/library/mdi/icon/window-maximize/ + public static readonly IconValue WindowMaximize = new ProjektankerIcon("mdi-window-maximize"); + // https://pictogrammers.com/library/mdi/icon/refresh/ public static readonly IconValue Refresh = new ProjektankerIcon("mdi-refresh"); diff --git a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/BareIconStyles.axaml b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/BareIconStyles.axaml index bea705ea30..245820dcdc 100644 --- a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/BareIconStyles.axaml +++ b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/BareIconStyles.axaml @@ -20,6 +20,7 @@ + diff --git a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/ButtonStyles.axaml b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/ButtonStyles.axaml index bb16f5f74c..9289343d25 100644 --- a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/ButtonStyles.axaml +++ b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/ButtonStyles.axaml @@ -30,6 +30,12 @@ + @@ -164,4 +170,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a5d0e14938eda9e23796951c2fd195d89b052f06 Mon Sep 17 00:00:00 2001 From: AL <26797547+Al12rs@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:45:46 +0200 Subject: [PATCH 8/9] Add open library button --- .../LoadoutGrid/ILoadoutGridViewModel.cs | 5 ++--- .../LoadoutGrid/LoadoutGridDesignViewModel.cs | 1 + .../Pages/LoadoutGrid/LoadoutGridView.axaml | 5 +++-- .../LoadoutGrid/LoadoutGridView.axaml.cs | 3 +++ .../Pages/LoadoutGrid/LoadoutGridViewModel.cs | 19 +++++++++++++++++++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/ILoadoutGridViewModel.cs b/src/NexusMods.App.UI/Pages/LoadoutGrid/ILoadoutGridViewModel.cs index c1c6f06b3a..f06b304cf8 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/ILoadoutGridViewModel.cs +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/ILoadoutGridViewModel.cs @@ -1,10 +1,7 @@ using System.Collections.ObjectModel; using System.Reactive; -using NexusMods.Abstractions.Loadouts; using NexusMods.Abstractions.Loadouts.Ids; -using NexusMods.Abstractions.Loadouts.Mods; using NexusMods.App.UI.Controls.DataGrid; -using NexusMods.App.UI.Controls.MarkdownRenderer; using NexusMods.App.UI.Controls.Navigation; using NexusMods.App.UI.WorkspaceSystem; using ReactiveUI; @@ -26,6 +23,8 @@ public interface ILoadoutGridViewModel : IPageViewModelInterface public ModId[] SelectedItems { get; set; } public ReactiveCommand ViewModContentsCommand { get; } + + public ReactiveCommand ViewModLibraryCommand { get; } /// /// Delete the mods from the loadout. diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridDesignViewModel.cs b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridDesignViewModel.cs index 6ee3600b7c..b991ed0b06 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridDesignViewModel.cs +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridDesignViewModel.cs @@ -25,6 +25,7 @@ public class LoadoutGridDesignViewModel(IWindowManager windowManager) : APageVie public ReadOnlyObservableCollection> Columns { get; } = new([]); public ModId[] SelectedItems { get; set; } = []; public ReactiveCommand ViewModContentsCommand { get; } = ReactiveCommand.Create(_ => Unit.Default); + public ReactiveCommand ViewModLibraryCommand { get; } = ReactiveCommand.Create(_ => Unit.Default); public LoadoutGridDesignViewModel() : this(new DesignWindowManager()) { } diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml index f408c90157..3f1afc34bd 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml @@ -62,7 +62,8 @@ - + diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml.cs b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml.cs index 0a3491b28b..d042b4f755 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml.cs +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridView.axaml.cs @@ -29,6 +29,9 @@ public LoadoutGridView() this.BindCommand(ViewModel, vm => vm.ViewModContentsCommand, view => view.ViewModFilesButton) .DisposeWith(d); + + this.BindCommand(ViewModel, vm => vm.ViewModLibraryCommand, view => view.ViewModLibraryButton) + .DisposeWith(d); this.WhenAnyValue(view => view.ViewModel!.Columns) .GenerateColumns(ModsDataGrid) diff --git a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridViewModel.cs b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridViewModel.cs index 67a93930ff..354bfb0c91 100644 --- a/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridViewModel.cs +++ b/src/NexusMods.App.UI/Pages/LoadoutGrid/LoadoutGridViewModel.cs @@ -22,6 +22,7 @@ using NexusMods.App.UI.Pages.LoadoutGrid.Columns.ModVersion; using NexusMods.App.UI.Pages.ModInfo; using NexusMods.App.UI.Pages.ModInfo.Types; +using NexusMods.App.UI.Pages.ModLibrary; using NexusMods.App.UI.Resources; using NexusMods.App.UI.Settings; using NexusMods.App.UI.Windows; @@ -56,6 +57,7 @@ public class LoadoutGridViewModel : APageViewModel, ILoad [Reactive] public ModId[] SelectedItems { get; set; } = []; public ReactiveCommand ViewModContentsCommand { get; } + public ReactiveCommand ViewModLibraryCommand { get; } public LoadoutGridViewModel() : base(null!) { @@ -123,6 +125,23 @@ public LoadoutGridViewModel( var behavior = workspaceController.GetOpenPageBehavior(pageData, info, IdBundle); workspaceController.OpenPage(WorkspaceId, pageData, behavior); }, hasSelection); + + ViewModLibraryCommand = ReactiveCommand.Create(info => + { + + var pageData = new PageData + { + Context = new FileOriginsPageContext() + { + LoadoutId = LoadoutId, + }, + FactoryId = FileOriginsPageFactory.StaticId, + }; + + var workspaceController = GetWorkspaceController(); + var behavior = workspaceController.GetOpenPageBehavior(pageData, info, IdBundle); + workspaceController.OpenPage(WorkspaceId, pageData, behavior); + }); this.WhenActivated(d => { From 73d57eb4894bda4b22d855d6df502f9d50281704 Mon Sep 17 00:00:00 2001 From: AL <26797547+Al12rs@users.noreply.github.com> Date: Mon, 17 Jun 2024 15:06:35 +0200 Subject: [PATCH 9/9] Fix padding --- .../Styles/Controls/Button/ButtonStyles.axaml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/ButtonStyles.axaml b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/ButtonStyles.axaml index 9289343d25..6769ff5e66 100644 --- a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/ButtonStyles.axaml +++ b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/Button/ButtonStyles.axaml @@ -176,7 +176,7 @@ +