Skip to content

feat: show/hide cu profiling#925

Open
C0mberry wants to merge 5 commits intosolana-foundation:masterfrom
hoodieshq:feat-show/hide-cu-profiling
Open

feat: show/hide cu profiling#925
C0mberry wants to merge 5 commits intosolana-foundation:masterfrom
hoodieshq:feat-show/hide-cu-profiling

Conversation

@C0mberry
Copy link
Copy Markdown
Contributor

@C0mberry C0mberry commented Apr 7, 2026

Description

  • adding CollapsibleCard component
  • refactoring of existing Collapse/Expand btns
  • adding CollapsibleCard for CU profiling section

Type of change

  • New feature

Screenshots

Screenshot 2026-04-07 at 10 35 53 Screenshot 2026-04-07 at 10 38 44

Testing

Storybook
Transaction Page

Related Issues

HOO-404

Checklist

  • My code follows the project's style guidelines
  • All tests pass locally and in CI
  • I have run build:info script to update build information
  • CI/CD checks pass
  • I have included screenshots for protocol screens (if applicable)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

@C0mberry is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@C0mberry C0mberry marked this pull request as draft April 7, 2026 07:43
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 7, 2026

Greptile Summary

This PR introduces a reusable CollapsibleCard component and migrates eight existing cards to use it, then wraps CUProfilingCard in it to deliver the show/hide feature. The refactor cleanly eliminates duplicated local expanded state across many components.

  • InspectorInstructionCard gains an unintended Collapse/Expand buttoncollapsible is not passed, so it defaults to true, adding a toggle that was never present on the inspector page. Add collapsible={false} to restore the original behavior.

Confidence Score: 4/5

Safe to merge after fixing the InspectorInstructionCard collapsible default — all other changes are clean refactors.

One P1 issue: InspectorInstructionCard omits collapsible={false}, causing an unintended Collapse/Expand button to appear on the inspector page. The remaining findings are P2 style/UX concerns. The core CollapsibleCard abstraction and the CU profiling show/hide feature are well-implemented.

app/components/common/InspectorInstructionCard.tsx requires a one-line fix before merge.

Important Files Changed

Filename Overview
app/components/shared/ui/collapsible-card.tsx New reusable CollapsibleCard component with forwardRef, aria-expanded, and cn('card', className) merging — well-structured abstraction.
app/components/common/InspectorInstructionCard.tsx Migrated to CollapsibleCard but omits collapsible={false}, adding an unintended Collapse/Expand button to inspector instruction cards that never had one.
app/components/common/BaseInstructionCard.tsx Cleanly refactored to CollapsibleCard; local expanded state removed. Raw button is now enabled while card is collapsed (minor UX regression).
app/features/cu-profiling/ui/CUProfilingCard.tsx Core feature: CU profiling card now wrapped in CollapsibleCard. className="e-card" results in "card e-card" due to cn() merge — may add unintended Bootstrap styles.
app/components/shared/ui/collapsible-card.stories.tsx Comprehensive Storybook stories covering default, collapsed, non-collapsible, header-buttons, and badge-title variants.
app/components/inspector/AccountsCard.tsx Clean migration to CollapsibleCard; original had a toggle button so the default collapsible=true is correct.
app/components/inspector/AddressTableLookupsCard.tsx Clean migration to CollapsibleCard; original had a toggle button so the default collapsible=true is correct.
app/components/inspector/UnknownDetailsCard.tsx Migrated to CollapsibleCard with defaultExpanded={false}, matching original collapsed-by-default behavior. React import correctly removed.
app/components/transaction/AccountsCard.tsx Clean refactor; Raw button moved to headerButtons prop, expanded state removed, behavior preserved.
app/components/transaction/TokenBalancesCard.tsx Straightforward migration to CollapsibleCard; original toggle button behavior preserved.
bench/BUILD.md Updated build-size metrics reflecting the new bundle output; no code logic involved.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
    class CollapsibleCard {
        +title: ReactNode
        +children: ReactNode
        +defaultExpanded: boolean
        +className?: string
        +headerButtons?: ReactNode
        +collapsible: boolean
        -expanded: boolean
        +setExpanded()
    }
    class BaseInstructionCard {
        +collapsible?: boolean
        +headerButtons?: ReactNode
        -showRaw: boolean
    }
    class InspectorInstructionCard {
        +defaultRaw?: boolean
        -showRaw: boolean
    }
    class CUProfilingCard {
        +instructions: InstructionCUData[]
        +unitsConsumed?: number
    }
    class AccountsCard_Transaction {
        -showRaw: boolean
    }
    class TokenBalancesCardInner {
        -tokenSymbols: Map
    }
    class AccountsCard_Inspector
    class AddressTableLookupsCard
    class UnknownDetailsCard {
        +defaultExpanded: false
    }
    CollapsibleCard <|-- BaseInstructionCard : uses
    CollapsibleCard <|-- InspectorInstructionCard : uses (collapsible=true by default)
    CollapsibleCard <|-- CUProfilingCard : uses (new feature)
    CollapsibleCard <|-- AccountsCard_Transaction : uses
    CollapsibleCard <|-- TokenBalancesCardInner : uses
    CollapsibleCard <|-- AccountsCard_Inspector : uses
    CollapsibleCard <|-- AddressTableLookupsCard : uses
    CollapsibleCard <|-- UnknownDetailsCard : uses
Loading

Reviews (2): Last reviewed commit: "resolve comments" | Re-trigger Greptile

Comment thread app/components/shared/ui/collapsible-card.tsx
Comment thread app/components/shared/ui/collapsible-card.tsx Outdated
@C0mberry C0mberry force-pushed the feat-show/hide-cu-profiling branch 2 times, most recently from c46b270 to 2498392 Compare April 13, 2026 09:14
@C0mberry C0mberry marked this pull request as ready for review April 13, 2026 09:18
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

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

Project Deployment Actions Updated (UTC)
explorer Ready Ready Preview, Comment Apr 13, 2026 6:27pm

Request Review

Comment thread bench/BUILD.md Outdated
| Dynamic | `/api/domain-info/[domain]` | 0 B | 0 B |
| Dynamic | `/api/geo-location` | 0 B | 0 B |
| Dynamic | `/api/metadata/proxy` | 0 B | 0 B |
| Static | `/api/metadata/proxy` | 0 B | 0 B |
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.

This thing is again Static. The master should have the proper version to fix it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@C0mberry C0mberry force-pushed the feat-show/hide-cu-profiling branch from 11b3458 to 372329f Compare April 14, 2026 12:56
@C0mberry C0mberry requested a review from rogaldh April 14, 2026 13:28
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.

2 participants