Submission wizard - Added Lottie animations and the first few steps

This commit is contained in:
Robert committed 2023-08-09 11:54:35 +02:00
1 parent 661242ebf9
commit 78cb95aabc
29 files changed
+534 -153

No files matched your search

@@ -9,9 +9,9 @@
x:Class="Artemis.UI.Screens.Workshop.CurrentUser.CurrentUserView"
x:DataType="currentUser:CurrentUserViewModel">
<Panel Name="Container" IsVisible="{CompiledBinding !Loading}">
<Panel Name="Container">
<!-- Signed out -->
<Ellipse Height="{CompiledBinding Bounds.Height, ElementName=Container}" Width="{CompiledBinding Bounds.Height, ElementName=Container}" IsVisible="{CompiledBinding Name, Converter={x:Static StringConverters.IsNullOrEmpty}}">
<Ellipse Height="{CompiledBinding Bounds.Height, ElementName=Container}" Width="{CompiledBinding Bounds.Height, ElementName=Container}" IsVisible="{CompiledBinding IsAnonymous}">
<Ellipse.ContextFlyout>
<MenuFlyout>
<MenuItem Header="Login" Command="{CompiledBinding Login}">
@@ -27,7 +27,7 @@
</Ellipse>
<!-- Signed in -->
<Ellipse Height="{CompiledBinding Bounds.Height, ElementName=Container}" Width="{CompiledBinding Bounds.Height, ElementName=Container}" IsVisible="{CompiledBinding Name, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Name="UserMenu">
<Ellipse Height="{CompiledBinding Bounds.Height, ElementName=Container}" Width="{CompiledBinding Bounds.Height, ElementName=Container}" IsVisible="{CompiledBinding !IsAnonymous}" Name="UserMenu">
<Ellipse.ContextFlyout>
<Flyout>
<Grid ColumnDefinitions="Auto,*" RowDefinitions="*,*,*" MinWidth="300">
@@ -39,6 +39,7 @@
<TextBlock Grid.Column="1" Grid.Row="0" Text="{CompiledBinding Name}" Margin="0 4 0 0"></TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" Text="{CompiledBinding Email}"></TextBlock>
<controls:HyperlinkButton
IsVisible="{CompiledBinding AllowLogout}"
Grid.Column="1"
Grid.Row="2"
Margin="-8 0 0 0"
@@ -54,6 +55,4 @@
</Ellipse.Fill>
</Ellipse>
</Panel>
</UserControl>
@@ -19,8 +19,10 @@ namespace Artemis.UI.Screens.Workshop.CurrentUser;
public class CurrentUserViewModel : ActivatableViewModelBase
{
private readonly IAuthenticationService _authenticationService;
private readonly ObservableAsPropertyHelper<bool> _isAnonymous;
private readonly ILogger _logger;
private readonly IWindowService _windowService;
private bool _allowLogout = true;
private Bitmap? _avatar;
private string? _email;
private bool _loading = true;
@@ -34,6 +36,8 @@ public class CurrentUserViewModel : ActivatableViewModelBase
_windowService = windowService;
Login = ReactiveCommand.CreateFromTask(ExecuteLogin);
_isAnonymous = this.WhenAnyValue(vm => vm.Loading, vm => vm.Name, (l, n) => l || n == null).ToProperty(this, vm => vm.IsAnonymous);
this.WhenActivated(d =>
{
Task.Run(AutoLogin);
@@ -41,41 +45,50 @@ public class CurrentUserViewModel : ActivatableViewModelBase
});
}
public bool IsAnonymous => _isAnonymous.Value;
public bool AllowLogout
{
get => _allowLogout;
set => RaiseAndSetIfChanged(ref _allowLogout, value);
}
public bool Loading
{
get => _loading;
set => RaiseAndSetIfChanged(ref _loading, value);
private set => RaiseAndSetIfChanged(ref _loading, value);
}
public string? UserId
{
get => _userId;
set => RaiseAndSetIfChanged(ref _userId, value);
private set => RaiseAndSetIfChanged(ref _userId, value);
}
public string? Name
{
get => _name;
set => RaiseAndSetIfChanged(ref _name, value);
private set => RaiseAndSetIfChanged(ref _name, value);
}
public string? Email
{
get => _email;
set => RaiseAndSetIfChanged(ref _email, value);
private set => RaiseAndSetIfChanged(ref _email, value);
}
public Bitmap? Avatar
{
get => _avatar;
set => RaiseAndSetIfChanged(ref _avatar, value);
private set => RaiseAndSetIfChanged(ref _avatar, value);
}
public ReactiveCommand<Unit, Unit> Login { get; }
public void Logout()
{
_authenticationService.Logout();
if (AllowLogout)
_authenticationService.Logout();
}
private async Task ExecuteLogin(CancellationToken cancellationToken)
@@ -8,13 +8,10 @@
x:DataType="currentUser:WorkshopLoginViewModel">
<StackPanel Width="400">
<TextBlock TextWrapping="Wrap">
In order to login you must enter your Artemis credentials in a browser.
</TextBlock>
<TextBlock TextWrapping="Wrap" Margin="0 15">
If you do not have an account yet you can create one in the browser too. Alternatively you can log in with Google or Discord.
A browser window has opened where you'll be able to create an account and/or log in.
</TextBlock>
<TextBlock>Waiting for login...</TextBlock>
<TextBlock Margin="0 15 0 0">Waiting for log in...</TextBlock>
<ProgressBar Margin="0 5 0 0" IsIndeterminate="True"></ProgressBar>
</StackPanel>
</UserControl>