Skip to content

fix(settings/ui): single-card danger switch, radius sync, toolbar chevrons - #104

Merged
kzamanbd merged 4 commits into
mainfrom
fix/dokan-admin-settings-ui-issue
Aug 17, 2026
Merged

fix(settings/ui): single-card danger switch, radius sync, toolbar chevrons#104
kzamanbd merged 4 commits into
mainfrom
fix/dokan-admin-settings-ui-issue

Conversation

@kzamanbd

@kzamanbd kzamanbd commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Changes proposed in this Pull Request

Settings UI fixes surfaced while wiring up the Dokan admin settings screens.

danger_switch field (settings/fields.tsx)

The Data Clear Consent block rendered its own card inside the section card its
parent already draws, so the block showed two borders a pixel apart, and its copy
stretched edge to edge on wide screens.

  • Field now paints inside the parent surface — no border, radius or background of
    its own — like every other field. Flag the parent is_danger in the schema to
    get the destructive tint/border (SettingsSection already supports it).
  • Text column capped to sm:col-span-8 (mirrors FieldWrapper's label grid) so
    the description wraps to a readable measure instead of running the full panel
    width; switch moves to the matching sm:col-span-4 cell.
  • Description bumped text-xstext-sm.
  • Title/description/icon use color-mix(in oklab, var(--destructive) 82%, black).
    Raw --destructive is tuned for solid fills (buttons, switch tracks) and reads
    too hot as text on the pale destructive card. An arbitrary value rather than a
    new destructive-strong token because consumer Tailwind builds map only
    --color-destructive, so a new token would compile here and be dead there.

Radius consistency (settings/fields.tsx, settings-content.tsx)

Settings surfaces used a mix of rounded-lg / rounded-xl / rounded-2xl /
hardcoded rounded-[4px]. Now one scale: containers share a radius, controls
rounded-md, checkboxes rounded-sm (token-derived, no hardcoded px), pills
rounded-full.

Rich text editor toolbar (ui/rich-text-editor.tsx)

The three toolbar dropdowns are native <select>s that inherit the host app's
select styling. In WordPress admin that means a host-drawn arrow at the right
edge, painted on top of "Paragraph" / "Sans Serif" / "14 px" because the control
only reserved 8px of end padding.

New ToolbarSelect wrapper: appearance-none bg-none suppresses the host arrow,
ps-2 pe-6 reserves space, and a ChevronDown sits at end-1.5 — logical
properties, so RTL stays correct.

Also in this branch

  • feat(settings): unsaved-changes confirmation dialog + handlers
    (settings-context.tsx, settings/index.tsx, settings-types.ts).
  • fix(select-field): placeholder handling.
  • fix(sidebar/layout-menu): sidebar menu/submenu styles.

Related Pull Request(s)

How to test

  1. Build this branch and point a Dokan install at the result.
  2. Dokan → Settings → Compliance → Privacy.
  3. Data Clear Consent block: one border (destructive-tinted), description wraps to
    a readable measure, radius matches the Admin Area Access card above it.
  4. Privacy Policy Content editor: the Paragraph / Sans Serif / 14 px dropdown
    chevrons sit clear of their labels, in both LTR and RTL.

Verified

  • npm run typecheck — clean
  • npm run build — clean; new utilities present in dist/index.css
  • Checked in a live WP admin: computed radius on the danger block matches its
    sibling section cards, title and description resolve to the same darkened
    destructive colour, text column measures ~63% of the card width.

@kzamanbd
kzamanbd merged commit 49abb30 into main Aug 17, 2026
1 check passed
@kzamanbd
kzamanbd deleted the fix/dokan-admin-settings-ui-issue branch August 17, 2026 12:28
kzamanbd added a commit to getdokan/dokan that referenced this pull request Aug 17, 2026
Picks up getdokan/plugin-ui#104 (49abb30): the danger_switch field no
longer draws its own card, so the data_clear_section is_danger flag in
this branch renders a single destructive card instead of a doubled
border.
kzamanbd added a commit to getdokan/dokan that referenced this pull request Aug 17, 2026
)

* fix(settings): flag data clear section as danger

The danger_switch field no longer paints its own card, so the section
around it has to supply the destructive tint and border. Without this
flag the block rendered a neutral card with a second, inset red frame
drawn by the field itself.

* feat(settings): warn before leaving with unsaved changes

Plugin UI guards its own sidebar navigation and the browser unload, but
it cannot see this app's router. Track its dirty state and block route
changes with useBlocker, confirming through an AlertDialog.

The blocker compares pathnames only: UrlSync rewrites the query string
on every subpage switch, and those navigations are already handled by
plugin-ui's own guard.

* fix(commission): close the 1px seam in combined inputs

Two separate causes left a gap between the currency addon and its input:

- WordPress admin's forms.css sets `margin: 0 1px` on inputs, holding the
  two halves apart. `!m-0` removes it.
- dokan-ui's addOnLeft span already ships `border-r-0`, and we stripped
  `border-l` from the input as well, so nothing drew the shared edge.

The percentage side keeps `!border-r-0` because its addon uses `-ml-px`
with a full border to overlap and merge instead.

* fix(settings): align schema defaults with reader fallbacks

The new settings screen writes its schema default on the first save of an
untouched page, so a default that disagrees with what the reading code
assumes when the option is unset changes behaviour with no user action.

- one_step_product_create: off -> on. Readers in functions.php and
  Assets.php fall back to 'on', so saving Vendors settings once turned
  off the single-page product form.
- enabled_address_on_reg: on -> off. The three registration templates
  fall back to 'off', so saving Vendor Onboarding once added address
  fields to the vendor registration form.

Both now match the legacy screen's defaults.

Refs getdokan/dokan-pro#6067 (BUG-01, BUG-02)

* fix(settings): restore legacy defaults for three more fields

Same defect as BUG-01..03: the new screen writes its schema default on the
first save of an untouched page, so a default that disagrees with the
legacy one changes behaviour with no user action.

- dokan_fontawesome_enabled: off -> on. The field is the inverse of the
  stored disable_dokan_fontawesome, so 'off' stored 'on' and dropped the
  font-awesome library from the frontend (Assets.php reads it with an
  'off' fallback).
- vendor_setup_wizard_message: no default -> the legacy welcome copy.
- privacy_policy_content: no default -> the legacy policy copy. Both
  rich-text fields rendered empty and saved a blank string over the text
  the legacy screen ships.

Found by diffing every schema default against apply_filters(
'dokan_settings_fields' ) with each field's legacy_transformer applied,
so inverted and reshaped fields are not false positives.

Refs getdokan/dokan-pro#6067 (BUG-04)

* fix(settings): add Select page placeholder to privacy policy page

The other five page-selects on Page Setup already prompt with "Select
page"; the privacy policy page select fell back to the generic
"Select..." from the field renderer.

* chore(deps): bump @wedevs/plugin-ui to the merged settings UI fixes

Picks up getdokan/plugin-ui#104 (49abb30): the danger_switch field no
longer draws its own card, so the data_clear_section is_danger flag in
this branch renders a single destructive card instead of a doubled
border.
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.

1 participant