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

Add the custom themes to the themes page of the onboarding flow #6785

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

rezbyte
Copy link
Contributor

@rezbyte rezbyte commented Mar 26, 2024

This appends the whitelabel themes to the bottom of the radio buttons on the themes page of the onboarding flow. When there is too many themes to display, it vertically expands the dialog. Which I did not program in but I can change it to scroll if desired.

The whitelabel popup and it's translation keys have also been removed as per acceptance criteria.

Closes #6770.

export class SetupThemePage implements WizardPageN<null> {
export class SetupThemePage implements WizardPageN<SetupThemePageAttrs> {
// The whitelabel themes formatted as `RadioSelectorOption`s.
private customThemes: Array<RadioSelectorOption<string>> = []
Copy link
Contributor

Choose a reason for hiding this comment

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

you use two variables to represent the state: one for custom themes and one to indicate whether the themes are loaded. I am a big proponent of "make invalid states unrepresentable" so I would suggest pulling it into a single variable. It can be as simple as nullable array or it can be more explicit as {state: "loading"} | {state: "loaded", themes: readonly string[] } (I am not sure we need to prepare the options every time, to me it's part of view attributes that should be created on each render).

Copy link
Contributor

Choose a reason for hiding this comment

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

This currently relies on ThemeController already having custom themes but if the timing is wrong we might not have them yet. I think it's okay to take this risk though, it's not the first page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you use two variables to represent the state: one for custom themes and one to indicate whether the themes are loaded. I am a big proponent of "make invalid states unrepresentable" so I would suggest pulling it into a single variable. It can be as simple as nullable array or it can be more explicit as {state: "loading"} | {state: "loaded", themes: readonly string[] } (I am not sure we need to prepare the options every time, to me it's part of view attributes that should be created on each render).

That is a better way of doing it for sure. I have gone the nullable array route now.

@@ -1659,7 +1659,6 @@ export type TranslationKeyType =
| "whitelabelDomain_label"
| "whitelabelRegistrationCode_label"
| "whitelabelRegistrationEmailDomain_label"
| "whitelabelThemeDetected_msg"
Copy link
Contributor

Choose a reason for hiding this comment

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

the key will come back on the next translation update, we should mark it as deprecated in Phrase at least

@rezbyte rezbyte force-pushed the onboarding-custom-theme-6770 branch from a5edbad to fd1e169 Compare March 26, 2024 16:17
@murilopereirame murilopereirame added this pull request to the merge queue Mar 27, 2024
Merged via the queue into master with commit 40610dc Mar 27, 2024
2 checks passed
@murilopereirame murilopereirame deleted the onboarding-custom-theme-6770 branch March 27, 2024 09:55
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.

Custom theme as an option in onboarding wizard
3 participants