1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 13:28:33 +00:00

Workshop - Feature flagged out layouts

Settings - Use Fluent tabs
This commit is contained in:
Robert 2023-09-09 00:32:58 +02:00
parent 0ac973d4bc
commit a798980eec
14 changed files with 70 additions and 35 deletions

View File

@ -18,7 +18,7 @@
<TrayIcon.Menu>
<NativeMenu>
<NativeMenuItem Header="Home" Command="{CompiledBinding OpenScreen}" CommandParameter="home" />
<!-- <NativeMenuItem Header="Workshop" Command="{CompiledBinding OpenScreen}" CommandParameter="workshop" /> -->
<NativeMenuItem Header="Workshop" Command="{CompiledBinding OpenScreen}" CommandParameter="workshop" />
<NativeMenuItem Header="Surface Editor" Command="{CompiledBinding OpenScreen}" CommandParameter="surface-editor" />
<NativeMenuItem Header="Settings" Command="{CompiledBinding OpenScreen}" CommandParameter="settings" />
<NativeMenuItemSeparator />

View File

@ -18,7 +18,7 @@
<TrayIcon.Menu>
<NativeMenu>
<NativeMenuItem Header="Home" Command="{CompiledBinding OpenScreen}" CommandParameter="home" />
<!-- <NativeMenuItem Header="Workshop" Command="{CompiledBinding OpenScreen}" CommandParameter="workshop" /> -->
<NativeMenuItem Header="Workshop" Command="{CompiledBinding OpenScreen}" CommandParameter="workshop" />
<NativeMenuItem Header="Surface Editor" Command="{CompiledBinding OpenScreen}" CommandParameter="surface-editor" />
<NativeMenuItem Header="Settings" Command="{CompiledBinding OpenScreen}" CommandParameter="settings" />
<NativeMenuItemSeparator />

View File

@ -18,7 +18,7 @@
<TrayIcon.Menu>
<NativeMenu>
<NativeMenuItem Header="Home" Command="{CompiledBinding OpenScreen}" CommandParameter="home" />
<!-- <NativeMenuItem Header="Workshop" Command="{CompiledBinding OpenScreen}" CommandParameter="workshop" /> -->
<NativeMenuItem Header="Workshop" Command="{CompiledBinding OpenScreen}" CommandParameter="workshop" />
<NativeMenuItem Header="Surface Editor" Command="{CompiledBinding OpenScreen}" CommandParameter="surface-editor" />
<NativeMenuItem Header="Settings" Command="{CompiledBinding OpenScreen}" CommandParameter="settings" />
<NativeMenuItemSeparator />

View File

@ -23,7 +23,6 @@ public static class Routes
{
new RouteRegistration<BlankViewModel>("blank"),
new RouteRegistration<HomeViewModel>("home"),
#if DEBUG
new RouteRegistration<WorkshopViewModel>("workshop")
{
Children = new List<IRouterRegistration>
@ -35,8 +34,10 @@ public static class Routes
{
new RouteRegistration<ProfileListViewModel>("profiles/{page:int}"),
new RouteRegistration<ProfileDetailsViewModel>("profiles/details/{entryId:guid}"),
#if DEBUG
new RouteRegistration<LayoutListViewModel>("layouts/{page:int}"),
new RouteRegistration<LayoutDetailsViewModel>("layouts/details/{entryId:guid}"),
#endif
}
},
new RouteRegistration<WorkshopLibraryViewModel>("library")
@ -50,7 +51,6 @@ public static class Routes
}
}
},
#endif
new RouteRegistration<SurfaceEditorViewModel>("surface-editor"),
new RouteRegistration<SettingsViewModel>("settings")
{

View File

@ -8,20 +8,25 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Settings.SettingsView"
x:DataType="settings:SettingsViewModel">
<Border Classes="router-container">
<Grid RowDefinitions="Auto,*">
<TabStrip Grid.Row="0" Margin="12" ItemsSource="{CompiledBinding SettingTabs}" SelectedItem="{CompiledBinding SelectedTab}">
<TabStrip.ItemTemplate>
<DataTemplate>
<TextBlock Text="{CompiledBinding Name}" />
</DataTemplate>
</TabStrip.ItemTemplate>
</TabStrip>
<controls:Frame Grid.Row="1" Name="TabFrame" IsNavigationStackEnabled="False" CacheSize="0">
<controls:Frame.NavigationPageFactory>
<ui:PageFactory/>
</controls:Frame.NavigationPageFactory>
</controls:Frame>
</Grid>
</Border>
<controls:NavigationView PaneDisplayMode="Top"
MenuItemsSource="{CompiledBinding SettingTabs}"
SelectedItem="{CompiledBinding SelectedTab}"
IsBackEnabled="True"
IsBackButtonVisible="True"
IsSettingsVisible="False"
BackRequested="NavigationView_OnBackRequested">
<controls:NavigationView.Styles>
<Styles>
<Style Selector="controls|NavigationView:topnavminimal /template/ SplitView Border#ContentGridBorder">
<Setter Property="CornerRadius" Value="8 0 0 0" />
</Style>
</Styles>
</controls:NavigationView.Styles>
<controls:Frame Name="TabFrame" IsNavigationStackEnabled="False" CacheSize="0" Padding="20">
<controls:Frame.NavigationPageFactory>
<ui:PageFactory/>
</controls:Frame.NavigationPageFactory>
</controls:Frame>
</controls:NavigationView>
</UserControl>

View File

@ -3,8 +3,7 @@ using System.Reactive.Disposables;
using Artemis.UI.Shared;
using Avalonia.ReactiveUI;
using Avalonia.Threading;
using FluentAvalonia.UI.Media.Animation;
using FluentAvalonia.UI.Navigation;
using FluentAvalonia.UI.Controls;
using ReactiveUI;
namespace Artemis.UI.Screens.Settings;
@ -19,6 +18,11 @@ public partial class SettingsView : ReactiveUserControl<SettingsViewModel>
private void Navigate(ViewModelBase viewModel)
{
Dispatcher.UIThread.Invoke(() => TabFrame.NavigateFromObject(viewModel, new FrameNavigationOptions {TransitionInfoOverride = new SlideNavigationTransitionInfo()}));
Dispatcher.UIThread.Invoke(() => TabFrame.NavigateFromObject(viewModel));
}
private void NavigationView_OnBackRequested(object? sender, NavigationViewBackRequestedEventArgs e)
{
ViewModel?.GoBack();
}
}

View File

@ -55,4 +55,9 @@ public class SettingsViewModel : RoutableHostScreen<RoutableScreen>, IMainScreen
if (SelectedTab == null)
await _router.Navigate(SettingTabs.First().Path);
}
public void GoBack()
{
_router.Navigate("workshop");
}
}

View File

@ -25,14 +25,19 @@
</Grid>
<ScrollViewer Grid.Row="1" Grid.Column="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" VerticalAlignment="Top">
<ItemsRepeater ItemsSource="{CompiledBinding Plugins}" MaxWidth="1000" VerticalAlignment="Center">
<ItemsRepeater.ItemTemplate>
<ItemsControl ItemsSource="{CompiledBinding Plugins}" MaxWidth="1000" VerticalAlignment="Center">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="plugins:PluginSettingsViewModel">
<ContentControl Content="{CompiledBinding}" Height="200"/>
<ContentControl Content="{CompiledBinding}" Height="200" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</UserControl>

View File

@ -38,14 +38,15 @@ public class SidebarViewModel : ActivatableViewModelBase
SidebarScreen = new SidebarScreenViewModel(MaterialIconKind.Abacus, ROOT_SCREEN, "", null, new ObservableCollection<SidebarScreenViewModel>()
{
new(MaterialIconKind.HomeOutline, "Home", "home"),
#if DEBUG
new(MaterialIconKind.TestTube, "Workshop", "workshop", null, new ObservableCollection<SidebarScreenViewModel>
{
new(MaterialIconKind.FolderVideo, "Profiles", "workshop/entries/profiles/1", "workshop/entries/profiles"),
#if DEBUG
new(MaterialIconKind.KeyboardVariant, "Layouts", "workshop/entries/layouts/1", "workshop/entries/layouts"),
#endif
new(MaterialIconKind.Bookshelf, "Library", "workshop/library"),
}),
#endif
new(MaterialIconKind.Devices, "Surface Editor", "surface-editor"),
new(MaterialIconKind.SettingsOutline, "Settings", "settings")
});
@ -120,7 +121,7 @@ public class SidebarViewModel : ActivatableViewModelBase
{
if (_updating)
return;
Dispatcher.UIThread.Invoke(async () =>
{
try

View File

@ -24,7 +24,9 @@ public class EntriesViewModel : RoutableHostScreen<RoutableScreen>
Tabs = new ObservableCollection<RouteViewModel>
{
new("Profiles", "workshop/entries/profiles/1", "workshop/entries/profiles"),
#if DEBUG
new("Layouts", "workshop/entries/layouts/1", "workshop/entries/layouts")
#endif
};
this.WhenActivated(d =>

View File

@ -49,7 +49,7 @@
</StackPanel>
</Button>
<Button Width="150" Height="180" Command="{CompiledBinding Navigate}" CommandParameter="workshop/entries/layouts/1" VerticalContentAlignment="Top">
<Button Width="150" Height="180" Command="{CompiledBinding Navigate}" CommandParameter="workshop/entries/layouts/1" VerticalContentAlignment="Top" IsVisible="{CompiledBinding ShowLayouts}">
<StackPanel>
<avalonia:MaterialIcon Kind="KeyboardVariant" HorizontalAlignment="Left" Width="60" Height="60" Margin="0 5" />
<TextBlock TextWrapping="Wrap" FontSize="16" Margin="0 5">Layouts</TextBlock>

View File

@ -25,6 +25,12 @@ public class WorkshopHomeViewModel : RoutableScreen
this.WhenActivatedAsync(async d => WorkshopReachable = await workshopService.ValidateWorkshopStatus(d.AsCancellationToken()));
}
#if DEBUG
public bool ShowLayouts => true;
# else
public bool ShowLayouts => false;
#endif
public ReactiveCommand<Unit, Unit> AddSubmission { get; }
public ReactiveCommand<string, Unit> Navigate { get; }

View File

@ -36,7 +36,8 @@
</RadioButton.Content>
</RadioButton>
<RadioButton GroupName="EntryType"
IsChecked="{CompiledBinding SelectedEntryType, Converter={StaticResource EnumBoolConverter}, ConverterParameter={x:Static workshop:EntryType.Layout}}">
IsChecked="{CompiledBinding SelectedEntryType, Converter={StaticResource EnumBoolConverter}, ConverterParameter={x:Static workshop:EntryType.Layout}}"
IsVisible="{CompiledBinding ShowLayouts}">
<RadioButton.Content>
<StackPanel>
<TextBlock>Layout</TextBlock>

View File

@ -14,6 +14,12 @@ public class EntryTypeStepViewModel : SubmissionViewModel
GoBack = ReactiveCommand.Create(() => State.ChangeScreen<WelcomeStepViewModel>());
Continue = ReactiveCommand.Create(ExecuteContinue, this.WhenAnyValue(vm => vm.SelectedEntryType).Select(e => e != null));
}
#if DEBUG
public bool ShowLayouts => true;
# else
public bool ShowLayouts => false;
#endif
public EntryType? SelectedEntryType
{