Repository navigation
Invisible titlebar - #681
Conversation
Am I doing this right?
niik
left a comment
There was a problem hiding this comment.
Great @donokuda! This has been on my list for a while ❤️
Also good to note here is that I have no clue what I am doing so plz advise 😄
So there's one suggestion that I would make and that's to make this state derived from our other state rather than being an imperative action (hide/show titlebar). That bullshit developery sentence was me saying that instead of having a hideTitleBar and showTitlebar method we should consider when we want the title bar to be hidden. Right now the only time that's true is when we're showing the welcome flow.
It just so happens that we have a state for whether we're showing the welcome flow or not, IAppState.showWelcomeFlow. So I think if we just make a tiny tweak in app-store.ts we can ditch the hide/show methods entirely
sidebarWidth: this.sidebarWidth,
- hideTitlebar: this.hideTitlebar,
+ // Use the light title bar style when we're in the welcome flow
+ hideTitlebar: this.showWelcomeFlow,By doing this we can remove the methods and the hideTitlebar field in the app state.
The reason for doing it this way is that we shouldn't have do depend on whether some component accurately calls hideTitleBar at the right time. With an approach like the one we have above we know that if, and only if, the welcome flow is showing we'll hide the titleBar. And if we add a new view at some point in the future where we want to have the light title bar style we have just one place to tweak it and the view doesn't need to care.
Finally I think the hideTitlebar idiom might be a bit confusing, the title bar is still there, right? So I think a better name for the state would be titleBarStyle and we could make that be one of two strings, i.e.
- readonly hideTitlebar: boolean
+ readonly titleBarStyle: 'light' | 'dark'We could then update our derived that like this
sidebarWidth: this.sidebarWidth,
// Use the light title bar style when we're in the welcome flow
- hideTitlebar: this.showWelcomeFlow,
+ hideTitlebar: this.showWelcomeFlow ? 'light' : 'dark',|
@niik 🙇 Thanks for the guidance! The diff looks way more simple as a result. This is ready for another review! |
| ? <WindowControls /> | ||
| : null | ||
|
|
||
| const titleBarStyle = (this.state.titleBarStyle === 'light') ? |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
- Change variable name from titleBarStyle to titleBarClass so it's different from the app property - Minor formatting changes
|
📟 Ready for another review |
|
A+ would review again |
(Targets branch
polish-welcome-flow)This PR shows and hides the app titlebar when in the welcome flow by removing the background color. On Windows, you'll still see the window controls. You'll also still be able to drag around the app. The titlebar reappears when you finish the welcome flow.
Also good to note here is that I have no clue what I am doing so plz advise 😄
demo.gifs:
Windows
Mac