Skip to content

Fix missing Edit page button for brand managers on BTC+ overview#986

Open
akshatmittal wants to merge 2 commits into
masterfrom
codex/rca-and-pr-fix-in-register
Open

Fix missing Edit page button for brand managers on BTC+ overview#986
akshatmittal wants to merge 2 commits into
masterfrom
codex/rca-and-pr-fix-in-register

Conversation

@akshatmittal
Copy link
Copy Markdown
Member

@akshatmittal akshatmittal commented Apr 29, 2026

Motivation

  • BTC+ and similar yield-style DTFs render a different overview component that lacked the brand-manager gated "Edit page" CTA, so brand managers could not access the manage flow from that overview.
  • The intent is to match the standard index overview behavior and surface the manage CTA only to wallets with the brand manager role.

Description

  • Updated src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx to add the missing brand-manager gated Edit page CTA.
  • Imported and used isBrandManagerAtom, Button, ImagePlus, and useTrackIndexDTFClick, and wired useAtomValue(isBrandManagerAtom) plus trackClick('brand_manager') for analytics.
  • The CTA navigates to ../manage and is conditionally rendered only when isBrandManager is true so non-brand-manager wallets remain unaffected.

Testing

  • Ran pnpm run typecheck (i.e., tsc --noEmit) and it completed successfully.
  • No other automated tests were executed as part of this change.

Codex Task

Summary by CodeRabbit

  • New Features

    • Brand managers now see an outlined "Edit page" button on the yield index overview to manage page content.
  • UI Improvements

    • Header layout on the overview page has been refined for better spacing and alignment.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 29, 2026

Deploying register-app with  Cloudflare Pages  Cloudflare Pages

Latest commit: 857e3a2
Status: ✅  Deploy successful!
Preview URL: https://04b108ef.register-app.pages.dev
Branch Preview URL: https://codex-rca-and-pr-fix-in-regi.register-app.pages.dev

View logs

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

The yield-index-about.tsx component consumes isBrandManagerAtom, initializes useTrackIndexDTFClick('overview','overview'), and conditionally renders an outlined "Edit page" button (with ImagePlus) for brand managers that navigates to the manage route and calls trackClick('brand_manager') on click.

Changes

Cohort / File(s) Summary
Brand Manager Edit Functionality
src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx
Added isBrandManagerAtom consumption and useTrackIndexDTFClick('overview','overview') initialization. Adjusted header layout and added conditional outlined "Edit page" button (with ImagePlus) that links to ../${ROUTES.MANAGE} and calls trackClick('brand_manager') on click. Existing "About" content rendering unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 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 pull request title accurately describes the main change: adding a missing Edit page button feature for brand managers on the BTC+ overview component.
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.

✏️ 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 codex/rca-and-pr-fix-in-register

Review rate limit: 2/3 reviews remaining, refill in 20 minutes.

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

Copy link
Copy Markdown

@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 the current code and only fix it if needed.

Inline comments:
In `@src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx`:
- Around line 33-41: Replace the nested interactive elements by using the
asChild pattern: instead of putting <Button> inside <Link>, render the Link as
the button element (add asChild to Link) and keep the <Button> markup as the
child so the DOM produces a single interactive element; update the block that
uses Link, Button, ImagePlus, ROUTES.MANAGE and trackClick so the Link has
asChild and the Button becomes the rendered element while preserving the onClick
tracking call (call trackClick from Button's onClick or forward the handler to
the rendered element) and the existing props (variant, size, className,
ImagePlus, and "Edit page" text).
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2e808684-32e7-4aa0-a55c-9574d117e085

📥 Commits

Reviewing files that changed from the base of the PR and between 75bf8d8 and cefc544.

📒 Files selected for processing (1)
  • src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx

Comment thread src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx Outdated

