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 Time Spent Reading By Year and Hover Effect on User Stats #3106

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

RPLgrime
Copy link

@RPLgrime RPLgrime commented Aug 11, 2024

Added

  • Added: Added the ability to click Time Spent Reading and view a yearly summary, like the Total Pages Read and Total Words Read do.

@RPLgrime
Copy link
Author

Below is a sample user experience. The user sees a slight overlay on each Stat Card and upon click, the modal opens.
image
image

@majora2007
Copy link
Member

Preliminary comment, but please remove the hover effect on the Time Spent Reading. I'd like to keep everything consistent.

@RPLgrime
Copy link
Author

I put it on (3) cards, 'Total Pages Read', 'Total Words Read', and 'Time Spent Reading'. I would have put them on the last (3) cards as well, but there's no modal built to open yet.
This was in response to our discussion about people not knowing the cards can be clicked on to open more stats.

@majora2007
Copy link
Member

I'm going to circle back on this and tweak some of your code. But I'm still interested in merging. Just didn't fit with the UX overhaul stuff.


return query.GroupBy(p => p.Progress.LastModified.Year)
.OrderBy(g => g.Key)
.Select(g => new StatCount<int> { Value = g.Key, Count = g.Sum(x => x.Chapter.AvgHoursToRead) })
Copy link
Member

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.

@@ -11,7 +11,7 @@
</ng-container>

<ng-container>
<div class="col-auto mb-2">
<div class="col-auto mb-2 icon">
Copy link
Member

Choose a reason for hiding this comment

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

Remove this class

<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"
Copy link
Member

Choose a reason for hiding this comment

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

Remove icon class

Copy link
Member

@majora2007 majora2007 left a comment

Choose a reason for hiding this comment

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

A few comments about the PR. Code looks fine though.

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`);
Copy link
Member

Choose a reason for hiding this comment

The 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.

@majora2007 majora2007 added the enhancement New feature or request label Sep 23, 2024
@majora2007
Copy link
Member

Are you still interested in updating based on comments? I'm still open to merging this in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

2 participants