-
-
Notifications
You must be signed in to change notification settings - Fork 367
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 Time Spent Reading By Year and Hover Effect on User Stats #3106
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
</ng-container> | ||
|
||
<ng-container> | ||
<div class="col-auto mb-2"> | ||
<div class="col-auto mb-2 icon"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this class |
||
<app-icon-and-title [label]="t('total-words-read-label')" [clickable]="true" fontClasses="fa-regular fa-file-lines" | ||
[title]="t('total-words-read-tooltip', {value: totalWordsRead | number})" (click)="openWordByYearList();$event.stopPropagation();"> | ||
{{totalWordsRead | compactNumber}} | ||
|
@@ -20,10 +20,10 @@ | |
<div class="vr d-none d-lg-block m-2"></div> | ||
</ng-container> | ||
|
||
<ng-container > | ||
<ng-container> | ||
<div class="col-auto mb-2"> | ||
<app-icon-and-title [label]="t('time-spent-reading-label')" [clickable]="false" fontClasses="fas fa-eye" | ||
[title]="t('time-spent-reading-tooltip', {value: timeSpentReading | number})"> | ||
<app-icon-and-title [label]="t('time-spent-reading-label')" [clickable]="false" fontClasses="fas fa-eye icon" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove icon class |
||
[title]="t('time-spent-reading-tooltip', {value: timeSpentReading | number})" (click)="openTimeSpentReadingByYearList();$event.stopPropagation();"> | ||
{{timeSpentReading | timeDuration}} | ||
</app-icon-and-title> | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,12 @@ export class UserStatsInfoCardsComponent { | |
ref.componentInstance.title = 'Words Read By Year'; | ||
}); | ||
} | ||
openTimeSpentReadingByYearList() { | ||
const numberPipe = new CompactNumberPipe(); | ||
this.statsService.getTimeSpentReadingPerYear().subscribe(yearCounts => { | ||
const ref = this.modalService.open(GenericListModalComponent, { scrollable: true }); | ||
ref.componentInstance.items = yearCounts.map(t => `${t.name}: ${numberPipe.transform(t.value)} hours`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to use localization everywhere, so find or create the appropriate key. Same for the title. Usually each component has it's own. |
||
ref.componentInstance.title = 'Time Spent Reading By Year'; | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to be a float. In #3209 I made the AvgHoursToRead a float to fix an issue where anything that was less than 1 hour wasn't counted in stats.