Skip to content
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
272 changes: 186 additions & 86 deletions WheelWizard/Views/Layout.axaml

Large diffs are not rendered by default.

57 changes: 49 additions & 8 deletions WheelWizard/Views/Layout.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using WheelWizard.Utilities.RepeatedTasks;
using WheelWizard.Views.Components;
using WheelWizard.Views.Pages;
using WheelWizard.Views.Pages.Settings;
using WheelWizard.Views.Patterns;
using WheelWizard.Views.Popups.Generic;
using WheelWizard.WheelWizardData.Domain;
Expand Down Expand Up @@ -109,6 +110,7 @@ protected override void OnLoaded(RoutedEventArgs e)
{
Title = BrandingService.Branding.DisplayName;
TitleLabel.Text = BrandingService.Branding.DisplayName;
VersionTagText.Text = $"v{BrandingService.Branding.Version}";
UpdateModsButtonText();
// UpdateModsActionIndicator();

Expand All @@ -128,6 +130,7 @@ private void OnLanguageChanged(object? sender, EventArgs e)
{
UpdateModsButtonText();
UpdateMadeByText();
UpdateLiveAlert();
}

private void UpdateMadeByText()
Expand Down Expand Up @@ -249,17 +252,18 @@ public void UpdateFriendCount()
FriendsButton.BoxTip = t("hover.friends_online.n", friends.Count(friend => friend.IsOnline));
}

public void UpdateSidebarProfile() => SidebarCurrentUserProfile.Refresh();

public void UpdatePlayerAndRoomCount(RRLiveRooms sender)
{
var playerCount = sender.PlayerCount;
var roomCount = sender.RoomCount;
PlayerCountBox.Text = playerCount.ToString();
PlayerCountBox.TipText = t("hover.players_online.n", playerCount);
RoomCountBox.Text = roomCount.ToString();
RoomCountBox.TipText = t("hover.rooms_online.n", roomCount);
RoomsButton.BoxText = playerCount.ToString();
RoomsButton.BoxTip = t("hover.players_online.n", playerCount);
UpdateFriendCount();
}

public void UpdateLiveAlert() => UpdateLiveAlert(WhWzStatusManager.Instance);

private void UpdateLiveAlert(WhWzStatusManager sender)
{
var hasVariant = sender.Status?.Variant != null && sender.Status.Variant != WhWzStatusVariant.None;
Expand All @@ -272,6 +276,7 @@ private void UpdateLiveAlert(WhWzStatusManager sender)

ToolTip.SetTip(LiveStatusBorder, sender.Status!.Message);
LiveStatusBorder.Classes.Clear();
LiveStatusBorder.Classes.Add("BottomSidebarIcon");

// If custom icon is provided, use it instead of variant
if (hasCustomIcon)
Expand Down Expand Up @@ -362,15 +367,51 @@ private void UpdateTestingButtonVisibility()
TestingButton.IsVisible = SettingsService.Get<bool>(SettingsService.TESTING_MODE_ENABLED);
}

private void SidebarInfoButton_OnPointerPressed(object? sender, PointerPressedEventArgs e)
{
SidebarInfoContextMenu.Open();
e.Handled = true;
}

private void SidebarProfileBlock_OnPointerEntered(object? sender, PointerEventArgs e)
{
SidebarProfileBlock.Background = GetResourceBrush("Neutral800");
SidebarProfileBlock.BorderBrush = GetResourceBrush("Primary400");
SidebarProfileHoverEffect.IsVisible = true;
}

private void SidebarProfileBlock_OnPointerExited(object? sender, PointerEventArgs e)
{
SidebarProfileBlock.Background = Brushes.Transparent;
SidebarProfileBlock.BorderBrush = GetResourceBrush("Neutral600");
SidebarProfileHoverEffect.IsVisible = false;
}

private void SidebarProfileBlock_OnPointerMoved(object? sender, PointerEventArgs e)
{
var position = e.GetPosition(sender as Control);
SidebarProfileHoverEffect.Margin = new(
position.X - (SidebarProfileHoverEffect.Width / 2),
position.Y - (SidebarProfileHoverEffect.Height / 2),
0,
0
);
}

