Skip to content

[TASK-13463] Feat: Add go to profile button and update create account button#1216

Merged
Zishan-7 merged 5 commits intopeanut-wallet-devfrom
feat/sucess-txn-ctas
Sep 16, 2025
Merged

[TASK-13463] Feat: Add go to profile button and update create account button#1216
Zishan-7 merged 5 commits intopeanut-wallet-devfrom
feat/sucess-txn-ctas

Conversation

@Zishan-7
Copy link
Contributor

image image

@notion-workspace
Copy link

@vercel
Copy link

vercel bot commented Sep 15, 2025

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

Project Deployment Preview Comments Updated (UTC)
peanut-wallet Ready Ready Preview Comment Sep 16, 2025 3:05pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 15, 2025

Warning

Rate limit exceeded

@Zishan-7 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 32 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 607321c and 87f1aa2.

📒 Files selected for processing (1)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (5 hunks)

Walkthrough

Replaces plain "Create Account" buttons with a new CreateAccountButton component in two views and adds a conditionally-rendered "Go to {userName} profile" navigation button to TransactionDetailsReceipt; the profile button is inserted in two locations (duplicated).

Changes

Cohort / File(s) Summary of Changes
New CreateAccountButton component
src/components/Global/CreateAccountButton/index.tsx
Adds a client-side CreateAccountButton default export that composes a Button with stacked text and two logos (uses next/image and assets). Accepts onClick: () => void.
Replace simple Create Account button with CreateAccountButton
src/components/Claim/Link/Onchain/Success.view.tsx, src/components/Payment/Views/Status.payment.view.tsx
Import assets and next/image, import and render CreateAccountButton instead of the previous Button with icon="user-plus" + text; onClick still navigates to /setup.
TransactionDetailsReceipt profile navigation
src/components/TransactionDetails/TransactionDetailsReceipt.tsx
Adds useRouter and memoized showUserProfileButton when status is 'completed', userName exists and is not an address, and extraDataForDrawer?.transactionCardType ∈ {send,request,receive}. Renders "Go to {userName} profile" button (variant depends on card type) that navigates to /{userName}; the control is rendered in two places (duplicated).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • jjramirezn
  • kushagrasarathe

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately reflects the main changes in the PR—adding a "go to profile" button and updating the "create account" button—and is concise and specific enough for a teammate scanning the history.
Description Check ✅ Passed The PR description contains two image attachments that demonstrate the UI changes referenced in the diff (the go-to-profile button and the updated create account button), so it is related to the changeset and satisfies this lenient check.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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

🧹 Nitpick comments (3)
src/components/Payment/Views/Status.payment.view.tsx (1)

235-241: Make the “Create account” CTA accessible; hide decorative logos from SR.

Add an aria-label to the Button, and mark the logos as decorative (empty alt, aria-hidden). Optionally set explicit sizes if these aren’t SVGs to avoid CLS.

-<Button onClick={() => router.push('/setup')} shadowSize="4">
+<Button onClick={() => router.push('/setup')} shadowSize="4" aria-label="Create account">
   <div>Create a</div>
   <div className="flex items-center gap-1">
-    <Image src={PEANUTMAN_LOGO} alt="Peanut Logo" className="size-5" />
-    <Image src={PEANUT_LOGO_BLACK} alt="Peanut Logo" />
+    <Image src={PEANUTMAN_LOGO} alt="" aria-hidden className="size-5" />
+    <Image src={PEANUT_LOGO_BLACK} alt="" aria-hidden />
   </div>
   <div>account</div>
</Button>
src/components/Claim/Link/Onchain/Success.view.tsx (1)

135-142: Same a11y fix for the Create account CTA.

Hide decorative logos from assistive tech and add aria-label on the button.

-<Button onClick={() => router.push('/setup')} shadowSize="4">
+<Button onClick={() => router.push('/setup')} shadowSize="4" aria-label="Create account">
   <div>Create a</div>
   <div className="flex items-center gap-1">
-    <Image src={PEANUTMAN_LOGO} alt="Peanut Logo" className="size-5" />
-    <Image src={PEANUT_LOGO_BLACK} alt="Peanut Logo" />
+    <Image src={PEANUTMAN_LOGO} alt="" aria-hidden className="size-5" />
+    <Image src={PEANUT_LOGO_BLACK} alt="" aria-hidden />
   </div>
   <div>account</div>
</Button>
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)

926-941: Encode username in route to handle special chars; minor safety.

Use encodeURIComponent to avoid malformed URLs (e.g., names with +, @, or spaces).

- onClick={() => router.push(`/${transaction.userName}`)}
+ onClick={() => router.push(`/${encodeURIComponent(transaction.userName)}`)}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34098c0 and b4a34ca.

