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: Presentation Mode #208

Merged
merged 18 commits into from
Feb 28, 2023
Merged

feat: Presentation Mode #208

merged 18 commits into from
Feb 28, 2023

Conversation

jimniels
Copy link
Collaborator

@jimniels jimniels commented Feb 2, 2023

  • Adds a feature to show/hide application UI (which basically is a shortcut to show/hide all view preferences).
  • Adds a feature to show/hide debug menu from the command palette

Feb-02-2023 16-29-20

CleanShot 2023-02-02 at 16 37 58@2x

Notes:

  • Figma calls this "Show/Hide UI" and you can trigger it with CMD . or CMD \
  • VSCode has a "Zen mode" CMD K Z
  • NOTE: \ is used as "clear formatting" in Sheets

Todos:

  • Add "Hide application UI" to command palette & top menu
  • Add "Show debug menu" to command palette
    • If debug menu is open, it closes when "Hide UI" is toggled (but doesn't re-open when you turn off "Hide UI")
  • Hide application UI controls visibility of debug menu
  • CMD + \ shortcut for "Hide application UI"
  • Maybe rename it to "Show/Hide UI" like figma? Need a little more thought... Will call it "Hide application UI"

@jimniels
Copy link
Collaborator Author

jimniels commented Feb 2, 2023

This is kind of hard to test without this issue being resolved first.

@davidkircos
Copy link
Collaborator

I use this in Figma a lot. I like calling it "Show / Hide UI" that is super clear to me. Also Command + / seems like a good short cut.

Love this feature.

@aws-amplify-us-west-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-208.de5w5iglj13on.amplifyapp.com

@jimniels
Copy link
Collaborator Author

jimniels commented Feb 2, 2023

@davidkircos I don't love the name "Show/Hide UI" because it feels like it breaks uniformity with how we name all our other view preferences, e.g. we already have other view prefs which are labeled "Show ____"

  • Show row and column headings
  • Show grid axis
  • Show grid lines
  • Show cell type outlines

In theory, they're doing the same thing as this, so shouldn't they be called "Show/Hide ____" e.g.

  • Show/hide row and column headings
  • Show/hide grid axis
  • Show/hide grid lines
  • Show/hide cell type outlines
  • Show/hide UI

But the "shown" or "hidden" state is communicated by checkmarks in our app, so you don't really need the dual label. For example, this is Figma today: can you tell, from only this screenshot, whether it's showing or hiding the UI? i.e. does the checked box mean it's showing or hiding when the label says both "Show" and "Hide"?

CleanShot 2023-02-02 at 14 49 47@2x

But to your point, perhaps its obvious enough when you use the app.

The options in my head are:

  1. Give it a name, like "Zen mode" or "Presentation mode", as it's not just toggling individual preferences like the others but a grouping of them. Then you can easily have a checkbox like [X] Presentation mode means it's on (unchecked means its off)
  2. Have it match the pattern of the other labels and maybe give it a more precise name, like "Show grid UI"
  3. Just roll with "Show/Hide UI"

Typing this out is an exercise in thinking and maybe just "Show/hide UI" is enough and people will just use it without thinking about it too much — but I don't have to love how it breaks consistency in labeling with the other menu items ha

@davidkircos
Copy link
Collaborator

davidkircos commented Feb 2, 2023 via email

@jimniels
Copy link
Collaborator Author

jimniels commented Feb 2, 2023

I like that.

In theory we could hide the entire UI with that command

CleanShot 2023-02-02 at 15 01 13@2x

You'd probably want some little temporary floating UI, like "return to app (CMD + /)"

But I like keeping the chrome for now.

CleanShot 2023-02-02 at 15 01 27@2x

I'll roll with that.

@jimniels
Copy link
Collaborator Author

jimniels commented Feb 2, 2023

Ok, I like calling it "Hide application UI"

CleanShot 2023-02-02 at 15 06 47@2x

That distinguishes it apart from the others as a kind of toggle for all of them (which are on by default). Same for the "View" menu:

CleanShot 2023-02-02 at 15 42 51@2x

When you toggle any "Show" it exits you from the "hide application mode" which I think feels right.

@jimniels jimniels changed the title feat: zen mode feat: toggle application UI (& show debug menu) Feb 2, 2023
}

export const useGridSettings = (): GridSettingsReturn => {
const [settings, setSettings] = useLocalStorage('gridSettings', defaultGridSettings);
const [showDebugMenu, setShowDebugMenu] = useLocalStorage('showDebugMenu', false);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm unsure what to think about this....

The file is named useGridSettings so it's about settings in the grid.

But I think, more generically, it's really about "View" settings because "Hide application UI", at least in my mind, should control showing/hiding the "Debug menu" (which, I think, is not technically a "grid setting" because it lives at the level of the application).

So that's a long way to say: I think this code works, but maybe is starting to break out of its original abstraction. Not sure if that's something we should consider refactoring now, or just leave it be and roll with it. I tried to follow the conventions in this file.

settings.showCellTypeOutlines ||
showDebugMenu
);
}, [settings]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is derived state, so i'm returning it as a function you have to call to get the boolean representation of state vs. an actual boolean.

}

