Skip to content

Conversation

rm-hull
Copy link
Owner

@rm-hull rm-hull commented May 26, 2025

No description provided.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @rm-hull, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello! gemini-code-assist here, providing a summary of this pull request. This PR is a work in progress aimed at upgrading the project's UI library from Chakra UI v2.x to v3.x. This is a significant undertaking as it involves breaking changes in the library's API and internal structure, requiring updates across various components and the application's main entry point. The changes reflect the adoption of Chakra UI v3's new component composition model and utility hooks.

Highlights

  • Chakra UI v3 Upgrade: The core of this PR is the upgrade of @chakra-ui/react from version 2.10.9 to 3.19.1. This major version bump introduces breaking changes and a new approach to building UI components, moving towards a more primitive-based system.
  • Dependency Updates and Removals: Several dependencies related to the previous Chakra UI version and its underlying libraries (@emotion/styled, framer-motion) have been removed or updated. New dependencies like next-themes and @chakra-ui/cli have been added to support the new v3 architecture and development workflow.
  • Refactored UI Component Structure: New files (color-mode.tsx, provider.tsx, toaster.tsx, tooltip.tsx) have been introduced under a new ui directory. These files implement core UI functionalities (color mode, global provider setup, toaster, tooltip) using the new Chakra UI v3 component patterns, indicating a shift in how these features are integrated.
  • Component API Adjustments: Existing components, specifically the Toolbar, have been updated to align with Chakra UI v3 API changes, such as renaming props (isOpen to open, isDisabled to disabled) and adjusting layout props (spacing to gap).
  • Application Initialization Changes: The main application entry point (main.tsx) has been modified to use the new Chakra UI v3 createSystem and ChakraProvider setup, replacing the older extendTheme and ColorModeScript methods.

Changelog

