Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Persistent theme settings #347

Merged
merged 4 commits into from
Nov 12, 2024
Merged

Conversation

going-confetti
Copy link
Collaborator

@going-confetti going-confetti commented Nov 12, 2024

Description

How to Test

  • Try changing the default setting
  • Close the app
  • Open it again - the setting should persist

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (npm run lint) and all checks pass.
  • I have run tests locally (npm test) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Screenshots (if appropriate):

image

Related PR(s)/Issue(s)

@going-confetti going-confetti marked this pull request as ready for review November 12, 2024 11:29
@going-confetti going-confetti requested a review from a team as a code owner November 12, 2024 11:29
@going-confetti going-confetti requested review from cristianoventura and e-fisher and removed request for a team November 12, 2024 11:29
Copy link
Collaborator

@e-fisher e-fisher left a comment

Choose a reason for hiding this comment

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

Oh man, I loved that switch in activity bar 😞 It removes the friction to test both themes when developing, can we keep it in activity bar additionally to settings? We could also wrap in dev mode condition if there's a reason we don't want to have it there in prod builds.

@going-confetti
Copy link
Collaborator Author

Oh man, I loved that switch in activity bar 😞 It removes the friction to test both themes when developing, can we keep it in activity bar additionally to settings? We could also wrap in dev mode condition if there's a reason we don't want to have it there in prod builds.

Let's make it dev-only for now 👍

Copy link
Collaborator

@cristianoventura cristianoventura left a comment

Choose a reason for hiding this comment

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

LGTM! 🙌

@@ -4,6 +4,12 @@ import { IconButton, Tooltip } from '@radix-ui/themes'

export function ThemeSwitcher() {
const theme = useTheme()
// @ts-expect-error we have commonjs set as module option
const isDev = import.meta.env.DEV
Copy link
Collaborator

@cristianoventura cristianoventura Nov 12, 2024

Choose a reason for hiding this comment

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

Would process.env.NODE_ENV === 'development' work here to prevent @ts-expect-error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I was under the impression it wasn't available in the render process 👀. Replaced with process.env.NODE_ENV === 'development' 👍

@going-confetti going-confetti merged commit 33c0c4b into main Nov 12, 2024
2 checks passed
@going-confetti going-confetti deleted the feat/theme-options-settings branch November 12, 2024 16:24
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.

3 participants