Skip to content

Conversation

@Agilulfo1820
Copy link
Member

@Agilulfo1820 Agilulfo1820 commented Dec 16, 2025

The issue was that the TransactionModal was not wrapped inside the kit's theme provider.

Registrazione.schermo.2025-12-16.alle.09.38.32.mov

Planning to create a separate pr with more enhancement to this, but for now I prefer to just fix it immediately

Closes #259

Summary by CodeRabbit

  • Enhancements

    • Reorganized transaction examples into a flat layout with explicit "Test Transactions" and "Implementation" sections.
    • Added in-component interactive testing actions (Test with Toast, Test with Modal).
    • Added explicit implementation links (View Code Example, Read Docs).
    • Improved theme consistency in modal displays.
  • UI

    • Updated modal/footer and toast action button visuals, including a retry icon on error states.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 16, 2025

Walkthrough

Refactors TransactionExamples layout into a flat stacked UI; switches action buttons to in-component onClick handlers that open TransactionToast/TransactionModal; wraps TransactionModal with VechainKitThemeProvider; changes modal/toast button variants and adds a refresh icon for error state.

Changes

Cohort / File(s) Summary
TransactionExamples layout & interactions
examples/homepage/src/app/components/features/TransactionExamples/TransactionExamples.tsx
Removed CollapsibleCard; replaced two-column grid with single-column SimpleGrid containing stacked VStacks ("Test Transactions", "Implementation"). Replaced Link navigation buttons with in-component onClick handlers that trigger toast/modal flows. Moved TransactionToast and TransactionModal to be direct siblings in the outer layout; minor text/description adjustments.
TransactionModal — provider & structure
packages/vechain-kit/src/components/TransactionModal/TransactionModal.tsx
Wrapped modal markup with VechainKitThemeProvider using useVeChainKitConfig (extracting darkMode/theme). Early-return when not open; nested BaseModal and TransactionModalContent under the provider; passes onClose and forwards txError; preserves closeOnOverlayClick logic.
TransactionModalContent — close button variant
packages/vechain-kit/src/components/TransactionModal/TransactionModalContent.tsx
Changed modal footer Close button variant from "vechainKitSecondary" to "ghost" while keeping onClick and width behavior.
TransactionToastContent — error action & close button
packages/vechain-kit/src/components/TransactionToast/TransactionToastContent.tsx
Added LuRefreshCw icon import; when status is error, action button shows the refresh icon before "Try again"; otherwise shows "Confirm". Removed variant="ghost" from Close IconButton.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas requiring attention:

  • TransactionExamples: verify onClick handlers correctly manage state and do not re-use stale transaction state; ensure moved toast/modal siblings receive correct props.
  • TransactionModal: confirm useVeChainKitConfig usage and that theme/darkMode propagate as expected; check early-return behavior and closeOnOverlayClick evaluation.
  • TransactionModalContent & TransactionToastContent: verify visual/style changes (button variants, icon alignment) and accessibility (focus/labels).

Poem

🐇 I hopped through code with nimble feet,
Flattened cards and stacked each seat.
A themed modal wraps me tight,
Toasts and refreshes spark delight —
Happy hops for UI neat! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 3 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Fix/transaction modal' partially relates to the changeset as it refers to TransactionModal modifications, but is overly vague and doesn't clearly convey the main fix (theme provider wrapping). Consider a more specific title like 'Wrap TransactionModal with theme provider' or 'Fix TransactionModal theme styling' to better convey the primary fix.
Linked Issues check ❓ Inconclusive The PR partially addresses #259's primary objective (fixing broken styles by wrapping TransactionModal with theme provider), but does not comprehensively address modal state reset issues or API simplification suggestions from the linked issue. Verify whether modal state reset issues are fixed and confirm if addressing all objectives from #259 (state management, API simplification) is intended for this PR or planned separately.
Out of Scope Changes check ❓ Inconclusive Changes to TransactionExamples.tsx (UI layout restructuring and button handler modifications) appear partially out of scope relative to the primary theme provider fix objective stated in the PR description. Clarify whether TransactionExamples.tsx changes are necessary to demonstrate the theme provider fix or represent unrelated enhancements intended for the separate PR mentioned.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description identifies the key issue and links to issue #259, but lacks detail about what was changed and how the fix addresses the problem.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/transaction-modal

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0343d9d and 9bc62cd.

📒 Files selected for processing (1)
  • packages/vechain-kit/src/components/TransactionModal/TransactionModal.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/migration-guide-to-v2.mdc)

