logto-io / logto

🧑‍🚀 The better identity infrastructure for developers and the open-source alternative to Auth0.
https://logto.io
Mozilla Public License 2.0
8.66k stars 439 forks source link

fix(console): dragging anchor in the color picker on application branding page #6340

Closed xiaoyijun closed 3 months ago

xiaoyijun commented 3 months ago

Summary

This PR addresses issues with the color picker anchor is not draggable on the application branding page, updates the color picker library, and fixes a bug with the "Recalculate" button for dark mode colors.

Changes:

  1. Fixed color picker re-rendering issue in application branding page

    • Refactored NonThirdPartyBrandingForm to use useFormContext instead of useCallback, this prevents the color palette from closing unexpectedly when color value changed due to unnecessary re-renders
  2. Replaced react-color with react-color-palette as react-color is no longer actively maintained

  3. Fixed "Recalculate" button not marking form as dirty

    • Added { shouldDirty: true } when recalculating dark primary color to properly update form state

Testing

https://github.com/user-attachments/assets/a57191dd-6aec-4ad7-b15d-89c00d4f0ae9

Checklist

- [ ] .changeset - [ ] unit tests - [ ] integration tests - [ ] necessary TSDoc comments

github-actions[bot] commented 3 months ago

COMPARE TO master

Total Size Diff :chart_with_downwards_trend: -233 Bytes

Diff by File |Name|Diff| |---|---| |packages/console/package.json|:chart_with_downwards_trend: -7 Bytes| |packages/console/src/App.tsx|:chart_with_downwards_trend: -90 Bytes| |packages/console/src/ds-components/ColorPicker/index.module.scss|:chart_with_downwards_trend: -30 Bytes| |packages/console/src/ds-components/ColorPicker/index.tsx|:chart_with_downwards_trend: -136 Bytes| |packages/console/src/pages/ApplicationDetails/ApplicationDetailsContent/Branding/NonThirdPartyBrandingForm.tsx|:chart_with_downwards_trend: -3.04 KB| |packages/console/src/pages/ApplicationDetails/ApplicationDetailsContent/Branding/index.tsx|:chart_with_downwards_trend: -2.63 KB| |packages/console/src/pages/SignInExperience/PageContent/Branding/BrandingForm/index.tsx|:chart_with_downwards_trend: -41 Bytes| |packages/integration-tests/src/tests/console/sign-in-experience/helpers.ts|:chart_with_downwards_trend: -8 Bytes| |pnpm-lock.yaml|:chart_with_downwards_trend: -965 Bytes|