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
27 changes: 23 additions & 4 deletions src/app/score-window/score-window.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<label class="window-body_title_main">Here are your results for week&nbsp;<b>[{{this.currentWeek}}]</b>!</label>
<div class="window-body_title_scores">
<div class="window-body_title_scores_titles">
<label>Right answers:</label>
<label>Wrong answers:</label>
<label>Total score:</label>
<label>🟩 Right answers:</label>
<label>🟥 Wrong answers:</label>
<label>🟦 Total score:</label>
</div>
<div class="window-body_title_scores_results">
<b><label>[{{this.rightAnswers}}] answers</label></b>
Expand All @@ -17,8 +17,27 @@
</div>
</div>

<div class="window-body_previous-scores">
<label class="window-body_previous-scores_title">Here are your previous results:</label>
<ul class="tree-view">
<li>
<ng-container *ngFor="let keyValue of previousScores! | keyvalue">
<details>
<summary>🗓 Week <b>{{keyValue.key}}</b></summary>
<ul>
<li>🟩 <b>{{keyValue.value.rightAnswers}}</b> right answers</li>
<li>🟥 <b>{{keyValue.value.wrongAnswers}}</b> wrong answers</li>
<li>🟦 <b>{{keyValue.value.score}}</b> total points</li>
</ul>
</details>
</ng-container>
</li>
</ul>
</div>

<div class="window-body_buttons">
<app-icon-button iconPath="copy.png" title="Share score" [copy-clipboard]="this.clipboardText" (click)="this.showClipboardMessage()"></app-icon-button>
<app-icon-button iconPath="copy.png" title="Share score" [copy-clipboard]="this.clipboardText"
(click)="this.showClipboardMessage()"></app-icon-button>
<app-icon-button iconPath="home.png" title="Return to home"
(onButtonClick)="this.returnHome()"></app-icon-button>
</div>
Expand Down
14 changes: 14 additions & 0 deletions src/app/score-window/score-window.component.sass
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,17 @@
color: green
font-weight: bold
margin: 5px

&_previous-scores
width: 100%
display: flex
flex-direction: column
align-items: center
justify-content: center

.tree-view
margin: 5px
width: 200px
max-height: 200px
overflow: auto

5 changes: 5 additions & 0 deletions src/app/score-window/score-window.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class ScoreWindowComponent implements OnInit {
public currentWeek: number = 0;
public rightAnswers: number = 0;
public wrongAnswers: number = 0;
public previousScores: Map<number, WeekScore> | null = null;
public clipboardText: string = '';
public displayClipboardMessage: boolean = false;

Expand Down Expand Up @@ -58,7 +59,11 @@ export class ScoreWindowComponent implements OnInit {
private retrieveScore(): void {
const currentWeek: number = moment().isoWeek();
const currentWeekScore: WeekScore = this.appStorageService.retrieveScoreByWeek(currentWeek);
const previousScoresMap: Map<number, WeekScore> = this.appStorageService.retrieveAppStorage().weekScoreMap!;

// previousScoresMap.delete(currentWeek);

this.previousScores = previousScoresMap;
this.currentScore = currentWeekScore.score;
this.rightAnswers = currentWeekScore.rightAnswers;
this.wrongAnswers = currentWeekScore.wrongAnswers;
Expand Down