**/*.{ts,tsx}: In VeChain Kit Version 2, use useThor instead of useConnex for contract interactions
For single contract read operations, use the useCallClause hook with the pattern: import dependencies, define ABI and method as const, create query key function using getCallClauseQueryKeyWithArgs, and wrap with useCallClause including data transformation in the select option
For multiple parallel contract calls, use the executeMultipleClausesCall utility wrapped in a useQuery hook with the pattern: define query key function, use executeMultipleClausesCall in queryFn mapping items to clause objects, and transform results
For transaction building and sending, use the useBuildTransaction hook with a clauseBuilder function that returns an array of clauses with optional comment fields describing the transaction action
Always provide an arguments array for contract calls, even when no parameters are required - use an empty array for parameter-less functions to enable TypeScript type checking
Always conditionally enable queries using the enabled property to prevent unnecessary contract calls, checking for all required parameters: enabled: !!requiredParam && !!otherRequiredParam
Use the select option in useCallClause or transform data in queryFn to handle data transformation, particularly for converting BigInt values to strings and normalizing contract return data
Maintain consistent query key patterns: use getCallClauseQueryKeyWithArgs for contract calls with arguments and getCallClauseQueryKey for calls without arguments to ensure proper caching and invalidation
Use TypeScript as const assertions for method names and as 0x${string}`` assertions for Ethereum addresses to ensure type safety in contract interactions

Files:

  • packages/vechain-kit/src/components/TransactionModal/TransactionModal.tsx
🧠 Learnings (1)
📚 Learning: 2025-12-01T13:01:33.771Z
Learnt from: CR
Repo: vechain/vechain-kit PR: 0
File: .cursor/rules/migration-guide-to-v2.mdc:0-0
Timestamp: 2025-12-01T13:01:33.771Z
Learning: Applies to **/*.{ts,tsx} : In VeChain Kit Version 2, use `useThor` instead of `useConnex` for contract interactions

Applied to files:

  • packages/vechain-kit/src/components/TransactionModal/TransactionModal.tsx
⏰ 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). (4)
  • GitHub Check: Lint & Build
  • GitHub Check: build-size-check
  • GitHub Check: e2e-test
  • GitHub Check: deploy
🔇 Additional comments (1)
packages/vechain-kit/src/components/TransactionModal/TransactionModal.tsx (1)

42-61: Theme provider wrapper correctly addresses the styling issue.

The VechainKitThemeProvider wrapper ensures the modal inherits the kit's theming context, which was the root cause of the broken styles reported in issue #259.

Minor note: Since line 39 guards with if (!isOpen) return null, the isOpen={isOpen} prop on line 44 will always be true. This is fine for maintainability, but could be simplified to isOpen if preferred.


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

@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)
packages/vechain-kit/src/components/TransactionToast/TransactionToastContent.tsx (1)

192-198: Consider variant consistency across toast and modal close buttons.

The close IconButton in the toast no longer has a variant specified, while the close Button in TransactionModalContent uses variant="ghost" (line 210). If both should have consistent styling, consider adding variant="ghost" here as well.

             <IconButton
                 onClick={onClose}
                 size="sm"
                 borderRadius={'full'}
                 aria-label="Close"
                 icon={<Icon as={LuX} boxSize={4} />}
+                variant="ghost"
             />
examples/homepage/src/app/components/features/TransactionExamples/TransactionExamples.tsx (1)

73-101: Consider simplifying the single-column SimpleGrid.

The layout now uses SimpleGrid with columns={{ base: 1, md: 1 }}, which always renders a single column. Since there's no responsive column variation, a VStack would be simpler and more semantically appropriate.

-        <SimpleGrid columns={{ base: 1, md: 1 }} spacing={6}>
+        <VStack spacing={6} w="full">
             <VStack spacing={4} p={6} borderRadius="md" bg="whiteAlpha.50">
                 <Text fontWeight="bold">Test Transactions</Text>
                 ...
             </VStack>
             ...
-        </SimpleGrid>
+        </VStack>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0af53c and 0343d9d.

📒 Files selected for processing (4)
  • examples/homepage/src/app/components/features/TransactionExamples/TransactionExamples.tsx (1 hunks)
  • packages/vechain-kit/src/components/TransactionModal/TransactionModal.tsx (2 hunks)
  • packages/vechain-kit/src/components/TransactionModal/TransactionModalContent.tsx (1 hunks)
  • packages/vechain-kit/src/components/TransactionToast/TransactionToastContent.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/migration-guide-to-v2.mdc)

