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: Set selected theme via query string param #2204

Merged
merged 7 commits into from
Aug 30, 2024

Conversation

bmingles
Copy link
Contributor

@bmingles bmingles commented Aug 28, 2024

Allow setting selected theme via a themeKey query string param.

Can test by passing themeKey=default-light and themeKey=default-dark as query string params.

resolves #2203

Copy link

codecov bot commented Aug 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.74%. Comparing base (0a924cd) to head (6a020c5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2204      +/-   ##
==========================================
+ Coverage   46.73%   46.74%   +0.01%     
==========================================
  Files         693      693              
  Lines       38594    38602       +8     
  Branches     9652     9838     +186     
==========================================
+ Hits        18038    18046       +8     
  Misses      20545    20545              
  Partials       11       11              
Flag Coverage Δ
unit 46.74% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bmingles bmingles requested a review from mofojed August 28, 2024 21:55
@bmingles bmingles self-assigned this Aug 28, 2024
@@ -43,6 +43,7 @@ export type ThemeIconsRequiringManualColorChanges =

export const DEFAULT_DARK_THEME_KEY = 'default-dark' satisfies BaseThemeKey;
export const DEFAULT_LIGHT_THEME_KEY = 'default-light' satisfies BaseThemeKey;
export const THEME_KEY_OVERRIDE_QUERY_PARAM = 'themeKey';
Copy link
Member

Choose a reason for hiding this comment

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

Should we bother with the Key part of this param? May as well just call it theme.

Copy link
Member

Choose a reason for hiding this comment

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

Didn't see a response to this - why not just call it theme?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, didn't see this comment. I have renamed it.

Comment on lines 54 to 57
() =>
themeKeyOverride ??
getThemePreloadData()?.themeKey ??
DEFAULT_DARK_THEME_KEY
Copy link
Member

Choose a reason for hiding this comment

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

May as well wrap this all in a function, getDefaultTheme or getDefaultSelectedTheme. Then this just becomes.

... useState<string>(getDefaultSelectedTheme)

@bmingles bmingles requested a review from mofojed August 29, 2024 15:48
@bmingles bmingles merged commit 89ede66 into deephaven:main Aug 30, 2024
11 checks passed
@bmingles bmingles deleted the 2203-set-theme-via-query-string branch August 30, 2024 14:34
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow setting theme via query string parameter
2 participants