📒 Files selected for processing (3)
  • src/components/Claim/Link/Onchain/Success.view.tsx (2 hunks)
  • src/components/Payment/Views/Status.payment.view.tsx (3 hunks)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (4 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-07-24T13:26:10.290Z
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#1014
File: src/components/Claim/Link/Initial.view.tsx:413-413
Timestamp: 2025-07-24T13:26:10.290Z
Learning: In the peanut-ui repository, the change from `${SQUID_API_URL}/route` to `${SQUID_API_URL}/v2/route` in src/components/Claim/Link/Initial.view.tsx was a typo fix, not an API migration, as the codebase was already using Squid API v2.

Applied to files:

  • src/components/Claim/Link/Onchain/Success.view.tsx
📚 Learning: 2025-09-05T07:31:11.396Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1185
File: src/components/Claim/useClaimLink.tsx:14-0
Timestamp: 2025-09-05T07:31:11.396Z
Learning: In the peanut-ui codebase, `window.history.replaceState` is preferred over `router.replace` when immediate/synchronous URL parameter updates are required, as `router.replace` is asynchronous and doesn't guarantee instant URL changes that subsequent code can rely on. This pattern is used consistently across usePaymentInitiator.ts, Confirm.payment.view.tsx, and useClaimLink.tsx.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
📚 Learning: 2024-10-03T09:57:43.885Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#404
File: src/context/tokenSelector.context.tsx:121-121
Timestamp: 2024-10-03T09:57:43.885Z
Learning: In `TokenContextProvider` within `tokenSelector.context.tsx`, when token data is loaded from preferences, it's acceptable to set `isTokenPriceFetchingComplete` to `true` because the token data is already available.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
🧬 Code graph analysis (3)
src/components/Claim/Link/Onchain/Success.view.tsx (1)
src/components/0_Bruddle/Button.tsx (1)
  • Button (76-267)
src/components/Payment/Views/Status.payment.view.tsx (1)
src/components/0_Bruddle/Button.tsx (1)
  • Button (76-267)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)
src/components/0_Bruddle/Button.tsx (1)
  • Button (76-267)
🪛 Biome (2.1.2)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx

[error] 283-283: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.

Hooks should not be called after an early return.

For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level

(lint/correctness/useHookAtTopLevel)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (5)
src/components/Payment/Views/Status.payment.view.tsx (2)

2-2: LGTM on asset import.


22-22: LGTM on Next/Image usage import.

src/components/Claim/Link/Onchain/Success.view.tsx (1)

17-18: LGTM on imports.

src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2)

31-31: LGTM on router import.


63-63: LGTM on router usage (consistent with codebase patterns).

Copy link
Contributor

@kushagrasarathe kushagrasarathe left a comment

Choose a reason for hiding this comment

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

@Zishan-7 left a comment also check the coderrabbit comment, seems valid

Copy link
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: 0

🧹 Nitpick comments (4)
src/components/Global/CreateAccountButton/index.tsx (4)

14-14: Prevent accidental form submission; add type and fix prop type.

Set type="button" to avoid unintended form submits; also prefer numeric for shadowSize to match typical prop typing.

Apply:

-        <Button onClick={onClick} shadowSize="4">
+        <Button onClick={onClick} type="button" shadowSize={4}>

16-19: Decorative images should be hidden from AT; fix a11y name.

Logos are decorative; they currently pollute the accessible name and yield “Create a … account.” Hide them and provide a clear aria-label on the button.

Apply:

-            <div className="flex items-center gap-1">
-                <Image src={PEANUTMAN_LOGO} alt="Peanut Logo" className="size-5" />
-                <Image src={PEANUT_LOGO_BLACK} alt="Peanut Logo" />
-            </div>
+            <div className="flex items-center gap-1" aria-hidden="true">
+                <Image src={PEANUTMAN_LOGO} alt="" className="size-5" />
+                <Image src={PEANUT_LOGO_BLACK} alt="" className="h-5 w-auto" />
+            </div>

And on Line 14 add an accessible label:

-        <Button onClick={onClick} type="button" shadowSize={4}>
+        <Button onClick={onClick} type="button" shadowSize={4} aria-label="Create an account">

8-13: Allow pass-through Button props for flexibility.

Expose Button props (className, disabled, data-attrs) without widening the surface area.

Apply:

-interface CreateAccountButtonProps {
-    onClick: () => void
-}
+type CreateAccountButtonProps = Omit<React.ComponentProps<typeof Button>, 'children'> & {
+    onClick: () => void
+}