**/*.{ts,tsx}: In VeChain Kit Version 2, use useThor instead of useConnex for contract interactions
For single contract read operations, use the useCallClause hook with the pattern: import dependencies, define ABI and method as const, create query key function using getCallClauseQueryKeyWithArgs, and wrap with useCallClause including data transformation in the select option
For multiple parallel contract calls, use the executeMultipleClausesCall utility wrapped in a useQuery hook with the pattern: define query key function, use executeMultipleClausesCall in queryFn mapping items to clause objects, and transform results
For transaction building and sending, use the useBuildTransaction hook with a clauseBuilder function that returns an array of clauses with optional comment fields describing the transaction action
Always provide an arguments array for contract calls, even when no parameters are required - use an empty array for parameter-less functions to enable TypeScript type checking
Always conditionally enable queries using the enabled property to prevent unnecessary contract calls, checking for all required parameters: enabled: !!requiredParam && !!otherRequiredParam
Use the select option in useCallClause or transform data in queryFn to handle data transformation, particularly for converting BigInt values to strings and normalizing contract return data
Maintain consistent query key patterns: use getCallClauseQueryKeyWithArgs for contract calls with arguments and getCallClauseQueryKey for calls without arguments to ensure proper caching and invalidation
Use TypeScript as const assertions for method names and as 0x${string}`` assertions for Ethereum addresses to ensure type safety in contract interactions

Files:

  • packages/vechain-kit/src/components/TransactionModal/TransactionModalContent.tsx
  • packages/vechain-kit/src/components/TransactionToast/TransactionToastContent.tsx
  • packages/vechain-kit/src/components/TransactionModal/TransactionModal.tsx
  • examples/homepage/src/app/components/features/TransactionExamples/TransactionExamples.tsx
🧠 Learnings (2)
📚 Learning: 2025-12-01T13:01:33.771Z
Learnt from: CR
Repo: vechain/vechain-kit PR: 0
File: .cursor/rules/migration-guide-to-v2.mdc:0-0
Timestamp: 2025-12-01T13:01:33.771Z
Learning: Applies to **/*.{ts,tsx} : In VeChain Kit Version 2, use `useThor` instead of `useConnex` for contract interactions

Applied to files:

  • packages/vechain-kit/src/components/TransactionToast/TransactionToastContent.tsx
  • packages/vechain-kit/src/components/TransactionModal/TransactionModal.tsx
