Skip to content

Add config option to hide theme switch#2414

Merged
dan-lee merged 3 commits into
zuplo:mainfrom
oksiweb:hide-theme-switch-config
May 12, 2026
Merged

Add config option to hide theme switch#2414
dan-lee merged 3 commits into
zuplo:mainfrom
oksiweb:hide-theme-switch-config

Conversation

@oksiweb

@oksiweb oksiweb commented May 2, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Added a new header.themeSwitcher.enabled config option.
  • When header.themeSwitcher.enabled is set to false, the light/dark theme switch is hidden from both the desktop header and the mobile navigation drawer.
  • The option defaults to true, so existing sites keep the current behavior.
  • Added documentation and test coverage for the new config option.

How to test

Set the option in zudoku.config.tsx:

header: {
  themeSwitcher: {
    enabled: false,
  },
}

Then run:

pnpm nx run zudoku:typecheck
pnpm nx run cosmo-cargo:build

You can also run the example locally:

nx run cosmo-cargo:dev

Expected successful behavior

  • When header.themeSwitcher.enabled is unset or true, the theme switch remains visible in the desktop header and mobile navigation drawer.
  • When header.themeSwitcher.enabled is false, the theme switch is not rendered in the desktop header.
  • When header.themeSwitcher.enabled is false, the theme switch is not rendered in the mobile navigation drawer.
  • Other header placement options, such as navigation, search, and auth, continue to work as before.

Unexpected behavior

  • The theme switch is hidden by default when header.themeSwitcher.enabled is not configured.
  • The theme switch is still rendered in the desktop header when header.themeSwitcher.enabled is false.
  • The theme switch is still rendered in the mobile navigation drawer when header.themeSwitcher.enabled is false.
  • Existing header navigation, search, or auth placement behavior changes unexpectedly.

Copilot AI review requested due to automatic review settings May 2, 2026 11:17
@vercel

vercel Bot commented May 2, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Zuplo Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

Preview build of published Zudoku package

Warning

This PR is from an external contributor. To run the public package build workflow, a maintainer must add the approve public build label after reviewing the changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new header.showThemeSwitch configuration option to let consumers hide the light/dark theme toggle while preserving existing default behavior (visible unless explicitly disabled).

Changes:

  • Extend config/types to include header.showThemeSwitch?: boolean.
  • Conditionally render ThemeSwitch in both the desktop header and mobile navigation drawer based on the new flag.
  • Document the new configuration option.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/zudoku/src/lib/core/ZudokuContext.ts Adds showThemeSwitch to the in-app header options type.
packages/zudoku/src/lib/components/MobileTopNavigation.tsx Hides the theme switch in the mobile drawer when configured.
packages/zudoku/src/lib/components/Header.tsx Hides the theme switch in the desktop header when configured.
packages/zudoku/src/config/validators/ZudokuConfig.ts Adds schema/type support for header.showThemeSwitch.
packages/zudoku/src/app/main.tsx Passes showThemeSwitch from validated config into runtime options.
docs/pages/docs/configuration/overview.md Documents the new header.showThemeSwitch option and its default.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/zudoku/src/lib/components/MobileTopNavigation.tsx
Comment thread packages/zudoku/src/app/main.tsx Outdated
Comment thread packages/zudoku/src/config/validators/ZudokuConfig.ts
Comment thread packages/zudoku/src/lib/components/Header.tsx
@oksiweb oksiweb force-pushed the hide-theme-switch-config branch from e69e3f5 to c239afd Compare May 2, 2026 11:48
@oksiweb oksiweb force-pushed the hide-theme-switch-config branch from c239afd to f32d2d3 Compare May 2, 2026 12:15
@mosch

mosch commented May 4, 2026

Copy link
Copy Markdown
Contributor

Hey @oksiweb - congrats on your first PR - looking good!

Can we just rename this to themeSwitcher: { enabled: true } (default true)` than we are good to go. This allows us to add more options later.

@oksiweb

oksiweb commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Hey @oksiweb - congrats on your first PR - looking good!

Can we just rename this to themeSwitcher: { enabled: true } (default true)` than we are good to go. This allows us to add more options later.

fixed

@mosch mosch enabled auto-merge (squash) May 5, 2026 10:15
Comment on lines +170 to +179
this.options = {
...options,
header: {
...options.header,
themeSwitcher: {
...options.header?.themeSwitcher,
enabled: options.header?.themeSwitcher?.enabled ?? true,
},
},
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Avoid the nested-spread default injection. Default at the consumer instead (see suggestions on Header.tsx and MobileTopNavigation.tsx).

Suggested change
this.options = {
...options,
header: {
...options.header,
themeSwitcher: {
...options.header?.themeSwitcher,
enabled: options.header?.themeSwitcher?.enabled ?? true,
},
},
};
this.options = options;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@dan-lee Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comment thread packages/zudoku/src/config/validators/ZudokuConfig.ts Outdated
Comment thread docs/pages/docs/configuration/overview.md Outdated
Comment thread packages/zudoku/src/lib/components/MobileTopNavigation.test.tsx Outdated
Comment thread packages/zudoku/src/lib/components/Header.test.tsx
auto-merge was automatically disabled May 11, 2026 14:43

Head branch was pushed to by a user without write access

@oksiweb oksiweb force-pushed the hide-theme-switch-config branch from b856d11 to 990514c Compare May 11, 2026 14:43
@oksiweb oksiweb requested review from Copilot and dan-lee May 11, 2026 14:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread docs/pages/docs/configuration/overview.md Outdated
@oksiweb oksiweb force-pushed the hide-theme-switch-config branch from 990514c to 7048b38 Compare May 11, 2026 14:58
@oksiweb oksiweb requested a review from Copilot May 11, 2026 15:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread packages/zudoku/src/lib/components/Header.test.tsx
Comment thread packages/zudoku/src/lib/components/Header.test.tsx
Comment thread packages/zudoku/src/lib/components/MobileTopNavigation.test.tsx Outdated
@oksiweb oksiweb force-pushed the hide-theme-switch-config branch from 7048b38 to e355917 Compare May 11, 2026 15:09
@oksiweb oksiweb requested a review from Copilot May 11, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@vercel

vercel Bot commented May 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zudoku-cosmo-cargo Ready Ready Preview, Comment May 12, 2026 7:02am
zudoku-dev Ready Ready Preview, Comment May 12, 2026 7:02am

Request Review

@dan-lee dan-lee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for your contribution and the quick turnaround @oksiweb! I also dropped the duplicate ?? true default in main.tsx so the fallback now lives only in the two consumers

@dan-lee dan-lee enabled auto-merge (squash) May 12, 2026 07:03
@dan-lee dan-lee merged commit 5405aab into zuplo:main May 12, 2026
8 checks passed
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.

4 participants