Skip to content

feat(waves): show tip count + already-tipped state on waves feed cards#3311

Merged
feruzm merged 2 commits into
developmentfrom
feature/waves-feed-tip-count
Jun 27, 2026
Merged

feat(waves): show tip count + already-tipped state on waves feed cards#3311
feruzm merged 2 commits into
developmentfrom
feature/waves-feed-tip-count

Conversation

@feruzm

@feruzm feruzm commented Jun 27, 2026

Copy link
Copy Markdown
Member

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/sdk 2.3.26, which add tip_count and tipped_by_viewer to each waves feed item (tipped_by_viewer is computed from the observer the feed already sends — the logged-in user).

  • Bump @ecency/sdk ^2.3.25^2.3.26 (adds the tip fields to the Entry type; the values already flow through the feed response and parsePost at runtime).
  • commentView: the gift action becomes a TextWithIcon showing tip_count, and swaps to a solid gift icon (from gift-outline) when tipped_by_viewer is true — the at-a-glance already-tipped signal, mirroring web.

Notes

  • Reuses the existing post.a11y_tips / post.a11y_tip strings (no new i18n).
  • Backward compatible; the single-post view already shows the count.

Summary by CodeRabbit

  • New Features
    • Enhanced the comment action area for tips: when a tip count is available, the UI now displays the current count and a clearer, count-based accessibility label; otherwise it remains icon-only.
    • The tip icon and presentation update based on whether the viewer has already tipped.
  • Bug Fixes
    • After sending a tip from feed cards, related Waves feed tip counters refresh to reflect the latest state.
  • Chores
    • Bumped the app’s @ecency/sdk dependency to the latest patch version.

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-apps

greptile-apps Bot commented Jun 27, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds tip status to waves feed cards. The main changes are:

  • Show the wave tip count when the feed payload includes it.
  • Use a filled gift icon when the viewer has already tipped.
  • Keep the old icon-only tip action when tip fields are absent.
  • Refresh waves feed queries after a successful tip.
  • Bump @ecency/sdk to the version with the new tip fields.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
src/components/comment/view/commentView.tsx Adds the feed-card tip count and already-tipped icon state while keeping the icon-only fallback for comments without tip fields.
src/providers/queries/postQueries/tipsQueries.ts Invalidates the waves feed after successful tip sends so feed-derived tip state can refresh.
package.json Updates the SDK dependency range for the new feed tip fields.
yarn.lock Locks the updated SDK package version.

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}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Tip State Stays Stale

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.

Fix in Claude Code

Comment thread src/components/comment/view/commentView.tsx Outdated
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3b1e233e-0081-468c-bef9-a530494cf0bf

📥 Commits

Reviewing files that changed from the base of the PR and between c2e7f83 and 4c9c1b4.

📒 Files selected for processing (2)
  • src/components/comment/view/commentView.tsx
  • src/providers/queries/postQueries/tipsQueries.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/comment/view/commentView.tsx

📝 Walkthrough

Walkthrough

The tips action in CommentView now shows a count when available and refreshes from updated tip data after sending a tip. The @ecency/sdk dependency is also bumped to ^2.3.26.

Changes

Comment Tip UI & Tip Cache Refresh

Layer / File(s) Summary
Tip cache invalidation
src/providers/queries/postQueries/tipsQueries.ts
useSendTipMutation now invalidates the Waves feed query after successful tip submission, alongside the existing tips and wallet/portfolio invalidations.
Tip button UI and SDK dependency
src/components/comment/view/commentView.tsx, package.json
CommentView conditionally renders a count-based TextWithIcon tips control when comment.tip_count is numeric, otherwise keeps the icon-only button, and the SDK version is bumped to ^2.3.26.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A tip went zippy through the wire,
Its count now glows a little higher.
Gift icons hop from outline to bright,
And cached feeds wake up just right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: waves feed cards now show tip counts and the already-tipped state.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/waves-feed-tip-count

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 win

Render the tip count for signed-out viewers too.

Because this block is still gated by isLoggedIn, anonymous viewers never see tip_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

📥 Commits

Reviewing files that changed from the base of the PR and between 06411b6 and c2e7f83.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • package.json
  • src/components/comment/view/commentView.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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]
@feruzm

feruzm commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

Addressed both findings in 4c9c1b4:

  • Misleading 0 in non-waves views (Greptile P2): commentView is shared with regular comment threads, which don't carry tip_count. Now the count + solid-gift state render only when tip_count is a number (the waves feed); everywhere else the gift falls back to the original icon-only action, so no 0 appears where the value is unknown.
  • Stale count after tipping from a feed card (Greptile P1 / Codex P2): useSendTipMutation.onSuccess now also invalidates the waves feed query (['posts','waves','feed'], prefix-matching every variant) alongside the post-tips + wallet invalidations, so a tip sent from a card refreshes its count and already-tipped state instead of waiting for the next feed refetch. The single-post view already updated via the post-tips query.

@feruzm feruzm merged commit fd649ae into development Jun 27, 2026
10 of 12 checks passed
@feruzm feruzm deleted the feature/waves-feed-tip-count branch June 27, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant