Skip to content

Commit

Permalink
Merge pull request ppy#10945 from nanaya/score-preserve-notice
Browse files Browse the repository at this point in the history
Show notice on non-preserved score page
  • Loading branch information
notbakaneko authored Feb 1, 2024
2 parents ca79933 + a62dede commit a9dc7ed
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Transformers/ScoreTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function transformSolo(MultiplayerScoreLink|ScoreModel|SoloScore $score)

if ($score instanceof SoloScore) {
$extraAttributes['ranked'] = $score->ranked;
$extraAttributes['preserve'] = $score->preserve;
}

$hasReplay = $score->has_replay;
Expand Down
6 changes: 6 additions & 0 deletions resources/css/bem/wiki-notice.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
font-weight: bold;
}

&--score {
margin: 0 var(--page-gutter) 20px;
width: auto;
font-size: @font-size--wiki;
}

&--profile-page-extra {
background-color: hsl(var(--hsl-b3));
}
Expand Down
2 changes: 2 additions & 0 deletions resources/css/layout.less
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@

--navbar-height: @navbar-height;
--scroll-padding-top: calc(var(--navbar-height) + 1em + var(--scroll-padding-top-extra, 0px));
--page-gutter: @gutter-v2;

@media @desktop {
--navbar-height: @nav2-height--pinned;
--page-gutter: @gutter-v2-desktop;
}
}

Expand Down
1 change: 1 addition & 0 deletions resources/js/interfaces/solo-score-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type SoloScoreJsonDefaultAttributes = {
mods: ScoreModJson[];
passed: boolean;
pp: number | null;
preserve?: boolean;
rank: Rank;
ranked?: boolean;
ruleset_id: number;
Expand Down
8 changes: 8 additions & 0 deletions resources/js/scores-show/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import HeaderV4 from 'components/header-v4';
import { SoloScoreJsonForShow } from 'interfaces/solo-score-json';
import * as React from 'react';
import { trans } from 'utils/lang';
import BeatmapInfo from './beatmap-info';
import Info from './info';
import Stats from './stats';
Expand All @@ -25,6 +26,13 @@ export default function Main({ score }: Props) {
<Info score={score} />

<Stats beatmap={beatmap} score={score} />

{score.preserve === false && (
<div className='wiki-notice wiki-notice--score'>
<span className='fas fa-info-circle' />
{` ${trans('scores.show.non_preserved')}`}
</div>
)}
</div>
</>
);
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/scores.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

return [
'show' => [
'non_preserved' => 'This score is marked for deletion and will disappear soon.',
'title' => ':username on :title [:version]',

'beatmap' => [
Expand Down

0 comments on commit a9dc7ed

Please sign in to comment.