Click here to see the changelog
  • package.json
    • Updated @chakra-ui/react from ^2.10.9 to ^3.19.1 (line 17)
    • Removed @emotion/styled (line 20)
    • Removed framer-motion (line 28)
    • Added next-themes (line 32)
    • Added @chakra-ui/cli to devDependencies (line 49)
  • src/components/Toolbar.tsx
    • Changed useDisclosure property isOpen to open (line 37)
    • Changed HStack spacing prop spacing to gap (lines 55, 62)
    • Changed IconButton disabled prop isDisabled to disabled (lines 93, 104)
  • src/components/ui/color-mode.tsx
    • Added new file for color mode implementation using next-themes and Chakra UI v3 components.
  • src/components/ui/provider.tsx
    • Added new file for the main Chakra UI v3 provider setup.
  • src/components/ui/toaster.tsx
    • Added new file for the Chakra UI v3 toaster component.
  • src/components/ui/tooltip.tsx
    • Added new file for the Chakra UI v3 Tooltip component.
  • src/main.tsx
    • Removed old Chakra UI imports (ColorModeScript, createLocalStorageManager, extendTheme) (line 1)
    • Added new Chakra UI imports (createSystem, defaultConfig) (line 1)
    • Imported ColorModeProvider from new ui component (line 12)
    • Commented out old color mode manager initialization (line 23)
    • Replaced extendTheme with createSystem for theme configuration (lines 26-35)
    • Replaced old ChakraProvider setup with new ChakraProvider and ColorModeProvider (lines 40-41)
    • Commented out old ColorModeScript (line 39)
  • tsconfig.json
    • Added @/* path alias to compilerOptions (lines 22-24)
  • yarn.lock
    • Added @ark-ui/react and its dependencies (lines 18-84)
    • Updated @babel/runtime reference (line 1544)
    • Added @chakra-ui/cli and its dependencies (lines 1651-1680)
    • Updated @chakra-ui/react version and dependencies (lines 1682-1700)
    • Removed @chakra-ui/anatomy, @chakra-ui/hooks, @chakra-ui/theme-tools, @chakra-ui/theme entries (lines 1583-1663)
    • Updated @emotion/is-prop-valid reference (line 1784)
    • Updated @emotion/serialize reference (line 1821)
    • Removed @emotion/styled entry (lines 1772-1791)
    • Updated @emotion/use-insertion-effect-with-fallbacks reference (line 1848)
    • Updated @emotion/utils reference (line 1857)
    • Added various @esbuild platform-specific dependencies (lines 1885-2395)
    • Added @floating-ui dependencies (core, dom, utils) (lines 2516-2541)
    • Added @internationalized dependencies (date, number) (lines 2580-2597)
    • Updated @jridgewell/gen-mapping reference (line 2628)
    • Added @pandacss/is-valid-prop (lines 2728-2734)
    • Removed @popperjs/core entry (lines 2474-2480)
    • Added @sindresorhus/merge-streams (lines 3053-3059)
    • Added @swc/helpers (lines 3088-3095)
    • Added @types/cli-table and @types/debug (lines 3190-3204)
    • Added @types/ms (lines 3264-3270)
    • Added @visulima/boxen (lines 3721-3728)
    • Added various @zag-js dependencies (lines 3859-4681)
    • Added binary-extensions (lines 5090-5096)
    • Updated braces reference (line 5116)
    • Added bundle-n-require (lines 5139-5148)
    • Added chokidar (lines 5279-5297)
    • Added cli-table (lines 5305-5313)
    • Added colors (lines 5337-5343)
    • Added commander versions (lines 5353-5365)
    • Updated copy-to-clipboard reference (line 5409)
    • Updated csstype reference (line 5470)
    • Added data-uri-to-buffer (lines 5484-5490)
    • Removed detect-node-es entry (lines 4412-4417)
    • Added esbuild version 0.25.4 and its platform dependencies (lines 6034-6119)
    • Updated fast-glob reference (line 6730)
    • Added fast-safe-stringify (lines 6757-6763)
    • Added fetch-blob (lines 6800-6807)
    • Removed focus-lock entry (lines 5584-5591)
    • Added formdata-polyfill (lines 6910-6917)
    • Removed framer-motion entry (lines 5640-5660)
    • Removed framesync entry (lines 5662-5669)
    • Removed get-nonce entry (lines 5770-5775)
    • Updated glob-parent reference (line 7055)
    • Added globby version 14.1.0 and its dependencies (lines 7127-7140)
    • Updated https-proxy-agent reference (line 7298)
    • Updated ignore reference (line 7331)
    • Added is-binary-path (lines 7425-7432)
    • Updated is-glob reference (line 7516)
    • Added look-it-up (lines 7938-7944)
    • Removed motion-dom and motion-utils entries (lines 6944-6958)
    • Added mz (lines 8229-8238)
    • Added next-themes (lines 8289-8297)
    • Added node-domexception (lines 8299-8305)
    • Added node-eval (lines 8306-8313)
    • Added node-fetch (lines 8315-8324)
    • Added normalize-path reference (lines 8364-8370)
    • Updated object-assign reference (line 8371)
    • Added package-manager-detector (lines 8521-8527)
    • Added path-is-absolute (lines 8556-8562)
    • Added path-type (lines 8594-8600)
    • Added perfect-freehand (lines 8615-8621)
    • Updated picomatch reference (line 8629)
    • Added pirates (lines 8643-8649)
    • Updated prettier reference (line 8702)
    • Updated prop-types reference (line 8746)
    • Added proxy-compare (lines 8757-8763)
    • Added proxy-memoize (lines 8771-8778)
    • Added readdirp (lines 8953-8960)
    • Removed react-clientside-effect entry (lines 7433-7442)
    • Removed react-fast-compare entry (lines 7479-7484)
    • Removed react-focus-lock entry (lines 7486-7504)
    • Removed react-remove-scroll-bar entry (lines 7543-7557)
    • Removed react-remove-scroll entry (lines 7559-7576)
    • Removed react-style-singleton entry (lines 7616-7630)
    • Added scule (lines 9465-9471)
    • Added sisteransi (lines 9626-9632)
    • Added slash version 5.1.0 (lines 9640-9646)
    • Added sucrase (lines 9925-9941)
    • Added thenify-all and thenify (lines 10001-10018)
    • Added ts-interface-checker (lines 10128-10134)
    • Updated tslib reference (line 10175)
    • Added unicorn-magic (lines 10348-10354)
    • Added uqr (lines 10387-10393)
    • Removed use-callback-ref and use-sidecar entries (lines 9044-9073)
    • Added web-streams-polyfill (lines 10595-10601)
    • Added zod (lines 10800-10805)
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


UI components shift,
From old ways to the new,
Code adapts and grows.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coveralls
Copy link

coveralls commented May 26, 2025

Pull Request Test Coverage Report for Build 18289602444

Details

  • 0 of 1060 (0.0%) changed or added relevant lines in 27 files are covered.
  • 11 unchanged lines in 7 files lost coverage.
  • Overall coverage remained the same at 0.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/main.tsx 0 5 0.0%
src/components/DropZone.tsx 0 6 0.0%
src/pages/Import.tsx 0 6 0.0%
src/components/ResetDataButton.tsx 0 7 0.0%
src/pages/Scratch.tsx 0 7 0.0%
src/components/MathResult.tsx 0 8 0.0%
src/components/ui/provider.tsx 0 8 0.0%
src/components/ErrorFallback.tsx 0 9 0.0%
src/components/CopyToClipboardButton.tsx 0 10 0.0%
src/components/GotoScratchpad.tsx 0 12 0.0%
Files with Coverage Reduction New Missed Lines %
src/components/GotoScratchpad.tsx 1 0.0%
src/components/ResetDataButton.tsx 1 0.0%
src/pages/Import.tsx 1 0.0%
src/components/ExportModal.tsx 2 0.0%
src/components/MathResult.tsx 2 0.0%
src/components/Search.tsx 2 0.0%
src/components/Toolbar.tsx 2 0.0%
Totals Coverage Status
Change from base Build 18289378373: 0.0%
Covered Lines: 0
Relevant Lines: 2386

💛 - Coveralls

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request makes progress on upgrading to Chakra UI 3.x. Many of the API changes and dependency updates, such as the move from isOpen to open in useDisclosure, spacing to gap in HStack, and isDisabled to disabled in IconButton, are correctly implemented. The new Toaster and Tooltip components also leverage Chakra UI v3's composition effectively.

The primary area for discussion is the new color mode management strategy using next-themes. While this is a valid approach, it's worth ensuring it's a deliberate choice with clear benefits over Chakra UI's native v3 color mode capabilities, and that it's configured to match previous behavior if intended.

Additionally, the use of "use client" directives and ClientOnly in a Vite-based project warrants clarification. The tsconfig.json update for path aliases is a nice improvement for maintainability.

Summary of Findings

  • Color Mode Management Strategy: The PR introduces next-themes for color mode management, replacing Chakra UI's native system. This is a significant architectural decision. It's important to clarify the rationale and ensure that configurations like initial theme and storage key are correctly migrated or intentionally changed. There's a potential for added complexity or conflicts if not carefully managed.
  • Removal of framer-motion: framer-motion was a dependency, likely for animations with Chakra UI v2. Its removal might impact existing animations. Verification of animation functionality is recommended.
  • Usage of "use client" and ClientOnly: The "use client" directive and <ClientOnly> component are used in new UI files. In a standard Vite CSR setup, these are often unnecessary. Clarification on their purpose (e.g., for a Vite SSR build) would be beneficial.
  • Potential Configuration Gaps in next-themes: The custom ColorModeProvider wrapping next-themes is used without explicit props for defaultTheme or storageKey in main.tsx, which were previously configured with Chakra's native system. This might lead to different behavior or loss of user preferences if not addressed.
  • isDisabled to disabled: For consistency with standard HTML attributes, it is recommended to use disabled instead of isDisabled for button components.

Merge Readiness

This PR is marked as WIP, and the changes reflect a good start to the Chakra UI v3 upgrade. However, before this can be considered ready for merge, the questions raised, particularly around the color mode management strategy with next-themes and the removal of framer-motion, should be addressed. Ensuring the new color mode system is robust, correctly configured, and justified is key. I am unable to approve pull requests, but I recommend addressing these points and conducting thorough testing before considering this for merge. Given the medium severity issues, changes are requested.

package.json Outdated
"axios": "^1.9.0",
"chakra-ui-contextmenu": "^1.0.5",
"clsx": "^2.1.1",
"framer-motion": "^12.14.0",

Choose a reason for hiding this comment

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

medium

I see framer-motion has been removed from the dependencies. Chakra UI v2 relied on it for animations. Could you clarify if animations previously dependent on framer-motion are still functional or if they've been re-implemented using Chakra UI v3's capabilities or an alternative? If animations are critical, this change might have an impact.

"jotai": "^2.12.4",
"js-base64": "^3.7.7",
"mathjs": "^14.5.0",
"next-themes": "^0.4.6",

Choose a reason for hiding this comment

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

medium

The addition of next-themes is an interesting choice for color mode management. Chakra UI v3 provides its own robust color mode system. Could you elaborate on the rationale for integrating next-themes here? Understanding the benefits or specific requirements this addresses would be helpful.

<Tooltip label="Format">
<IconButton
isDisabled={!canFormat || locked}
disabled={!canFormat || locked}

Choose a reason for hiding this comment

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

medium

Consider using disabled instead of isDisabled for consistency with standard HTML attributes. This change aligns with the Chakra UI v3 migration.

disabled={!canFormat || locked}

<Tooltip label="Delete">
<IconButton
isDisabled={locked}
disabled={locked}

Choose a reason for hiding this comment

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

medium

Consider using disabled instead of isDisabled for consistency with standard HTML attributes. This change aligns with the Chakra UI v3 migration.

disabled={locked}

@@ -0,0 +1,108 @@
"use client"

Choose a reason for hiding this comment

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

medium

The "use client" directive is present at the top of this new file. In a Vite-based Client-Side Rendered (CSR) application, this directive is often associated with frameworks like Next.js (App Router) for distinguishing Server and Client Components. Is there a specific reason for its use here, such as a Vite SSR setup or a particular build configuration that necessitates it?

Comment on lines +12 to +15
export function ColorModeProvider(props: ColorModeProviderProps) {
return (
<ThemeProvider attribute="class" disableTransitionOnChange {...props} />
)

Choose a reason for hiding this comment

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

medium

This ColorModeProvider wraps the ThemeProvider from next-themes. This seems to be the core of the new color mode strategy. It would be good to ensure this custom provider seamlessly integrates with Chakra UI's theming and doesn't introduce conflicts with how Chakra components expect color mode to be managed. Have you considered using Chakra UI v3's built-in ChakraProvider capabilities for color mode (e.g., with colorModeManager and potentially ColorModeScript) and what led to choosing next-themes instead?

>(function ColorModeButton(props, ref) {
const { toggleColorMode } = useColorMode()
return (
<ClientOnly fallback={<Skeleton boxSize="8" />}>

Choose a reason for hiding this comment

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

medium

The ColorModeButton uses <ClientOnly /> from @chakra-ui/react. Similar to the "use client" directive, could you clarify the necessity of ClientOnly here? Is it to prevent SSR mismatches or address a specific hydration issue? In a typical Vite CSR setup, this might not be required.

Comment on lines +81 to +91
<Span
color="fg"
display="contents"
className="chakra-theme light"
colorPalette="gray"
colorScheme="light"
ref={ref}
{...props}
/>
)
},

Choose a reason for hiding this comment

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

medium

The LightMode (and similarly DarkMode) component sets className="chakra-theme light" and colorScheme="light". What is the intended use case for these components? If they are meant for local theme overrides, that's one thing. If they are part of the global theme switching, it might be redundant or conflict with what next-themes and the main ChakraProvider are already managing. Could you provide some context on how these will be used?

@@ -0,0 +1,15 @@
"use client"

Choose a reason for hiding this comment

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

medium

Similar to color-mode.tsx, this new Provider component also starts with the "use client" directive. Could you clarify if this is necessary for the project's build setup (e.g., Vite SSR)?

src/main.tsx Outdated
Comment on lines 40 to 41
<ChakraProvider value={system}>
<ColorModeProvider />

Choose a reason for hiding this comment

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

medium

The custom ColorModeProvider (which wraps next-themes) is invoked here without any props: <ColorModeProvider />. The previous setup used <ColorModeScript initialColorMode="dark" storageKey="scratchpad.color-mode" /> and a localStorageManager with the same storage key.

How are these configurations (initial color mode, storage key) being handled with next-themes? If these specific settings are still desired, they might need to be passed as props to your ColorModeProvider to configure the underlying next-themes ThemeProvider (e.g., defaultTheme, storageKey).

rm-hull added 12 commits June 28, 2025 15:46
…de-chakra

* 'main' of github.com:rm-hull/scratchpad:
  Update dependencies
  Bump eslint-plugin-testing-library from 7.2.2 to 7.5.3 (#509)
  Bump @eslint/js from 9.27.0 to 9.28.0 (#505)
  Bump vitest from 3.1.4 to 3.2.3 (#504)
  Bump brace-expansion from 1.1.11 to 1.1.12 in the npm_and_yarn group (#507)
  Bump mathjs from 14.5.0 to 14.5.2 (#503)
  Bump framer-motion from 12.16.0 to 12.18.1 (#510)
  Bump jotai from 2.12.4 to 2.12.5 (#491)
  Bump framer-motion from 12.14.0 to 12.16.0 (#498)
  Bump @babel/parser from 7.27.2 to 7.27.5 (#499)
  Bump @types/react from 19.1.5 to 19.1.7 (#501)
  Bump @typescript-eslint/eslint-plugin from 8.32.1 to 8.34.0 (#500)
…de-chakra

* 'main' of github.com:rm-hull/scratchpad: (28 commits)
  Update dependencies
  Bump eslint-plugin-prettier from 5.5.3 to 5.5.4 (#576)
  Bump @eslint/js from 9.31.0 to 9.35.0 (#577)
  Bump @types/ramda from 0.30.2 to 0.31.1 (#578)
  Bump react-router-dom from 7.7.0 to 7.9.0 (#579)
  Bump axios from 1.10.0 to 1.12.1 (#580)
  Bump eslint-plugin-testing-library from 7.6.0 to 7.6.8 (#573)
  Bump @testing-library/dom from 10.4.0 to 10.4.1 (#572)
  Bump react-dom and @types/react-dom (#569)
  Bump js-base64 from 3.7.7 to 3.7.8 (#570)
  Bump @typescript-eslint/parser from 8.37.0 to 8.43.0 (#574)
  Bump chalk from 5.4.1 to 5.6.2 (#571)
  Bump @typescript-eslint/eslint-plugin from 8.37.0 to 8.43.0 (#567)
  Bump @stylistic/eslint-plugin from 5.2.0 to 5.3.1 (#560)
  Bump @babel/parser from 7.28.0 to 7.28.4 (#565)
  Bump react and @types/react (#564)
  Bump babel-plugin-react-compiler from 19.1.0-rc.2 to 19.1.0-rc.3 (#566)
  Bump vite from 7.0.5 to 7.0.7 in the npm_and_yarn group across 1 directory (#568)
  Bump @types/node from 24.0.15 to 24.3.1 (#562)
  Bump form-data from 4.0.1 to 4.0.4 in the npm_and_yarn group (#539)
  ...
…de-chakra

* 'main' of github.com:rm-hull/scratchpad:
  Support XML
…de-chakra

* 'main' of github.com:rm-hull/scratchpad:
  Improved layout for formatting errors
  Add Golang & JSON5 syntax colouring
…de-chakra

* 'main' of github.com:rm-hull/scratchpad:
  Update dependencies
  Bump eslint-plugin-testing-library from 7.7.0 to 7.8.0 (#584)
  Bump eslint-plugin-n from 17.21.3 to 17.23.1 (#590)
  Bump axios from 1.12.1 to 1.12.2 (#585)
  Bump @types/node from 24.3.3 to 24.5.2 (#589)
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