return (
<div className="p-4 sm:p-6">
{isBrandManager && (
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Move the button inside the flex element for the card title and push it to the right, making [TITLE] -> [Button] layout instead of pushing the title and the rest of the elements down

Make sure it fits and it doesnt create a layout shift

@akshatmittal
Copy link
Copy Markdown
Member Author

@codex fix comments from @lcamargof

@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

  • Updated the yield overview header layout so the brand-manager Edit page CTA is now in the same flex row as the title/anchor and aligned to the right via ml-auto, preventing the title/content from being pushed down.
  • Fixed the nested interactive-elements issue by switching from <Link><Button /></Link> to the Button asChild pattern (<Button asChild><Link /></Button>), while preserving route navigation and click tracking.

Testing

  • pnpm run typecheck
  • git status --short
  • sed -n '1,220p' src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx
  • nl -ba src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx | sed -n '20,90p'

Also completed follow-up workflow actions:

  • Committed changes on the current branch (8cc3815).
  • Created a stacked PR message via make_pr summarizing the follow-up fixes on top of the original PR.

View task →

Copy link
Copy Markdown

@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 the current code and only fix it if needed.

Inline comments:
In `@src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx`:
- Line 19: The inline click handler created during render should be memoized
with useCallback: locate the component (YieldIndexAbout) where const {
trackClick } = useTrackIndexDTFClick('overview', 'overview') is used and replace
the inline onClick function with a named handler created via useCallback (depend
on trackClick and any props/state used). Ensure the handler calls
trackClick(...) and is passed to the element instead of an anonymous function so
it remains stable across renders.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bf5ab349-09bf-4f6f-8ba1-092e4630f912

📥 Commits

Reviewing files that changed from the base of the PR and between cefc544 and 857e3a2.

📒 Files selected for processing (1)
  • src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx

const data = useAtomValue(indexDTFAtom)
const brandData = useAtomValue(indexDTFBrandAtom)
const isBrandManager = useAtomValue(isBrandManagerAtom)
const { trackClick } = useTrackIndexDTFClick('overview', 'overview')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx"

echo "Checking for inline onClick handler in ${FILE}..."
rg -nP 'onClick=\{\s*\(\)\s*=>|\bonClick=\{[^}]*=>[^}]*\}' "$FILE" -C2

echo
echo "Expected: no inline onClick arrow handlers after refactor."

Repository: reserve-protocol/register

Length of output: 429


🏁 Script executed:

cat -n src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx | head -70

Repository: reserve-protocol/register

Length of output: 2717


🏁 Script executed:

find . -name "useTrackIndexDTFPage*" -o -name "*useTrackIndexDTFPage*"

Repository: reserve-protocol/register

Length of output: 121


🏁 Script executed:

cat -n ./src/views/index-dtf/hooks/useTrackIndexDTFPage.ts

Repository: reserve-protocol/register

Length of output: 2562


🏁 Script executed:

grep -n "useCallback" ./src/views/index-dtf/hooks/useTrackIndexDTFPage.ts

Repository: reserve-protocol/register

Length of output: 51


🏁 Script executed:

rg -n "onClick=" ./src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx

Repository: reserve-protocol/register

Length of output: 130


Extract click handler with useCallback instead of inline render function.

Line 45 creates an inline handler during render. Per repo convention, memoize this callback using useCallback.

Suggested refactor
+import { useCallback } from 'react'
 import { Skeleton } from '@/components/ui/skeleton'
 import {
   indexDTFAtom,
   indexDTFBrandAtom,
   isBrandManagerAtom,
 } from '@/state/dtf/atoms'
@@
   const brandData = useAtomValue(indexDTFBrandAtom)
   const isBrandManager = useAtomValue(isBrandManagerAtom)
   const { trackClick } = useTrackIndexDTFClick('overview', 'overview')
+  const handleBrandManagerClick = useCallback(() => {
+    trackClick('brand_manager')
+  }, [trackClick])
@@
             <Link
               to={`../${ROUTES.MANAGE}`}
-              onClick={() => trackClick('brand_manager')}
+              onClick={handleBrandManagerClick}
             >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/views/index-dtf/overview/components/yield-index/yield-index-about.tsx` at
line 19, The inline click handler created during render should be memoized with
useCallback: locate the component (YieldIndexAbout) where const { trackClick } =
useTrackIndexDTFClick('overview', 'overview') is used and replace the inline
onClick function with a named handler created via useCallback (depend on
trackClick and any props/state used). Ensure the handler calls trackClick(...)
and is passed to the element instead of an anonymous function so it remains
stable across renders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants