1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +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> <TrayIcon.Menu>
<NativeMenu> <NativeMenu>
<NativeMenuItem Header="Home" Command="{CompiledBinding OpenScreen}" CommandParameter="home" /> <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="Surface Editor" Command="{CompiledBinding OpenScreen}" CommandParameter="surface-editor" />
<NativeMenuItem Header="Settings" Command="{CompiledBinding OpenScreen}" CommandParameter="settings" /> <NativeMenuItem Header="Settings" Command="{CompiledBinding OpenScreen}" CommandParameter="settings" />
<NativeMenuItemSeparator /> <NativeMenuItemSeparator />

View File

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

View File

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

View File

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

View File

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

View File

@ -3,8 +3,7 @@ using System.Reactive.Disposables;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using Avalonia.ReactiveUI; using Avalonia.ReactiveUI;
using Avalonia.Threading; using Avalonia.Threading;
using FluentAvalonia.UI.Media.Animation; using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Navigation;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Settings; namespace Artemis.UI.Screens.Settings;
@ -19,6 +18,11 @@ public partial class SettingsView : ReactiveUserControl<SettingsViewModel>
private void Navigate(ViewModelBase viewModel) 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) if (SelectedTab == null)
await _router.Navigate(SettingTabs.First().Path); await _router.Navigate(SettingTabs.First().Path);
} }
public void GoBack()
{
_router.Navigate("workshop");
}
} }

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@
</StackPanel> </StackPanel>
</Button> </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> <StackPanel>
<avalonia:MaterialIcon Kind="KeyboardVariant" HorizontalAlignment="Left" Width="60" Height="60" Margin="0 5" /> <avalonia:MaterialIcon Kind="KeyboardVariant" HorizontalAlignment="Left" Width="60" Height="60" Margin="0 5" />
<TextBlock TextWrapping="Wrap" FontSize="16" Margin="0 5">Layouts</TextBlock> <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())); 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<Unit, Unit> AddSubmission { get; }
public ReactiveCommand<string, Unit> Navigate { get; } public ReactiveCommand<string, Unit> Navigate { get; }

View File

@ -36,7 +36,8 @@
</RadioButton.Content> </RadioButton.Content>
</RadioButton> </RadioButton>
<RadioButton GroupName="EntryType" <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> <RadioButton.Content>
<StackPanel> <StackPanel>
<TextBlock>Layout</TextBlock> <TextBlock>Layout</TextBlock>

View File

@ -14,6 +14,12 @@ public class EntryTypeStepViewModel : SubmissionViewModel
GoBack = ReactiveCommand.Create(() => State.ChangeScreen<WelcomeStepViewModel>()); GoBack = ReactiveCommand.Create(() => State.ChangeScreen<WelcomeStepViewModel>());
Continue = ReactiveCommand.Create(ExecuteContinue, this.WhenAnyValue(vm => vm.SelectedEntryType).Select(e => e != null)); 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 public EntryType? SelectedEntryType
{ {