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
1 change: 1 addition & 0 deletions WheelWizard/Views/Pages/FriendsPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<MenuItem Header="{loc:T action.view_mii}" Click="OpenCarousel_OnClick" />
<Separator />
<MenuItem Header="View Profile" Click="ViewProfile_OnClick" />
<MenuItem Header="View player on RWFC" Click="ViewOnRwfc_OnClick" />
<MenuItem Header="Remove Friend" Click="RemoveFriend_OnClick" />
<!-- <MenuItem Header="{loc:T action.save_external_mii}" Click="SaveMii_OnClick" /> -->
</ContextMenu>
Expand Down
6 changes: 6 additions & 0 deletions WheelWizard/Views/Pages/FriendsPage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ private void ViewProfile_OnClick(object sender, RoutedEventArgs e)
Popups.Create<PlayerProfileWindow>(selectedPlayer.FriendCode).Show();
}

private void ViewOnRwfc_OnClick(object sender, RoutedEventArgs e)
{
if (FriendsListView.SelectedItem is FriendProfile selectedPlayer)
ViewUtils.OpenRwfcPlayer(selectedPlayer.FriendCode);
}

private void RemoveFriend_OnClick(object sender, RoutedEventArgs e)
{
if (FriendsListView.SelectedItem is not FriendProfile selectedPlayer)
Expand Down
8 changes: 8 additions & 0 deletions WheelWizard/Views/Pages/LeaderboardPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@
<Separator />
<MenuItem Header="View Profile"
Click="ViewProfile_OnClick" />
<MenuItem Header="View player on RWFC"
Click="ViewOnRwfc_OnClick" />
</ContextMenu>
</patterns:LeaderboardPodiumCard.ContextMenu>
</patterns:LeaderboardPodiumCard>
Expand Down Expand Up @@ -227,6 +229,8 @@
<Separator />
<MenuItem Header="View Profile"
Click="ViewProfile_OnClick" />
<MenuItem Header="View player on RWFC"
Click="ViewOnRwfc_OnClick" />
</ContextMenu>
</patterns:LeaderboardPodiumCard.ContextMenu>
</patterns:LeaderboardPodiumCard>
Expand Down Expand Up @@ -255,6 +259,8 @@
<Separator />
<MenuItem Header="View Profile"
Click="ViewProfile_OnClick" />
<MenuItem Header="View player on RWFC"
Click="ViewOnRwfc_OnClick" />
</ContextMenu>
</patterns:LeaderboardPodiumCard.ContextMenu>
</patterns:LeaderboardPodiumCard>
Expand Down Expand Up @@ -287,6 +293,8 @@
<Separator />
<MenuItem Header="View Profile"
Click="ViewProfile_OnClick" />
<MenuItem Header="View player on RWFC"
Click="ViewOnRwfc_OnClick" />
</ContextMenu>
</patterns:PlayerListItem.ContextMenu>
</patterns:PlayerListItem>
Expand Down
6 changes: 6 additions & 0 deletions WheelWizard/Views/Pages/LeaderboardPage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@ private void ViewProfile_OnClick(object sender, RoutedEventArgs e)
Popups.Create<PlayerProfileWindow>(player.FriendCode).Show();
}

private void ViewOnRwfc_OnClick(object sender, RoutedEventArgs e)
{
if (GetContextPlayer(sender) is { } player)
ViewUtils.OpenRwfcPlayer(player.FriendCode);
}

private async void AddFriend_OnClick(object sender, RoutedEventArgs e)
{
var player = GetContextPlayer(sender);
Expand Down
1 change: 1 addition & 0 deletions WheelWizard/Views/Pages/RoomDetailsPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<MenuItem Header="Add Friend" Click="AddFriend_OnClick" />
<Separator />
<MenuItem Header="View Profile" Click="ViewProfile_OnClick" />
<MenuItem Header="View player on RWFC" Click="ViewOnRwfc_OnClick" />
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
Expand Down
6 changes: 6 additions & 0 deletions WheelWizard/Views/Pages/RoomDetailsPage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ private void ViewProfile_OnClick(object sender, RoutedEventArgs e)
Popups.Create<PlayerProfileWindow>(selectedPlayer.FriendCode).Show();
}

private void ViewOnRwfc_OnClick(object sender, RoutedEventArgs e)
{
if (PlayersListView.SelectedItem is RrPlayer selectedPlayer)
ViewUtils.OpenRwfcPlayer(selectedPlayer.FriendCode);
}

private async void AddFriend_OnClick(object sender, RoutedEventArgs e)
{
if (PlayersListView.SelectedItem is not RrPlayer selectedPlayer)
Expand Down
9 changes: 9 additions & 0 deletions WheelWizard/Views/ViewUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ public static void OpenLink(string link)
ShowSnackbar("Opened link");
}

public static void OpenRwfcPlayer(string? friendCode)
{
var digits = new string((friendCode ?? string.Empty).Where(char.IsAsciiDigit).ToArray());
if (digits.Length != 12)
return;

OpenLink($"https://rwfc.net/player/{digits[..4]}-{digits[4..8]}-{digits[8..]}");
}

public static void ShowSnackbar(string message, SnackbarType type = SnackbarType.Success) => GetLayout().ShowSnackbar(message, type);

public static Layout GetLayout() =>
Expand Down
Loading