private static IBrush GetResourceBrush(string resourceName) =>
new SolidColorBrush((Color)Application.Current!.FindResource(resourceName)!);

private void CloseButton_Click(object? sender, RoutedEventArgs e) => Close();

private void MinimizeButton_Click(object? sender, RoutedEventArgs e) => WindowState = WindowState.Minimized;

private void Discord_Click(object sender, EventArgs e) => ViewUtils.OpenLink(BrandingService.Branding.DiscordUrl.ToString());
private void Discord_Click(object? sender, RoutedEventArgs e) => ViewUtils.OpenLink(BrandingService.Branding.DiscordUrl.ToString());

private void Github_Click(object? sender, RoutedEventArgs e) => ViewUtils.OpenLink(BrandingService.Branding.RepositoryUrl.ToString());

private void Github_Click(object sender, EventArgs e) => ViewUtils.OpenLink(BrandingService.Branding.RepositoryUrl.ToString());
private void Support_Click(object? sender, RoutedEventArgs e) => ViewUtils.OpenLink(BrandingService.Branding.SupportUrl.ToString());

private void Support_Click(object sender, EventArgs e) => ViewUtils.OpenLink(BrandingService.Branding.SupportUrl.ToString());
private void About_Click(object? sender, RoutedEventArgs e) => NavigationManager.NavigateTo<SettingsPage>(new AppInfo());

private void CloseSnackbar_OnClick(object? sender, EventArgs e)
{
Expand Down
4 changes: 0 additions & 4 deletions WheelWizard/Views/Pages/FriendsPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
</Border>
</StackPanel>

<patterns:CurrentUserProfile Grid.Row="0" x:Name="CurrentUserProfile" Margin="10,0"
HorizontalAlignment="Right" VerticalAlignment="Top" />


<Grid Grid.Row="1" x:Name="VisibleWhenFriends" RowDefinitions="*, 12*">
<Grid Grid.Row="0" Margin="10,0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,6"
Expand Down
3 changes: 0 additions & 3 deletions WheelWizard/Views/Pages/HomePage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@
<Border Grid.Row="1" Background="{StaticResource BackgroundLineColor}" Height="1" HorizontalAlignment="Stretch"
VerticalAlignment="Bottom" />

<behaviorComponent:CurrentUserProfile Grid.Row="0" x:Name="CurrentUserProfile" Margin="10,0"
HorizontalAlignment="Right" VerticalAlignment="Top" />

<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Top" Margin="0,6"
HorizontalAlignment="Right"
x:Name="GameModeOption">
Expand Down
24 changes: 4 additions & 20 deletions WheelWizard/Views/Pages/LeaderboardPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,10 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom" />

<Grid Grid.Row="0" ColumnDefinitions="*,Auto">
<StackPanel Orientation="Horizontal"
VerticalAlignment="Bottom"
Spacing="8">
<TextBlock Text="Leaderboard"
Classes="PageTitleText" />
<PathIcon Data="{StaticResource Award}"
Width="16"
Height="16"
VerticalAlignment="Center"
Foreground="{StaticResource Warning500}" />
</StackPanel>
<components:StateBox Grid.Column="1"
VerticalAlignment="Bottom"
Margin="0,0,6,10"
IconData="{StaticResource UserCouple}"
Variant="Dark"
Text="{Binding TotalPlayerCountText}"
TipText="Top 50 players" />
</Grid>
<TextBlock Grid.Row="0"
Text="Leaderboard"
VerticalAlignment="Bottom"
Classes="PageTitleText" />

<Grid Grid.Row="1">
<StackPanel IsVisible="{Binding IsLoading}"
Expand Down
9 changes: 0 additions & 9 deletions WheelWizard/Views/Pages/LeaderboardPage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public partial class LeaderboardPage : UserControlBase, INotifyPropertyChanged
private bool _hasNoData;
private bool _hasData;
private string _errorMessage = string.Empty;
private int _loadedPlayerCount;
private LeaderboardPlayerItem? _podiumFirst;
private LeaderboardPlayerItem? _podiumSecond;
private LeaderboardPlayerItem? _podiumThird;
Expand Down Expand Up @@ -145,8 +144,6 @@ private set
}
}

public string TotalPlayerCountText => _loadedPlayerCount.ToString();

public string RemainingCountText => $"{RemainingPlayers.Count} players";

public LeaderboardPlayerItem? PodiumFirst
Expand Down Expand Up @@ -268,9 +265,6 @@ private async Task ReloadLeaderboardAsync()
if (cancellationToken.IsCancellationRequested)
return;

_loadedPlayerCount = mappedPlayers.Count;
OnPropertyChanged(nameof(TotalPlayerCountText));

PodiumFirst = mappedPlayers.ElementAtOrDefault(0);
PodiumSecond = mappedPlayers.ElementAtOrDefault(1);
PodiumThird = mappedPlayers.ElementAtOrDefault(2);
Expand Down Expand Up @@ -409,9 +403,6 @@ private void ClearLeaderboardData()
PodiumSecond = null;
PodiumThird = null;
RemainingPlayers.Clear();
_loadedPlayerCount = 0;

OnPropertyChanged(nameof(TotalPlayerCountText));
OnPropertyChanged(nameof(RemainingCountText));
}

Expand Down
122 changes: 63 additions & 59 deletions WheelWizard/Views/Pages/MiiListPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,73 +16,77 @@
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="{StaticResource BackgroundLineColor}" Height="1" HorizontalAlignment="Stretch"
VerticalAlignment="Bottom" />
<TextBlock Grid.Row="0" Text="{loc:T page_title.my_miis}" HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Classes="PageTitleText" />
<Grid Grid.Row="0" ColumnDefinitions="*,Auto">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Spacing="8">
<TextBlock Text="{loc:T page_title.my_miis}"
Classes="PageTitleText" />
<components:StateBox Text="0"
IconSize="0"
x:Name="ListItemCount"
VerticalAlignment="Center" />
</StackPanel>

<StackPanel Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="0,0,6,10"
Orientation="Horizontal"
Spacing="6"
IsVisible="{Binding IsVisible, ElementName=VisibleWhenDb}">
<components:Button Text="" Click="FavMii_OnClick" x:Name="FavoriteMiiButton"
Variant="Default" Padding="10"
ToolTip.ShowDelay="0" ToolTip.Placement="Top">
<components:Button.Styles>
<Style Selector="components|Button">
<Setter Property="IconData" Value="{StaticResource StarIcon}"/>
<Setter Property="ToolTip.Tip" Value="{loc:T action.favorite}"/>
</Style>
<Style Selector="components|Button.UnFav">
<Setter Property="IconData" Value="{StaticResource EmptyStarIcon}"/>
<Setter Property="ToolTip.Tip" Value="{loc:T action.unfavorite}"/>
</Style>
</components:Button.Styles>
</components:Button>
<components:Button Text="" Click="EditMii_OnClick" x:Name="EditMiisButton"
IconData="{StaticResource Pen}"
Variant="Default" Padding="10" IsVisible="False"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.edit}" />
<components:Button Text="" Click="DuplicateMii_OnClick" x:Name="DuplicateMiisButton"
IconData="{StaticResource Duplicate}"
Variant="Default" Padding="10" IsVisible="False"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.duplicate}" />
<components:Button Text="" Click="ExportMii_OnClick" x:Name="ExportMiisButton"
IconData="{StaticResource FileExport}"
Variant="Default" Padding="10" IsVisible="False"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.export}" />
<components:Button Text="" Click="DeleteMii_OnClick" x:Name="DeleteMiisButton"
IconData="{StaticResource Trash}"
Variant="Danger" Padding="10" IsVisible="False"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.delete}" />
<components:Button Text="" Click="ImportMii_OnClick" x:Name="ImportMiiButton"
IconData="{StaticResource FileImport}"
Variant="Default" Padding="10"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.import}" />
</StackPanel>
</Grid>
<Border Grid.Row="1" Background="{StaticResource BackgroundLineColor}" Height="1" HorizontalAlignment="Stretch"
VerticalAlignment="Bottom" />

<behaviorComponent:CurrentUserProfile Grid.Row="0" x:Name="CurrentUserProfile" Margin="10,0"
HorizontalAlignment="Right" VerticalAlignment="Top" />

<components:EmptyPageInfo Grid.Row="1" x:Name="VisibleWhenNoDb"
HorizontalAlignment="Center" IsVisible="False"
Title="{loc:T empty_content.no_miis_title}"
BodyText="{loc:T empty_content.no_miis}" />

<Grid x:Name="VisibleWhenDb" Grid.Row="1" RowDefinitions="54,*">
<Grid Grid.Row="0" Margin="10,0">
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal"
Spacing="6">
<components:Button Text="" Click="FavMii_OnClick" x:Name="FavoriteMiiButton"
Variant="Default" Padding="10"
ToolTip.ShowDelay="0" ToolTip.Placement="Top">
<components:Button.Styles>
<Style Selector="components|Button">
<Setter Property="IconData" Value="{StaticResource StarIcon}"/>
<Setter Property="ToolTip.Tip" Value="{loc:T action.favorite}"/>
</Style>
<Style Selector="components|Button.UnFav">
<Setter Property="IconData" Value="{StaticResource EmptyStarIcon}"/>
<Setter Property="ToolTip.Tip" Value="{loc:T action.unfavorite}"/>
</Style>
</components:Button.Styles>
</components:Button>
<components:Button Text="" Click="EditMii_OnClick" x:Name="EditMiisButton"
IconData="{StaticResource Pen}"
Variant="Default" Padding="10" IsVisible="False"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.edit}" />
<components:Button Text="" Click="DuplicateMii_OnClick" x:Name="DuplicateMiisButton"
IconData="{StaticResource Duplicate}"
Variant="Default" Padding="10" IsVisible="False"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.duplicate}" />
<components:Button Text="" Click="ExportMii_OnClick" x:Name="ExportMiisButton"
IconData="{StaticResource FileExport}"
Variant="Default" Padding="10" IsVisible="False"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.export}" />
<components:Button Text="" Click="DeleteMii_OnClick" x:Name="DeleteMiisButton"
IconData="{StaticResource Trash}"
Variant="Danger" Padding="10" IsVisible="False"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.delete}" />
<components:Button Text="" Click="ImportMii_OnClick" x:Name="ImportMiiButton"
IconData="{StaticResource FileImport}"
Variant="Default" Padding="10"
ToolTip.ShowDelay="0" ToolTip.Placement="Top"
ToolTip.Tip="{loc:T action.import}" />
</StackPanel>

<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" Margin="0,6">
<components:FormFieldLabel Text="{loc:T list_title.miis}" />
<components:StateBox Text="0" IconSize="0" x:Name="ListItemCount" />
</StackPanel>
<Border Background="{StaticResource BackgroundLineColor}" Height="1" HorizontalAlignment="Stretch"
VerticalAlignment="Bottom" />
</Grid>
<ListBox Grid.Row="1" x:Name="MiiList" SelectionMode="Single" BorderThickness="0"
<Grid x:Name="VisibleWhenDb" Grid.Row="1">
<ListBox x:Name="MiiList" SelectionMode="Single" BorderThickness="0"
Background="Transparent" Padding="0" ItemsSource="{Binding MiiRows}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto">
Expand Down
12 changes: 12 additions & 0 deletions WheelWizard/Views/Pages/SettingsPage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public SettingsPage(UserControl initialSettingsPage)
#endif

SettingsContent.Content = initialSettingsPage;
SetCheckedTopBarButton(initialSettingsPage);
}

private void TopBarRadio_OnClick(object? sender, RoutedEventArgs e)
Expand All @@ -39,5 +40,16 @@ private void TopBarRadio_OnClick(object? sender, RoutedEventArgs e)
SettingsContent.Content = instance;
}

private void SetCheckedTopBarButton(UserControl settingsPage)
{
foreach (var child in SettingPages.Children)
{
if (child is not RadioButton radioButton)
continue;

radioButton.IsChecked = radioButton.Tag?.ToString() == settingsPage.GetType().Name;
}
}

private void DevButton_OnClick(object? sender, RoutedEventArgs e) => new DevToolWindow().Show();
}
Loading
Loading