Skip to content

Invisible titlebar - #681

Merged
niik merged 10 commits into
polish-welcome-flowfrom
light-toolbar
Nov 23, 2016
Merged

niik merged 10 commits into
polish-welcome-flowfrom
light-toolbar

Conversation

@donokuda

Copy link
Copy Markdown
Contributor

(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

titlebar

Mac

titlebar-test-osx

@donokuda donokuda mentioned this pull request Nov 22, 2016
@niik niik self-assigned this Nov 23, 2016

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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',

@donokuda

Copy link
Copy Markdown
Contributor Author

@niik 🙇 Thanks for the guidance! The diff looks way more simple as a result.

This is ready for another review!

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awww yeah @donokuda, just one tiny comment and then I think we're good to go. Stellar work!

Comment thread app/src/ui/app.tsx Outdated
? <WindowControls />
: null

const titleBarStyle = (this.state.titleBarStyle === 'light') ?

This comment was marked as spam.

This comment was marked as spam.

- Change variable name from titleBarStyle to titleBarClass so it's different from the app property
- Minor formatting changes
@donokuda

Copy link
Copy Markdown
Contributor Author

📟 Ready for another review

@niik
niik merged commit 192c4e5 into polish-welcome-flow Nov 23, 2016
@niik
niik deleted the light-toolbar branch November 23, 2016 21:19
@niik

niik commented Nov 23, 2016

Copy link
Copy Markdown
Member

A+ would review again

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.

2 participants