-const CreateAccountButton = ({ onClick }: CreateAccountButtonProps) => {
+const CreateAccountButton = ({ onClick, ...buttonProps }: CreateAccountButtonProps) => {
     return (
-        <Button onClick={onClick} type="button" shadowSize={4} aria-label="Create an account">
+        <Button onClick={onClick} type="button" shadowSize={4} aria-label="Create an account" {...buttonProps}>

Also applies to: 14-14, 25-25


6-6: Drop unused React import (new JSX transform).

If the repo uses the automatic JSX runtime (Next 13+ default), this import is unnecessary.

Apply:

-import React from 'react'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4a34ca and 74ff4ae.

📒 Files selected for processing (4)
  • src/components/Claim/Link/Onchain/Success.view.tsx (2 hunks)
  • src/components/Global/CreateAccountButton/index.tsx (1 hunks)
  • src/components/Payment/Views/Status.payment.view.tsx (3 hunks)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
  • src/components/Claim/Link/Onchain/Success.view.tsx
  • src/components/Payment/Views/Status.payment.view.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/Global/CreateAccountButton/index.tsx (1)
src/components/0_Bruddle/Button.tsx (1)
  • Button (76-267)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (2)
src/components/Global/CreateAccountButton/index.tsx (2)

1-2: LGTM on structure and intent.

Clean, focused component; “use client” correctly placed and Button integration is consistent with Bruddle.

Also applies to: 12-23


3-5: Verified — PEANUTMAN_LOGO and PEANUT_LOGO_BLACK are static image imports (no next/image warnings expected).

They are exported from src/assets (src/assets/peanut/index.ts and src/assets/illustrations/index.ts) as default SVG imports and are used as StaticImageData (PEANUTMAN_LOGO is accessed via .src in src/components/Global/PeanutLoading/index.tsx), so next/image can use them without explicit width/height. If you convert these SVGs to React components (SVGR) later, then update uses of to provide width/height or use fill.

Copy link
Contributor

@kushagrasarathe kushagrasarathe left a comment

Choose a reason for hiding this comment

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

lgtm, left a nit comment

Copy link
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

🧹 Nitpick comments (2)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2)

283-292: Trim redundant check and simplify type guard.

After the early return, transaction is non-null. Remove !!transaction && and use an includes guard for clarity.

Apply:

-const showUserProfileButton =
-    !!transaction &&
-    transaction.status === 'completed' &&
-    !!transaction.userName &&
-    !isAddress(transaction.userName) &&
-    (transaction.extraDataForDrawer?.transactionCardType === 'send' ||
-        transaction.extraDataForDrawer?.transactionCardType === 'request' ||
-        transaction.extraDataForDrawer?.transactionCardType === 'receive')
+const showUserProfileButton =
+    transaction.status === 'completed' &&
+    !!transaction.userName &&
+    !isAddress(transaction.userName) &&
+    ['send', 'request', 'receive'].includes(
+        transaction.extraDataForDrawer?.transactionCardType ?? ''
+    )

926-941: Encode username in route to avoid broken navigation on special characters.

If userName contains spaces, ?, #, or unicode, router.push(\/${userName}`)` can misroute. Encode the path segment.

Apply:

- onClick={() => router.push(`/${transaction.userName}`)}
+ onClick={() => router.push(`/${encodeURIComponent(transaction.userName!)}`)}

Optional: prefer <Link href={\/${encodeURIComponent(transaction.userName!)}`}>` for prefetch if styling allows.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74ff4ae and 607321c.

📒 Files selected for processing (1)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (4 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-09-05T07:31:11.396Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1185
File: src/components/Claim/useClaimLink.tsx:14-0
Timestamp: 2025-09-05T07:31:11.396Z
Learning: In the peanut-ui codebase, `window.history.replaceState` is preferred over `router.replace` when immediate/synchronous URL parameter updates are required, as `router.replace` is asynchronous and doesn't guarantee instant URL changes that subsequent code can rely on. This pattern is used consistently across usePaymentInitiator.ts, Confirm.payment.view.tsx, and useClaimLink.tsx.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
📚 Learning: 2024-12-11T10:13:22.806Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#564
File: src/components/Request/Pay/Views/Initial.view.tsx:430-430
Timestamp: 2024-12-11T10:13:22.806Z
Learning: In the React TypeScript file `src/components/Request/Pay/Views/Initial.view.tsx`, when reviewing the `InitialView` component, do not flag potential issues with using non-null assertion `!` on the `slippagePercentage` variable, as handling undefined values in this context is considered out of scope.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
📚 Learning: 2024-10-04T13:10:49.199Z
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#413
File: src/components/Request/Pay/Views/Initial.view.tsx:71-72
Timestamp: 2024-10-04T13:10:49.199Z
Learning: In `src/components/Request/Pay/Views/Initial.view.tsx`, it's acceptable to use the `!` operator in TypeScript to assert that `selectedTokenData` is not `null` or `undefined`, and potential runtime errors from accessing its properties without checks can be disregarded.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
📚 Learning: 2024-10-03T09:57:43.885Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#404
File: src/context/tokenSelector.context.tsx:121-121
Timestamp: 2024-10-03T09:57:43.885Z
Learning: In `TokenContextProvider` within `tokenSelector.context.tsx`, when token data is loaded from preferences, it's acceptable to set `isTokenPriceFetchingComplete` to `true` because the token data is already available.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
🧬 Code graph analysis (1)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)
src/components/0_Bruddle/Button.tsx (1)
  • Button (76-267)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (1)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)

283-292: Hook-order fix LGTM.

You replaced the conditional hook with a derived boolean after the early return. This resolves the rule-of-hooks violation.

@Zishan-7 Zishan-7 merged commit 93b70c1 into peanut-wallet-dev Sep 16, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants