-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add warning modal dialog * Show warning overlay when clicking help button * Hide useless top bar buttons
- Loading branch information
Showing
16 changed files
with
339 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
src/NexusMods.App.UI/Overlays/AlphaWarning/AlphaWarningView.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<reactive:ReactiveUserControl | ||
x:TypeArguments="local:IAlphaWarningViewModel" | ||
xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:reactive="http://reactiveui.net" | ||
xmlns:local="clr-namespace:NexusMods.App.UI.Overlays.AlphaWarning" | ||
xmlns:base="clr-namespace:NexusMods.App.UI.Overlays.Generic.MessageBox.Base" | ||
xmlns:icons="clr-namespace:NexusMods.Icons;assembly=NexusMods.Icons" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600" | ||
x:Class="NexusMods.App.UI.Overlays.AlphaWarning.AlphaWarningView"> | ||
|
||
<base:MessageBoxBackground MinWidth="576" MaxWidth="576" MinHeight="523" MaxHeight="523"> | ||
<base:MessageBoxBackground.TopContent> | ||
<StackPanel Orientation="Vertical" Margin="16, 24, 24, 24" Classes="Spacing-3_5"> | ||
<StackPanel Classes="Spacing-4"> | ||
<TextBlock Classes="HeadingXSSemi">Thank you for joining the Nexus Mods App alpha test</TextBlock> | ||
|
||
<Border Classes="Rounded-lg WarningSubdued20" Padding="16"> | ||
<StackPanel Spacing="8"> | ||
<StackPanel Orientation="Horizontal" Spacing="2"> | ||
<icons:UnifiedIcon Size="20" Classes="Alert"/> | ||
<TextBlock Classes="BodyLGBold">Important</TextBlock> | ||
</StackPanel> | ||
|
||
<TextBlock Classes="BodyMDNormal" TextWrapping="Wrap">This app is still very early in development and currently only supports Stardew Valley. Please ensure no mods are installed in your game folder before testing.</TextBlock> | ||
</StackPanel> | ||
|
||
</Border> | ||
|
||
<StackPanel Spacing="20"> | ||
<TextBlock Classes="BodyMDNormal ForegroundModerate" TextWrapping="Wrap">Congratulations on being one of the first to dive into the Alpha test version of the Nexus Mods App!</TextBlock> | ||
|
||
<Button x:Name="ViewChangelogButton" Classes="Hyperlink Secondary"> | ||
<TextBlock Classes="ForegroundModerate">View the changelog</TextBlock> | ||
</Button> | ||
|
||
<TextBlock Classes="BodyMDNormal ForegroundModerate" TextWrapping="Wrap">Your feedback is our compass. So, if you encounter any bugs, quirks, or have suggestions for improvement, don't hesitate to reach out.</TextBlock> | ||
</StackPanel> | ||
|
||
<Grid ColumnDefinitions="*, *, *"> | ||
<Button Grid.Column="0" Width="165" x:Name="OpenDiscordButton" Classes="Rounded" HorizontalAlignment="Left"> | ||
<StackPanel HorizontalAlignment="Center"> | ||
<icons:UnifiedIcon Classes="Discord" /> | ||
<TextBlock Classes="ForegroundStrong">App Discord</TextBlock> | ||
</StackPanel> | ||
</Button> | ||
|
||
<Button Grid.Column="1" Width="165" x:Name="OpenForumsButton" Classes="Rounded" HorizontalAlignment="Center"> | ||
<StackPanel HorizontalAlignment="Center"> | ||
<icons:UnifiedIcon Classes="Forum" /> | ||
<TextBlock Classes="ForegroundStrong">Forums</TextBlock> | ||
</StackPanel> | ||
</Button> | ||
|
||
<Button Grid.Column="2" Width="165" x:Name="OpenGitHubButton" Classes="Rounded" HorizontalAlignment="Right"> | ||
<StackPanel HorizontalAlignment="Center"> | ||
<icons:UnifiedIcon Classes="Code" /> | ||
<TextBlock Classes="ForegroundStrong">GitHub</TextBlock> | ||
</StackPanel> | ||
</Button> | ||
</Grid> | ||
|
||
<TextBlock Classes="BodyMDNormal ForegroundModerate">Thank you for embarking on this exciting journey with us. Happy modding!</TextBlock> | ||
|
||
</StackPanel> | ||
</StackPanel> | ||
|
||
</base:MessageBoxBackground.TopContent> | ||
|
||
<base:MessageBoxBackground.BottomContent> | ||
<StackPanel Orientation="Horizontal" Margin="24" HorizontalAlignment="Right" Classes="Spacing-2"> | ||
<Button x:Name="DoneButton" Classes="Standard Primary"> | ||
<TextBlock>LET'S GO!</TextBlock> | ||
</Button> | ||
</StackPanel> | ||
|
||
</base:MessageBoxBackground.BottomContent> | ||
</base:MessageBoxBackground> | ||
|
||
</reactive:ReactiveUserControl> | ||
|
34 changes: 34 additions & 0 deletions
34
src/NexusMods.App.UI/Overlays/AlphaWarning/AlphaWarningView.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Reactive.Disposables; | ||
using Avalonia.ReactiveUI; | ||
using JetBrains.Annotations; | ||
using ReactiveUI; | ||
|
||
namespace NexusMods.App.UI.Overlays.AlphaWarning; | ||
|
||
[UsedImplicitly] | ||
public partial class AlphaWarningView : ReactiveUserControl<IAlphaWarningViewModel> | ||
{ | ||
public AlphaWarningView() | ||
{ | ||
InitializeComponent(); | ||
|
||
this.WhenActivated(disposables => | ||
{ | ||
this.BindCommand(ViewModel, vm => vm.OpenDiscordCommand, view => view.OpenDiscordButton) | ||
.DisposeWith(disposables); | ||
|
||
this.BindCommand(ViewModel, vm => vm.OpenForumsCommand, view => view.OpenForumsButton) | ||
.DisposeWith(disposables); | ||
|
||
this.BindCommand(ViewModel, vm => vm.OpenGitHubCommand, view => view.OpenGitHubButton) | ||
.DisposeWith(disposables); | ||
|
||
this.BindCommand(ViewModel, vm => vm.ViewChangelogCommand, view => view.ViewChangelogButton) | ||
.DisposeWith(disposables); | ||
|
||
this.BindCommand(ViewModel, vm => vm.CloseCommand, view => view.DoneButton) | ||
.DisposeWith(disposables); | ||
}); | ||
} | ||
} | ||
|
100 changes: 100 additions & 0 deletions
100
src/NexusMods.App.UI/Overlays/AlphaWarning/AlphaWarningViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
using System.Reactive; | ||
using System.Reactive.Disposables; | ||
using DynamicData.Kernel; | ||
using NexusMods.Abstractions.Settings; | ||
using NexusMods.App.UI.Controls.Navigation; | ||
using NexusMods.App.UI.Pages.Changelog; | ||
using NexusMods.App.UI.Settings; | ||
using NexusMods.App.UI.WorkspaceSystem; | ||
using NexusMods.CrossPlatform.Process; | ||
using ReactiveUI; | ||
using ReactiveUI.Fody.Helpers; | ||
|
||
namespace NexusMods.App.UI.Overlays.AlphaWarning; | ||
|
||
public class AlphaWarningViewModel : AViewModel<IAlphaWarningViewModel>, IAlphaWarningViewModel | ||
{ | ||
[Reactive] public bool IsActive { get; set; } | ||
|
||
// NOTE(erri120): from https://github.com/Nexus-Mods/NexusMods.App/issues/1376 | ||
private static readonly Uri DiscordUri = new("https://discord.gg/y7NfQWyRkj"); | ||
private static readonly Uri ForumsUri = new("https://forums.nexusmods.com/forum/9052-nexus-mods-app/"); | ||
private static readonly Uri GitHubUri = new("https://github.com/Nexus-Mods/NexusMods.App"); | ||
|
||
public ReactiveCommand<Unit, Unit> ViewChangelogCommand { get; } | ||
public ReactiveCommand<Unit, Uri> OpenDiscordCommand { get; } | ||
public ReactiveCommand<Unit, Uri> OpenForumsCommand { get; } | ||
public ReactiveCommand<Unit, Uri> OpenGitHubCommand { get; } | ||
|
||
public ReactiveCommand<Unit, Unit> CloseCommand { get; } | ||
|
||
public IWorkspaceController? WorkspaceController { get; set; } | ||
|
||
private readonly ISettingsManager _settingsManager; | ||
private readonly IOverlayController _overlayController; | ||
|
||
public AlphaWarningViewModel( | ||
IOSInterop osInterop, | ||
ISettingsManager settingsManager, | ||
IOverlayController overlayController) | ||
{ | ||
_settingsManager = settingsManager; | ||
_overlayController = overlayController; | ||
|
||
OpenDiscordCommand = ReactiveCommand.Create(() => DiscordUri); | ||
OpenForumsCommand = ReactiveCommand.Create(() => ForumsUri); | ||
OpenGitHubCommand = ReactiveCommand.Create(() => GitHubUri); | ||
|
||
ViewChangelogCommand = ReactiveCommand.Create(() => | ||
{ | ||
var workspaceController = WorkspaceController; | ||
if (workspaceController is null) return; | ||
|
||
var pageData = new PageData | ||
{ | ||
Context = new ChangelogPageContext | ||
{ | ||
TargetVersion = null, | ||
}, | ||
FactoryId = ChangelogPageFactory.StaticId, | ||
}; | ||
|
||
var behavior = workspaceController.GetOpenPageBehavior(pageData, new NavigationInformation(NavigationInput.Default, Optional<OpenPageBehaviorType>.None), Optional<PageIdBundle>.None); | ||
workspaceController.OpenPage(workspaceController.ActiveWorkspace!.Id, pageData, behavior); | ||
}); | ||
|
||
CloseCommand = ReactiveCommand.Create(() => | ||
{ | ||
_settingsManager.Update<AlphaSettings>(settings => settings with | ||
{ | ||
HasShownModal = true, | ||
}); | ||
|
||
IsActive = false; | ||
}); | ||
|
||
this.WhenActivated(disposables => | ||
{ | ||
this.WhenAnyObservable( | ||
vm => vm.OpenDiscordCommand, | ||
vm => vm.OpenForumsCommand, | ||
vm => vm.OpenGitHubCommand) | ||
.SubscribeWithErrorLogging(uri => | ||
{ | ||
_ = Task.Run(async () => | ||
{ | ||
await osInterop.OpenUrl(uri); | ||
}); | ||
}) | ||
.DisposeWith(disposables); | ||
}); | ||
} | ||
|
||
public bool MaybeShow() | ||
{ | ||
if (_settingsManager.Get<AlphaSettings>().HasShownModal) return false; | ||
|
||
_overlayController.SetOverlayContent(new SetOverlayItem(this)); | ||
return true; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/NexusMods.App.UI/Overlays/AlphaWarning/IAlphaWarningViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Reactive; | ||
using NexusMods.App.UI.WorkspaceSystem; | ||
using ReactiveUI; | ||
|
||
namespace NexusMods.App.UI.Overlays.AlphaWarning; | ||
|
||
public interface IAlphaWarningViewModel : IOverlayViewModel | ||
{ | ||
public ReactiveCommand<Unit, Unit> ViewChangelogCommand { get; } | ||
|
||
public ReactiveCommand<Unit, Uri> OpenDiscordCommand { get; } | ||
|
||
public ReactiveCommand<Unit, Uri> OpenForumsCommand { get; } | ||
|
||
public ReactiveCommand<Unit, Uri> OpenGitHubCommand { get; } | ||
|
||
public ReactiveCommand<Unit, Unit> CloseCommand { get; } | ||
|
||
public IWorkspaceController? WorkspaceController { get; set; } | ||
|
||
public bool MaybeShow(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using NexusMods.Abstractions.Settings; | ||
|
||
namespace NexusMods.App.UI.Settings; | ||
|
||
public record AlphaSettings : ISettings | ||
{ | ||
public bool HasShownModal { get; set; } | ||
|
||
public static ISettingsBuilder Configure(ISettingsBuilder settingsBuilder) | ||
{ | ||
return settingsBuilder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.