Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move links to top of launcher and fix changelog entries not being aligned #205

Merged
merged 2 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added UnitystationLauncher/Assets/world-wide-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions UnitystationLauncher/ViewModels/LauncherViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Reactive;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reactive.Concurrency;
using Serilog;
using System.Reactive.Linq;
Expand All @@ -20,6 +21,10 @@ public class LauncherViewModel : ViewModelBase
private readonly IPreferencesService _preferencesService;
private readonly IEnvironmentService _environmentService;

public ReactiveCommand<Unit, Unit> OpenMainSite { get; }
public ReactiveCommand<Unit, Unit> OpenPatreon { get; }
public ReactiveCommand<Unit, Unit> OpenDiscordInvite { get; }

PanelBase[] _panels;
ViewModelBase? _selectedPanel;

Expand Down Expand Up @@ -52,6 +57,10 @@ public LauncherViewModel(
_preferencesService = preferencesService;
_environmentService = environmentService;

OpenMainSite = ReactiveCommand.Create(() => OpenLink(LinkUrls.MainSiteUrl));
OpenPatreon = ReactiveCommand.Create(() => OpenLink(LinkUrls.PatreonUrl));
OpenDiscordInvite = ReactiveCommand.Create(() => OpenLink(LinkUrls.DiscordInviteUrl));

_panels = GetEnabledPanels(newsPanel, serversPanel, installationsPanel, settingsPanel);
ShowUpdateView = ReactiveCommand.Create(ShowUpdateImp);
SelectedPanel = serversPanel;
Expand Down Expand Up @@ -120,6 +129,17 @@ private async Task ValidateClientVersionAsync()
}
}

private static void OpenLink(string url)
{
ProcessStartInfo psi = new()
{
FileName = url,
UseShellExecute = true
};

Process.Start(psi);
}

private HubUpdateViewModel ShowUpdateImp()
{
return _hubUpdateVm.Value;
Expand Down
22 changes: 0 additions & 22 deletions UnitystationLauncher/ViewModels/NewsPanelViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ public string NewsHeader
set => this.RaiseAndSetIfChanged(ref _newsHeader, value);
}

public ReactiveCommand<Unit, Unit> OpenMainSite { get; }
public ReactiveCommand<Unit, Unit> OpenPatreon { get; }
public ReactiveCommand<Unit, Unit> OpenGameIssues { get; }
public ReactiveCommand<Unit, Unit> OpenLauncherIssues { get; }
public ReactiveCommand<Unit, Unit> OpenDiscordInvite { get; }
public ReactiveCommand<Unit, Unit> NextBlog { get; }
public ReactiveCommand<Unit, Unit> PreviousBlog { get; }
private int CurrentBlogPostIndex { get; set; }
Expand All @@ -54,12 +49,6 @@ public NewsPanelViewModel(ChangelogViewModel changelog, IBlogService blogService
_changelog = changelog;
_blogService = blogService;

OpenMainSite = ReactiveCommand.Create(() => OpenLink(LinkUrls.MainSiteUrl));
OpenPatreon = ReactiveCommand.Create(() => OpenLink(LinkUrls.PatreonUrl));
OpenGameIssues = ReactiveCommand.Create(() => OpenLink(LinkUrls.GameIssuesUrl));
OpenLauncherIssues = ReactiveCommand.Create(() => OpenLink(LinkUrls.LauncherIssuesUrl));
OpenDiscordInvite = ReactiveCommand.Create(() => OpenLink(LinkUrls.DiscordInviteUrl));

BlogPosts = new();
FetchBlogPosts();
NextBlog = ReactiveCommand.Create(NextPost);
Expand Down Expand Up @@ -124,16 +113,5 @@ private void SetCurrentBlogPost()
NewsHeader = $"News ({CurrentBlogPostIndex + 1}/{BlogPosts.Count})";
CurrentBlogPost = BlogPosts[CurrentBlogPostIndex];
}

private static void OpenLink(string url)
{
ProcessStartInfo psi = new()
{
FileName = url,
UseShellExecute = true
};

Process.Start(psi);
}
}
}
2 changes: 1 addition & 1 deletion UnitystationLauncher/Views/ChangeView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="UnitystationLauncher.Views.ChangeView">
<Button Margin="5" Background="{StaticResource Primary3}" Command="{Binding OnClick}">
<StackPanel>
<StackPanel HorizontalAlignment="Left" Width="{Binding $parent[Button].Bounds.Width}">
<TextBlock Text="{Binding Type}" TextWrapping="Wrap" Margin="2" FontWeight="Light" />
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="2" />
<TextBlock Text="{Binding AuthorAndPr}" TextWrapping="Wrap" Margin="2" FontWeight="Light" />
Expand Down
23 changes: 17 additions & 6 deletions UnitystationLauncher/Views/LauncherView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
Background="Transparent"
x:Class="UnitystationLauncher.Views.LauncherView">
<Grid RowDefinitions="54,*">
<StackPanel Background="#1d3b50" Grid.Row="0" Orientation="Horizontal">
<Border Margin="5 5 0 6">
<Grid Background="#1d3b50" Grid.Row="0" ColumnDefinitions="54,*,130">
<Border Margin="5 5 0 6" Grid.Column="0">
<Image Source="avares://StationHub/Assets/unityico.png" Margin="0 2 1 2" />
</Border>

<ListBox Items="{Binding Panels}" SelectedItem="{Binding SelectedPanel}" BorderThickness="0"
ScrollViewer.VerticalScrollBarVisibility="Disabled" Background="Transparent"
HorizontalAlignment="Left">
HorizontalAlignment="Left" Grid.Column="1">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
Expand All @@ -28,14 +28,14 @@
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
<Setter Property="Background">
<Setter.Value>
<ImageBrush Source="/Assets/activaty_page.png" AlignmentY="Bottom" AlignmentX="Center" />
<ImageBrush Source="avares://StationHub/Assets/activaty_page.png" AlignmentY="Bottom" AlignmentX="Center" />
</Setter.Value>
</Setter>
</Style>
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
<Setter Property="Background">
<Setter.Value>
<ImageBrush Source="/Assets/activaty_page.png" AlignmentY="Bottom" AlignmentX="Center" />
<ImageBrush Source="avares://StationHub/Assets/activaty_page.png" AlignmentY="Bottom" AlignmentX="Center" />
</Setter.Value>
</Setter>
</Style>
Expand All @@ -48,7 +48,18 @@
</DataTemplate>
</ListBox.DataTemplates>
</ListBox>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<Button Background="Transparent" BorderThickness="0" Command="{Binding OpenMainSite}">
<Image Source="avares://StationHub/Assets/world-wide-web.png" Height="30" />
</Button>
<Button Background="Transparent" BorderThickness="0" Command="{Binding OpenPatreon}">
<Image Source="avares://StationHub/Assets/Digital-Patreon-Logo_White.png" Height="30" />
</Button>
<Button Background="Transparent" BorderThickness="0" Command="{Binding OpenDiscordInvite}">
<Image Source="avares://StationHub/Assets/discord-mark-white.png" Height="30" />
</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<Border>
<UserControl Content="{Binding SelectedPanel}" />
Expand Down
17 changes: 0 additions & 17 deletions UnitystationLauncher/Views/NewsPanelView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,6 @@
</Button>
</Grid>
</Grid>
<WrapPanel Grid.Row="2">
<Button Height="37" VerticalAlignment="Center" Margin="2" Command="{Binding OpenMainSite}">
<TextBlock FontWeight="Bold" FontSize="20" TextAlignment="Left">Official Site</TextBlock>
</Button>
<Button Height="37" VerticalAlignment="Center" Margin="2" Command="{Binding OpenPatreon}">
<TextBlock FontWeight="Bold" FontSize="20" TextAlignment="Left">Support us on Patreon</TextBlock>
</Button>
<Button Height="37" VerticalAlignment="Center" Margin="2" Command="{Binding OpenGameIssues}">
<TextBlock FontWeight="Bold" FontSize="20" TextAlignment="Left">Report Game Bug</TextBlock>
</Button>
<Button Height="37" VerticalAlignment="Center" Margin="2" Command="{Binding OpenLauncherIssues}">
<TextBlock FontWeight="Bold" FontSize="20" TextAlignment="Left">Report Launcher Bug</TextBlock>
</Button>
<Button Height="37" VerticalAlignment="Center" Margin="2" Command="{Binding OpenDiscordInvite}">
<TextBlock FontWeight="Bold" FontSize="20" TextAlignment="Left">Join Discord</TextBlock>
</Button>
</WrapPanel>
</Grid>
</Grid>
</UserControl>
6 changes: 3 additions & 3 deletions UnitystationLauncher/Views/VersionView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="UnitystationLauncher.Views.VersionView">
<StackPanel Margin="5" Background="{StaticResource Primary2}">
<TextBlock Text="{Binding Version}" TextWrapping="Wrap" Margin="2" />
<TextBlock Text="{Binding Date}" TextWrapping="Wrap" Margin="2" FontWeight="Light" />
<TextBlock Text="{Binding Version}" TextWrapping="Wrap" Margin="5, 3" FontSize="18" />
<TextBlock Text="{Binding Date}" TextWrapping="Wrap" Margin="5, 2" FontWeight="Light" />
<TextBlock Text="No registered changes in this build" IsVisible="{Binding NoRegisteredChanges}" TextWrapping="Wrap" Margin="2" FontWeight="Light" />
<ItemsControl Items="{Binding Changes}" FontSize="12"/>
<ItemsControl Items="{Binding Changes}" FontSize="12" />
</StackPanel>
</UserControl>