feat: show/hide cu profiling#925
Conversation
|
@C0mberry is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR introduces a reusable
Confidence Score: 4/5Safe 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
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
Reviews (2): Last reviewed commit: "resolve comments" | Re-trigger Greptile |
c46b270 to
2498392
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
11b3458 to
372329f
Compare
|
Could we check maybe if a little animation would be possible. |
aeb03df to
bb92eba
Compare
| ), | ||
| ], | ||
| parameters: { | ||
| layout: 'centered', |
There was a problem hiding this comment.
Please do not use centred. Padded is the right one. Let's use centred only if we really need this.
The idea is that the component could accidentally introduce extra margin or padding, and centered layout will make it invisible.
Padded makes that visible (pagging is gt that expected)
| component: CollapsibleCard, | ||
| decorators: [ | ||
| Story => ( | ||
| <div style={{ width: '600px' }}> |
There was a problem hiding this comment.
Why do we need width: 600 here? I'd prefer not having this. It is better to reuse Storybook's viewports rather than having a hardcoded wrapper. We do even have a decorator for this if I am not mistaken
|
|
||
| export const CollapsibleCard = React.forwardRef<HTMLDivElement, CollapsibleCardProps>( | ||
| ({ title, children, defaultExpanded = true, className, headerButtons, collapsible = true }, ref) => { | ||
| const [expanded, setExpanded] = React.useState(defaultExpanded); |
There was a problem hiding this comment.
Let's not use useState via namespace. Let's import it directly. I understand namespace for tests or the server code, but for the client, it is better not to use a namespace
Description
Type of change
Screenshots
Testing
Storybook
Transaction Page
Related Issues
HOO-404
Checklist
build:infoscript to update build information