Rewards reorder and snackbar notifications #1509
No reviewers
Labels
No labels
accessibility
app-parity
area: creator
area: daemon
area: design
area: devops
area: discovery
area: docs
area: installer
area: internal
area: livestream
area: performance
area: proposal
area: reposts
area: rewards
area: search
area: security
area: subscriptions
area: sync
area: ux
area: viewer
area: wallet
BEAMER
channel
comments
community PR
consider soon
core team
css
dependencies
electron
Epic
feature request
first-timers-only
good first issue
hacktoberfest
help wanted
hub-dependent
icebox
Invalid
level: 0
level: 1
level: 2
level: 3
level: 4
merge when green
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
notifications
odysee
on hold
playlists
priority: blocker
priority: high
priority: low
priority: medium
protocol dependent
recsys
redesign
regression
resilience
sdk dependent
Tom's Wishlist
trending
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbry-desktop#1509
Loading…
Reference in a new issue
No description provided.
Delete branch "issue/1329"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refactor unclaimed rewards as array to keep order from api.lbry.io. Display reward notification message through snackbar with fallback for rewards with no message.
#1329
@daovist we should clean up: https://github.com/lbryio/lbry-app/blob/master/src/renderer/rewards.js right? Since it's no longer considering those types and reward messages.
@tzarebczan as I cleaned up
rewards.js
I realized I was duplicating the reward notification so that is fixed now tooShould we move the claimedRewards over to an array to be consistent? Not really sure.
Why are we getting rid of this?
I don't think it matters much if we refactor claimedRewards but am happy to do so
The
new_user
reward notification is handled byrewards.js
like the othersMinor comment
It looks like you're removing the current element?
I would suggest using splice instead.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
I tried changing
unclaimedRewards = unclaimedRewards.slice(0, index).concat(unclaimedRewards.slice(index + 1));
tounclaimedRewards.splice(index, 1);
and the UI no longer updates properly. It removes the<RewardLink>
button but not the Card with the title and info. I ran into this last week but moved on when I got it working correctly with concat. I am still working to grok the finer points of JS/Redux mutability.@daovist there should be a modal (in addition to snackbar) for first reward earned - if it doesn't belong in this code, needs to be added to https://github.com/lbryio/lbry-app/pull/1509/files#diff-ecd3ac4e31248b9eede5ec309f95d368
Giving this a test with the new user reward.
That's likely because it's modifying the original array value and React only shallow checks.
If you return
[...unclaimedRewards]
instead ofunclaimedRewards
, it'll force the update.This is a good use case for immutable.js as well
The last cleanup of rewards.js broke reward.type constant comparisons which breaks first reward modal and ability to claim rewards like publish / channel. Travis looking into it.
Thanks. I did the same with claimed rewards and now they're showing up at the bottom like they should.
This is working as expected again. @seanyesmunt we also removed the amount from the invite button because it was coming back as 0. It may be misleading also, because sending the invite doesn't actually get you 3 credits (the person has to sign up, get approved, etc), so I think it's better this way.