-
-
Notifications
You must be signed in to change notification settings - Fork 432
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: Add quick settings menu with theme switcher and other changes #673
feat: Add quick settings menu with theme switcher and other changes #673
Conversation
app/assets/javascripts/ui_models/app_state/quick_settings_state.ts
Outdated
Show resolved
Hide resolved
…e.ts Co-authored-by: Mo Bitar <[email protected]>
feat: Move layerable themes to bottom
feat: Handle "Escape" key feat: Make menu button look consistent to quick settings menu
const items: NodeListOf<HTMLButtonElement> = | ||
accountMenuRef.current.querySelectorAll('.sn-dropdown-item'); | ||
const currentFocusedIndex = Array.from(items).findIndex( | ||
(btn) => btn === document.activeElement | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more React-ish way of doing this would be to have an array of refs, a state variable specifying the currentFocusedIndex and a useEffect
hook that would focus the right ref whenever the focused index state variable changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've implemented this in commit 5219013, but I am facing a weird issue - the "Sign out" button gets focused by default as it gets pushed to the array before "Account settings" does. Ideally, "Account settings" would be focused by default, but I'm not sure what the best way to do that would be with this refs array implementation.
app/assets/javascripts/ui_models/app_state/quick_settings_state.ts
Outdated
Show resolved
Hide resolved
…e.ts Co-authored-by: Antonella Sgarlatta <[email protected]>
Co-authored-by: Antonella Sgarlatta <[email protected]>
… feat/theme-switcher
This PR adds a quick settings menu with a theme switcher when there are themes available, otherwise it directly opens the Preferences screen.
Theme Switcher:
Other changes: