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

Added avatars and rank summary to user profile cards #7518

Closed
wants to merge 10 commits into from

Conversation

Xetera
Copy link
Contributor

@Xetera Xetera commented Apr 22, 2021

Before:
image

After:
image

I wasn't able to test for cases where the user doesn't have a global rank since mysql doesn't let me set null values on user ranks but I know profiles that don't have global ranks like https://osu.ppy.sh/users/4198271 exist. If that needs to be tested before this is merged I might need a little help with it 🙏.

@peppy
Copy link
Sponsor Member

peppy commented Apr 23, 2021

It doesn't let you set null because that's not how it works. You can check existing usages and display which you should share logic with (or at very least follow the same conditional and formatting paths).

The formatting should match existing displays everywhere, which it doesn't right now.

@Xetera
Copy link
Contributor Author

Xetera commented Apr 23, 2021

By matching formatting are you referring to displaying the stats as something like this?

Peppy's profile

Global Ranking: #69,420
Country Ranking: #1,337

On the frontend the number formatting is being done with osu.formatNumber but from what I'm seeing there's no logic for it on the php side. https://www.php.net/manual/en/function.number-format.php behaves the same way as the js function, I'm guessing it would be fine to use that instead of duplicating the same function logic?

@peppy
Copy link
Sponsor Member

peppy commented Apr 23, 2021

Seems better, for sure.

$globalRankLabel = trans('users.show.rank.global_simple');
$globalRankValue = number_format($stats["global_rank"]);
$countryRankLabel = trans('users.show.rank.country_simple');
$countryRankValue = number_format($stats["country_rank"]);
Copy link
Collaborator

@nanaya nanaya Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will cause error when the user doesn't have any stats. And this will render 0 (converted from null) if the user isn't ranked (when both either rank_score and or rank_score_index are 0).

$userData = $jsonChunks["user"];
$stats = $userData["statistics"];
$globalRankLabel = trans('users.show.rank.global_simple');
$globalRankValue = number_format($stats["global_rank"]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use i18n_number_format

'titlePrepend' => blade_safe(str_replace(' ', ' ', e($user->username))),
'pageDescription' => page_description($user->username),
'pageDescription' => "{$globalRankLabel}: #{$globalRankValue}\n{$countryRankLabel}: #{$countryRankValue}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not actually expected to have newlines in description. For example twitter will render this like so:

@@ -2,9 +2,24 @@
Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0.
See the LICENCE file in the repository root for full licence text.
--}}

@php
$userData = $jsonChunks["user"];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use ' for quotes

@extends('master', [
'canonicalUrl' => $user->url(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this one. The canonical url for user page for specific mode (/users/0/mania) is probably the page for specific mode itself (/users/0/mania) not the default one (/users/0).

@php
$userData = $jsonChunks["user"];
$stats = $userData["statistics"];
$globalRankLabel = trans('users.show.rank.global_simple');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the label is missing which mode the rank is for

@peppy
Copy link
Sponsor Member

peppy commented Jul 20, 2021

@Xetera are you still interested in applying the review for this pull request? it should be in a good state to get merged if you follow up on that.

@Xetera
Copy link
Contributor Author

Xetera commented Jul 31, 2021

Ah sorry, I got a little overwhelmed by the requested changes after I realized the scope of this is bigger than I thought. I'll try to see if I can address some of these over the weekend. Forgot osu had more than 1 game mode kekw

@notbakaneko notbakaneko self-assigned this Sep 20, 2023
@notbakaneko
Copy link
Collaborator

I'm taking over this (and the related ogp issue, I guess 👀 )

@notbakaneko
Copy link
Collaborator

superseded by #10570 since I can't push to this branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants