Skip to content

feat(dao): tap-to-explain tooltip on the APC label#279

Merged
RaheemJnr merged 3 commits into
mainfrom
feat/dao-apc-tooltip
May 22, 2026
Merged

feat(dao): tap-to-explain tooltip on the APC label#279
RaheemJnr merged 3 commits into
mainfrom
feat/dao-apc-tooltip

Conversation

@RaheemJnr
Copy link
Copy Markdown
Owner

@RaheemJnr RaheemJnr commented May 22, 2026

Summary

Telegram user reported Pocket Node's DAO APC reading 1.55% vs Neuron showing ~2%. Investigation found the two wallets compute fundamentally different numbers:

  • Pocket Node: realized APC — actual on-chain compensation / actual elapsed time on this specific deposit.
  • Neuron: theoretical APC — forward-looking projection from CKB tokenomics, scaled to a 1-year window even for fresh deposits.

Both are valid. Realized fluctuates around theoretical based on actual on-chain participation. Keeping realized as the displayed value (accurate to what the user actually earned) but adding tap-to-explain so users comparing wallets understand the difference.

What ships

  • New `ApcLabel` Composable. Renders APC text with an underline + small info icon. Tap opens an AlertDialog with the explanation.
  • `DaoScreen` overview header + `DaoDepositCard` per-deposit row both use `ApcLabel`.

Test plan

  • `./gradlew :app:compileDebugKotlin -x cargoBuild` BUILD SUCCESSFUL
  • Manual: DAO screen → tap APC text → dialog opens
  • Manual: deposit card → tap APC text → same dialog

Refs Telegram bug report (georgiev, 2026-05-21), pairs with PR #276 (the underlying APC math fix for withdrawing cells)

Summary by CodeRabbit

  • New Features

    • APC values now feature an interactive label with an info icon that opens an explanation dialog when tapped.
  • Refactor

    • Extracted reusable APC label component for consistent display across the app.

Review Change Stack

User-reported via Telegram: Pocket Node's DAO APC reads 1.55% while
Neuron displays ~2% for the same time window. Investigation showed
the two wallets compute fundamentally different numbers — Pocket
Node displays *realized* APC (actual compensation / actual elapsed
time on this specific deposit), while Neuron displays *theoretical*
APC (a forward-looking projection from CKB tokenomics).

Both are valid. The realized number is the truth about this deposit;
the theoretical number is an estimate of what a new deposit might
earn under idealised conditions. Realized APC fluctuates around the
theoretical based on actual on-chain participation.

We keep realized as the displayed value (it's more accurate to what
the user has actually earned), but add a tap-to-explain affordance
so users comparing against Neuron understand why the numbers differ
instead of assuming a bug.

What ships

- New `ApcLabel` Composable in ui/screens/dao/components/. Renders
  the APC text with an underline + small info icon. Tapping the
  whole row opens an AlertDialog with a three-paragraph explanation.
- DaoScreen overview header and DaoDepositCard per-deposit row both
  now use ApcLabel.

Refs Telegram bug report (georgiev, 2026-05-21)
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pocket-node Ready Ready Preview, Comment May 22, 2026 4:21pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

A new reusable ApcLabel Jetpack Compose component is introduced to render APC percentage values with an underlined text, info icon, and tap-activated explanation dialog. This component replaces inline APC text formatting in DaoOverviewCard and DaoDepositCard, standardizing the APC presentation across DAO screens.

Changes

APC Label Component Refactor

Layer / File(s) Summary
APC Label component definition
android/app/src/main/java/com/rjnr/pocketnode/ui/screens/dao/components/ApcLabel.kt
Introduces ApcLabel composable with configurable text style, color, and prefix. Tracks dialog visibility via remember/mutableStateOf, renders text with underline and info icon, and shows an AlertDialog explaining realized vs theoretical APC on tap with a "Got it" dismissal button.
APC Label integration in DAO screens
android/app/src/main/java/com/rjnr/pocketnode/ui/screens/dao/DaoScreen.kt, android/app/src/main/java/com/rjnr/pocketnode/ui/screens/dao/components/DaoDepositCard.kt
DaoOverviewCard and DaoDepositCard replace inline APC percentage Text with ApcLabel composable, passing APC values and MaterialTheme typography/color styling to maintain consistent presentation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A label is born, sleek and keen,
With info icons and dialogs pristine,
APC values now stand underlined and bright,
Reused across screens—what a sight!
One component to rule the DAO's display delight. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing a tap-to-explain tooltip interaction on the APC label component used in the DAO screen.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/dao-apc-tooltip

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In
`@android/app/src/main/java/com/rjnr/pocketnode/ui/screens/dao/components/ApcLabel.kt`:
- Around line 69-89: Replace the hard-coded English strings in the ApcLabel
dialog with string resources: move the title "About this APC", the long
explanation paragraph, and the confirm button label "Got it" into
res/values/strings.xml (e.g. dao_apc_dialog_title, dao_apc_dialog_explanation,
dao_apc_dialog_confirm) and update the composable usages in ApcLabel (the title
lambda, the text lambda where Text(...) uses the long explanation, and the
confirmButton/Text) to call stringResource(R.string.<name>) so the dialog uses
localized strings instead of inline literals.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d5a3472a-bfe9-4023-b66e-c23819411cc1

📥 Commits

Reviewing files that changed from the base of the PR and between 3c4edd7 and 5394ef1.

📒 Files selected for processing (3)
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/dao/DaoScreen.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/dao/components/ApcLabel.kt
  • android/app/src/main/java/com/rjnr/pocketnode/ui/screens/dao/components/DaoDepositCard.kt

Comment on lines +69 to +89
title = { Text("About this APC") },
text = {
Text(
text = "This number is the realized annual compensation rate: " +
"the actual CKB earned on this deposit divided by the time " +
"it has been deposited.\n\n" +
"It may differ from the APC shown by other CKB wallets such " +
"as Neuron. Neuron displays a theoretical APC computed from " +
"the protocol's tokenomics — a forward-looking projection " +
"assuming idealised conditions. Realized APC tracks what " +
"your specific deposit has earned, which fluctuates with " +
"actual on-chain participation.\n\n" +
"Both numbers are valid. The realized number is the truth " +
"about your deposit; the theoretical number is an estimate " +
"of what a new deposit might earn.",
style = MaterialTheme.typography.bodyMedium,
)
},
confirmButton = {
TextButton(onClick = { showInfo = false }) {
Text("Got it")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Extract hard-coded strings to string resources.

The dialog title, explanation text, and button label are hard-coded in English, while the rest of the codebase uses stringResource(R.string.*) for i18n. This breaks localization and violates the DRY principle established elsewhere in the project.

♻️ Suggested extraction to res/values/strings.xml

Add to res/values/strings.xml:

<string name="dao_apc_dialog_title">About this APC</string>
<string name="dao_apc_dialog_explanation">This number is the realized annual compensation rate: the actual CKB earned on this deposit divided by the time it has been deposited.\n\nIt may differ from the APC shown by other CKB wallets such as Neuron. Neuron displays a theoretical APC computed from the protocol\'s tokenomics — a forward-looking projection assuming idealised conditions. Realized APC tracks what your specific deposit has earned, which fluctuates with actual on-chain participation.\n\nBoth numbers are valid. The realized number is the truth about your deposit; the theoretical number is an estimate of what a new deposit might earn.</string>
<string name="dao_apc_dialog_confirm">Got it</string>

Then update the code:

+import androidx.compose.ui.res.stringResource
+import com.rjnr.pocketnode.R
+
 `@Composable`
 fun ApcLabel(
     ...
 ) {
     ...
     if (showInfo) {
         AlertDialog(
             onDismissRequest = { showInfo = false },
-            title = { Text("About this APC") },
+            title = { Text(stringResource(R.string.dao_apc_dialog_title)) },
             text = {
                 Text(
-                    text = "This number is the realized annual compensation rate: " +
-                        "the actual CKB earned on this deposit divided by the time " +
-                        ...
+                    text = stringResource(R.string.dao_apc_dialog_explanation),
                     style = MaterialTheme.typography.bodyMedium,
                 )
             },
             confirmButton = {
-                TextButton(onClick = { showInfo = false }) {
-                    Text("Got it")
-                }
+                TextButton(onClick = { showInfo = false }) {
+                    Text(stringResource(R.string.dao_apc_dialog_confirm))
+                }
             },
         )
     }
 }
🤖 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
`@android/app/src/main/java/com/rjnr/pocketnode/ui/screens/dao/components/ApcLabel.kt`
around lines 69 - 89, Replace the hard-coded English strings in the ApcLabel
dialog with string resources: move the title "About this APC", the long
explanation paragraph, and the confirm button label "Got it" into
res/values/strings.xml (e.g. dao_apc_dialog_title, dao_apc_dialog_explanation,
dao_apc_dialog_confirm) and update the composable usages in ApcLabel (the title
lambda, the text lambda where Text(...) uses the long explanation, and the
confirmButton/Text) to call stringResource(R.string.<name>) so the dialog uses
localized strings instead of inline literals.

@RaheemJnr RaheemJnr merged commit d960ed8 into main May 22, 2026
4 of 6 checks passed
@RaheemJnr RaheemJnr deleted the feat/dao-apc-tooltip branch May 22, 2026 16:20
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