emitGridSettingsEvent();
}, [setSettings, hideApplicationUI, emitGridSettingsEvent, showDebugMenu, setShowDebugMenu]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wanted each place that consumes this function to not have to worry about passing a value. They can just say "whatever state it's in, toggle it" then they don't have to get the state and figure it out themselves in each place.

It breaks the convention for the other pieces of state in this file, but maybe that's ok because it's not a piece of stored state anyway (it's derived state).

@jimniels jimniels mentioned this pull request Feb 4, 2023
@jimniels jimniels marked this pull request as draft February 6, 2023 18:03
@davidkircos
Copy link
Collaborator

@jimniels I rewrote this to work as Show/Hide UI override, so it saves your other settings and just overrides Show/Hide UI

@davidkircos davidkircos changed the base branch from development to main February 22, 2023 17:50
@jimniels
Copy link
Collaborator Author

@davidkircos this is great. Definitely better to have "show/hide UI" be an override of your current settings vs. a replacement/reset of them. That's a nice addition.

A couple of thoughts on the current state of this.

Keyboard shortcuts

We still have a clash with keyboard shortcuts.

Both "Clear formatting" and "Show/hide UI" are CMD + \.

It looks like you might've changed clear formatting to CMD + / (??) but it's not updated in all places. For example, the formatting toolbar still shows CMD + \

CleanShot 2023-02-22 at 20 51 38@2x

Which is what the command palette says for 'show/hide ui'

CleanShot 2023-02-22 at 20 49 14@2x

This is my two cents:

  • Google Sheets uses CMD + \ for clear formatting.
  • Figma uses CMD + \ for clear formatting as well as CMD + .
  • Sketch uses CMD + . for clear formatting

Figma probably uses CMD + . to appease Sketch users (and idk why they use CMD + \, perhaps a legacy shortcut?) I'm feeling like maybe we should keep the Google Sheets shortcut and use the figma/sketch for show/hide UI. In other words, in Quadratic:

  • CMD + \ - Clear formatting
  • CMD + . - Show/hide UI

Naming is hard

I still don't love the name, "Show/Hide UI". When you represent it as a state, it makes no sense which state you're in. For example look at this:

CleanShot 2023-02-22 at 20 49 38@2x

Which state is that in? Am I showing the UI or hiding it? What am I turning on or off? Showing the UI? Or hiding it? You can't tell from that toggle.

I like calling it "Hide UI" or "Hide interface". This is what Sketch calls it

CleanShot 2023-02-22 at 20 48 13@2x

I like it because it makes it clear when you represent the state, what state you're in:

CleanShot 2023-02-22 at 21 00 33@2x

But also I like that it feels named to match its function, e.g. "Whatever state the UI is in based on my preferences, override that and hide the application interface". The name of the feature goes with the grain of its function. I like that.

CleanShot 2023-02-22 at 21 03 00@2x

(That said, if we do go with "Show/Hide UI" we should keep sentence case consistent, so "Show/hide UI" instead of "Show/Hide UI")

@davidkircos
Copy link
Collaborator

@jimniels
Screenshot 2023-02-24 at 11 06 30 AM

Interestingly, Figma does "Show/Hide UI", and all their other settings are sentence case. I like this 🤷

For shortcuts, Command + / makes sense for Show/Hide UI, and Command + \ makes sense for clear formatting. That remains consistent with Sheets

@davidkircos davidkircos marked this pull request as ready for review February 24, 2023 19:24
@davidkircos
Copy link
Collaborator

@jimniels I updated all language to refer to it as "Presentation Mode" let me know what you think

} = options;

if (!viewport || event.altKey) return false;

if ((event.metaKey || event.ctrlKey) && event.code === 'KeyP') {
if ((event.metaKey || event.ctrlKey) && (event.code === 'KeyP' || event.code === 'KeyK' || event.code === 'Slash')) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Niiiice.

@jimniels jimniels self-assigned this Feb 27, 2023
@jimniels
Copy link
Collaborator Author

Trying an additional enhancement on this, see #326

jimniels and others added 2 commits February 27, 2023 17:23
@davidkircos davidkircos changed the title feat: toggle application UI (& show debug menu) feat: Presentation Mode Feb 28, 2023
davidkircos and others added 2 commits February 27, 2023 17:57
since we hide the header, no need to add this
@jimniels jimniels merged commit 1512ebc into main Feb 28, 2023
@jimniels jimniels deleted the development-zen-mode branch February 28, 2023 04:23
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