Skip to content

Commit 16a65c9

Browse files
committed
feat(ui): add Rust leaderboard rank alert to course completion
Replace the generic info alert with a custom RoadmapInfoAlert component showing the user's Rust leaderboard rank. Animate rank appearance with a fade transition and loading placeholder. This improves feedback on course progression by highlighting leaderboard status in a visually distinct alert.
1 parent ea20e02 commit 16a65c9

File tree

3 files changed

+52
-17
lines changed

3 files changed

+52
-17
lines changed

app/components/course-page/current-step-complete-modal.hbs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@
44
🎉
55
</div>
66

7-
<div class="mb-1 font-bold text-2xl text-gray-700 dark:text-gray-100">
7+
<div class="mb-5 font-bold text-2xl text-gray-700 dark:text-gray-100">
88
{{if (eq this.currentStep.type "CourseStageStep") "Stage Completed!" "Step Completed!"}}
99
</div>
1010

11-
<div class="prose dark:prose-invert mb-5" data-test-completion-message>
11+
{{!-- <div class="prose dark:prose-invert mb-5" data-test-completion-message>
1212
<p>
1313
{{this.currentStep.completionNoticeMessage}}
1414
</p>
15-
</div>
15+
</div> --}}
16+
17+
{{! <AlertWithIcon @icon="presentation-chart-line" @type="success" class="mb-5">
18+
Your leaderboard rank is now
19+
<b>#1456</b>.
20+
</AlertWithIcon> }}
21+
22+
<RoadmapInfoAlert @heading="Rust leaderboard" class="mb-5">
23+
Your leaderboard rank is now
24+
<b>#1456</b>.
25+
</RoadmapInfoAlert>
1626

1727
<PrimaryLinkButton
1828
@route={{this.stepForNextOrActiveStepButton.routeParams.route}}
Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
<Alert @color="blue" class="p-5" ...attributes>
2-
<div class="prose prose-sm dark:prose-invert prose-blue prose-compact">
3-
<h4>
4-
<div class="flex items-center gap-1">
5-
{{svg-jar "information-circle" class="w-5 h-5 fill-current text-blue-500/80"}}
6-
<span>
7-
{{@heading}}
8-
</span>
1+
<div
2+
class="relative p-5 pb-6 w-full max-w-xs group cursor-pointer bg-teal-100/20 hover:bg-teal-100/30 dark:bg-teal-900/20 border-teal-500/60 dark:border-teal-500/40 border rounded-sm transition-colors duration-100"
3+
...attributes
4+
>
5+
<div class="flex flex-col items-center">
6+
{{svg-jar "presentation-chart-line" class="w-8 h-8 fill-current text-teal-500/90 mb-2"}}
7+
8+
<span class="text-teal-700 text-xs mb-0.5 text-center">
9+
Your Rust leaderboard rank is
10+
</span>
11+
12+
<AnimatedContainer>
13+
<div class="flex items-center w-full justify-center">
14+
{{#animated-if (eq this.rank null) use=this.transition duration=300}}
15+
<b class="text-2xl text-teal-600 border-b border-teal-600 group-hover:text-teal-500 border-dashed animate-pulse">
16+
# ⋯
17+
</b>
18+
{{else}}
19+
<b class="text-2xl text-teal-600 border-b border-teal-600 group-hover:text-teal-500 border-dashed">
20+
#{{format-number this.rank}}
21+
</b>
22+
{{/animated-if}}
923
</div>
10-
</h4>
11-
<p>
12-
{{yield}}
13-
</p>
24+
</AnimatedContainer>
1425
</div>
15-
</Alert>
26+
</div>

app/components/roadmap-info-alert.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import Component from '@glimmer/component';
2+
import { tracked } from '@glimmer/tracking';
3+
import fade from 'ember-animated/transitions/fade';
24

35
interface Signature {
46
Element: HTMLDivElement;
@@ -10,7 +12,19 @@ interface Signature {
1012
};
1113
}
1214

13-
export default class RoadmapInfoAlert extends Component<Signature> {}
15+
export default class RoadmapInfoAlert extends Component<Signature> {
16+
transition = fade;
17+
18+
@tracked rank: number | null = null;
19+
20+
constructor(owner: unknown, args: Signature['Args']) {
21+
super(owner, args);
22+
23+
setTimeout(() => {
24+
this.rank = 15578;
25+
}, 1350);
26+
}
27+
}
1428

1529
declare module '@glint/environment-ember-loose/registry' {
1630
export default interface Registry {

0 commit comments

Comments
 (0)