feat: add header streak indicator (@hunterpaulson)#8054
Open
hunterpaulson wants to merge 1 commit into
Open
Conversation
Member
|
hi @hunterpaulson , thank you for your contribution, this is a nice feature. I think we should create a signal for the StreakSnapshot/StreakIndicatorState
|
9deb0a9 to
86701f4
Compare
Author
|
agreed @fehmer. I moved the streak state into states/streak.ts and updated the header indicator and account profile display to render from the shared state. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem being solved:
In order to see your current streak, and whether it was claimed today, you have to click your profile then hover over your streak under your username.
Solution:
Add a streak indicator in the header next to the notification bell that shows your current streak along with a fire icon to indicate whether or not you claimed your streak for today.
Design
subcolor. matching the rest of the headingmaincolor with solid fill. matching the monkeytype keyboard logotextcolor and inherits the existing header navigation font size.examples
Logged out. shows no streak indicator (notice nothing next to the bell)
Before streak is claimed. Logged in users see a hollow indicator and the length of the current streak. hinting to them to begin/claim their streak for the day.
After streak is claimed. Indicator becomes solid and uses main color
Timezone streak hour offset tool tip still shows when hovering streak on profile page
When streak is lost it goes back to zero.
Implementation notes
The account page now displays a one-day streak instead of waiting until day two, keeping it consistent with the header indicator. previously it took two days to show streak indicator.
Moved the streak formatting and tooltip logic from the profile component into
utils/streak.tsso the header and account page share the same behavior and wording. account-only tooltips like the changing timezone hour offset remain opt-in.In order to determine whether today's streak was claimed immediately after login, before result history is first loaded I used the existing
streak.lastResultTimestampvalue from the user response asstreakLastResultTimestamp. It is also updated after saving a result so the indicator changes immediately.Checks
related discussion #5799