📚 Learning: 2025-12-01T13:01:33.771Z
Learnt from: CR
Repo: vechain/vechain-kit PR: 0
File: .cursor/rules/migration-guide-to-v2.mdc:0-0
Timestamp: 2025-12-01T13:01:33.771Z
Learning: Applies to **/*.{ts,tsx} : For transaction building and sending, use the `useBuildTransaction` hook with a clauseBuilder function that returns an array of clauses with optional comment fields describing the transaction action

Applied to files:

  • examples/homepage/src/app/components/features/TransactionExamples/TransactionExamples.tsx
⏰ 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). (4)
  • GitHub Check: Lint & Build
  • GitHub Check: build-size-check
  • GitHub Check: e2e-test
  • GitHub Check: deploy
🔇 Additional comments (4)
packages/vechain-kit/src/components/TransactionModal/TransactionModalContent.tsx (1)

210-210: LGTM! Button variant change aligns with theme provider fix.

The change from "vechainKitSecondary" to "ghost" variant for the Close button is a minor styling adjustment that likely improves consistency now that the modal is properly wrapped in the theme provider.

packages/vechain-kit/src/components/TransactionToast/TransactionToastContent.tsx (1)

14-20: LGTM! Icon enhancement improves error state UX.

Adding the refresh icon for the error "Try again" action provides clear visual feedback that distinguishes retry from normal confirmation. Good UX improvement.

Also applies to: 166-173

packages/vechain-kit/src/components/TransactionModal/TransactionModal.tsx (1)

6-6: LGTM! Theme provider wrapper correctly addresses the PR objective.

The TransactionModal is now properly wrapped with VechainKitThemeProvider, ensuring it uses the kit's theme configuration. The implementation:

  • Correctly extracts darkMode and theme from useVeChainKitConfig
  • Preserves all existing props and behavior
  • Maintains the closeOnOverlayClick logic

This fix ensures the modal displays consistently with the kit's theming system.

Also applies to: 36-57

examples/homepage/src/app/components/features/TransactionExamples/TransactionExamples.tsx (1)

130-154: LGTM! Modal and toast components correctly positioned.

The TransactionModal and TransactionToast are properly placed as siblings to the main content VStack, ensuring correct z-index layering. All required props are correctly passed, and the modal's uiConfig enables all features for demonstration purposes.

The modal now benefits from the theme provider wrapper implemented in TransactionModal.tsx.

@github-actions
Copy link

Size Change: +1.69 kB (+0.03%)

Total Size: 5.43 MB

Filename Size Change
packages/vechain-kit/dist/index-BB3iebWm.d.mts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index-BB3iebWm.d.mts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index-BJarbNHl.d.cts 0 B -143 kB (removed) 🏆
packages/vechain-kit/dist/index-BJarbNHl.d.cts.map 0 B -41.3 kB (removed) 🏆
packages/vechain-kit/dist/index-BYoi5R1R.d.cts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index-BYoi5R1R.d.cts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index-CvVeQOAe.d.mts 0 B -143 kB (removed) 🏆
packages/vechain-kit/dist/index-CvVeQOAe.d.mts.map 0 B -41.3 kB (removed) 🏆
packages/vechain-kit/dist/index-BN8V0jxo.d.mts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index-BN8V0jxo.d.mts.map 2.99 kB +2.99 kB (new file) 🆕
packages/vechain-kit/dist/index-CyNcaiug.d.cts 143 kB +143 kB (new file) 🆕
packages/vechain-kit/dist/index-CyNcaiug.d.cts.map 41.3 kB +41.3 kB (new file) 🆕
packages/vechain-kit/dist/index-D0UUDh8A.d.mts 143 kB +143 kB (new file) 🆕
packages/vechain-kit/dist/index-D0UUDh8A.d.mts.map 41.3 kB +41.3 kB (new file) 🆕
packages/vechain-kit/dist/index-DSMUkHcK.d.cts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index-DSMUkHcK.d.cts.map 2.99 kB +2.99 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
packages/vechain-kit/dist/assets 4.1 kB 0 B
packages/vechain-kit/dist/assets-aAdDxPJu.mjs 50.1 kB 0 B
packages/vechain-kit/dist/assets-aAdDxPJu.mjs.map 70.2 kB 0 B
packages/vechain-kit/dist/assets-DXVXPy3w.cjs 54.8 kB 0 B
packages/vechain-kit/dist/assets-DXVXPy3w.cjs.map 71.6 kB 0 B
packages/vechain-kit/dist/assets/index.cjs 716 B 0 B
packages/vechain-kit/dist/assets/index.d.cts 973 B 0 B
packages/vechain-kit/dist/assets/index.d.mts 973 B 0 B
packages/vechain-kit/dist/assets/index.mjs 718 B 0 B
packages/vechain-kit/dist/index.cjs 574 kB +133 B (+0.02%)
packages/vechain-kit/dist/index.cjs.map 1.75 MB +772 B (+0.04%)
packages/vechain-kit/dist/index.d.cts 19.8 kB 0 B
packages/vechain-kit/dist/index.d.mts 19.8 kB 0 B
packages/vechain-kit/dist/index.mjs 541 kB +89 B (+0.02%)
packages/vechain-kit/dist/index.mjs.map 1.7 MB +725 B (+0.04%)
packages/vechain-kit/dist/utils 4.1 kB 0 B
packages/vechain-kit/dist/utils-Bl-JeVTg.cjs 26.2 kB 0 B
packages/vechain-kit/dist/utils-Bl-JeVTg.cjs.map 63 kB 0 B
packages/vechain-kit/dist/utils-DAs6kMGs.mjs 21.1 kB 0 B
packages/vechain-kit/dist/utils-DAs6kMGs.mjs.map 62.7 kB 0 B
packages/vechain-kit/dist/utils/index.cjs 1.91 kB 0 B
packages/vechain-kit/dist/utils/index.d.cts 2.94 kB 0 B
packages/vechain-kit/dist/utils/index.d.mts 2.94 kB 0 B
packages/vechain-kit/dist/utils/index.mjs 1.93 kB 0 B

compressed-size-action

Copy link
Member

@mikeredmond mikeredmond left a comment

Choose a reason for hiding this comment

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

nice, lgtm

@Agilulfo1820 Agilulfo1820 merged commit b4c9c35 into main Dec 16, 2025
8 checks passed
@Agilulfo1820 Agilulfo1820 deleted the fix/transaction-modal branch December 16, 2025 09:37
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.

🐛 [BUG] - Fix UI components style

3 participants