feat(waves): show tip count + already-tipped state on waves feed cards#3311
Conversation
The waves feed now returns per-wave tip_count and tipped_by_viewer (esync +
@ecency/sdk 2.3.26). Surface them on the feed comment card: the gift action
shows the tip count, and a wave the viewer has already tipped renders a solid
gift (instead of the outline) so it reads as already-tipped at a glance,
matching the web waves feed.
- bump @ecency/sdk ^2.3.25 -> ^2.3.26 (adds the tip fields to the Entry type;
the fields already flow through the feed + parsePost at runtime)
- commentView: gift IconButton -> TextWithIcon with text={tip_count} and a
gift / gift-outline swap on tipped_by_viewer
The feed already passes the logged-in user as observer, so tipped_by_viewer is
populated; the single-post view already shows the count.
Greptile SummaryThis PR adds tip status to waves feed cards. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "address review: keep non-waves comments ..." | Re-trigger Greptile |
| accessibilityLabel={intl.formatMessage({ | ||
| isClickable | ||
| onPress={_handleOnTipPress} | ||
| text={comment.tip_count || 0} |
There was a problem hiding this comment.
When a viewer tips from a feed card, this new display still reads tip_count and tipped_by_viewer from the existing comment object. The tip action for this component only opens the tipping dialog and does not pass an onSuccess refresh/update callback, while the send-tip mutation invalidates the separate post-tips query instead of the feed/discussion query, so the count and filled gift icon can remain unchanged until the whole feed refreshes.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe tips action in ChangesComment Tip UI & Tip Cache Refresh
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/comment/view/commentView.tsx (1)
259-280: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRender the tip count for signed-out viewers too.
Because this block is still gated by
isLoggedIn, anonymous viewers never seetip_count, so the new feed-card count only appears for logged-in users. That misses the stated parity goal; only the filled icon / tipping action should depend on the viewer state.Suggested fix
- {isLoggedIn && ( - <TextWithIcon - iconName={comment.tipped_by_viewer ? 'gift' : 'gift-outline'} - iconSize={20} - wrapperStyle={styles.leftButton} - iconType="MaterialCommunityIcons" - isClickable - onPress={_handleOnTipPress} - text={comment.tip_count || 0} - textStyle={styles.voteCountText} - accessibilityLabel={intl.formatMessage( - { - id: 'post.a11y_tips', - defaultMessage: '{count, plural, one {# tip} other {# tips}}', - }, - { count: comment.tip_count || 0 }, - )} - accessibilityHint={intl.formatMessage({ - id: 'post.a11y_tip', - defaultMessage: 'Send tip', - })} - /> - )} + <TextWithIcon + iconName={comment.tipped_by_viewer ? 'gift' : 'gift-outline'} + iconSize={20} + wrapperStyle={styles.leftButton} + iconType="MaterialCommunityIcons" + isClickable={isLoggedIn} + onPress={_handleOnTipPress} + text={comment.tip_count || 0} + textStyle={styles.voteCountText} + accessibilityLabel={intl.formatMessage( + { + id: 'post.a11y_tips', + defaultMessage: '{count, plural, one {# tip} other {# tips}}', + }, + { count: comment.tip_count || 0 }, + )} + accessibilityHint={ + isLoggedIn + ? intl.formatMessage({ + id: 'post.a11y_tip', + defaultMessage: 'Send tip', + }) + : undefined + } + />🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/comment/view/commentView.tsx` around lines 259 - 280, The tip count is currently hidden behind the isLoggedIn guard in commentView, so signed-out viewers never see the count. Update the conditional around the TextWithIcon tip display so the count renders for all viewers, and restrict only the interactive tipping behavior (icon state, onPress, and any clickability) to logged-in users using the existing _handleOnTipPress and comment.tip_count logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/components/comment/view/commentView.tsx`:
- Around line 259-280: The tip count is currently hidden behind the isLoggedIn
guard in commentView, so signed-out viewers never see the count. Update the
conditional around the TextWithIcon tip display so the count renders for all
viewers, and restrict only the interactive tipping behavior (icon state,
onPress, and any clickability) to logged-in users using the existing
_handleOnTipPress and comment.tip_count logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bc38ee84-5bcc-4cee-8e94-504f1bc96cfc
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (2)
package.jsonsrc/components/comment/view/commentView.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c2e7f83381
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| accessibilityLabel={intl.formatMessage({ | ||
| isClickable | ||
| onPress={_handleOnTipPress} | ||
| text={comment.tip_count || 0} |
There was a problem hiding this comment.
Refetch wave cards after successful tips
When a logged-in user sends a tip from a wave card, this count is read from the waves feed item, but the tipping mutation only invalidates the separate post-tips query and _handleOnTipPress passes no onSuccess callback to refetch or update the waves infinite query. As a result, after tipping from the feed the card keeps showing the old count and outline gift state until the 60s feed refetch or a manual refresh; update/refetch the waves feed on dialog success like the single-post view does for its tips query.
Useful? React with 👍 / 👎.
…r tip - commentView: only show the tip count / solid-gift state when tip_count is a number (i.e. the waves feed). Regular comment threads, where the field is absent, keep the plain icon-only gift instead of a misleading '0'. [Greptile P2] - useSendTipMutation: also invalidate the waves feed query on success, so a tip sent from a feed card updates its count + already-tipped state instead of staying stale until the next feed refetch. [Greptile P1 / Codex P2]
|
Addressed both findings in 4c9c1b4:
|
What
Show a wave's tip count on the waves feed cards, and mark waves the viewer has already tipped — matching the web waves feed.
Why
Tip counts were only visible on the single-post view. In the waves feed the gift action showed no count, so a tipped wave looked untipped and you couldn't tell whether you'd already tipped it while scrolling.
How
Backed by esync +
@ecency/sdk2.3.26, which addtip_countandtipped_by_viewerto each waves feed item (tipped_by_vieweris computed from theobserverthe feed already sends — the logged-in user).@ecency/sdk^2.3.25→^2.3.26(adds the tip fields to theEntrytype; the values already flow through the feed response andparsePostat runtime).commentView: the gift action becomes aTextWithIconshowingtip_count, and swaps to a solidgifticon (fromgift-outline) whentipped_by_vieweris true — the at-a-glance already-tipped signal, mirroring web.Notes
post.a11y_tips/post.a11y_tipstrings (no new i18n).Summary by CodeRabbit
@ecency/sdkdependency to the latest patch version.