Skip to content

Disable "Open new terminal" if there's no active workspace#25892

Merged
ravicious merged 6 commits intomasterfrom
ravicious/new-terminal-no-workspace
May 16, 2023
Merged

Disable "Open new terminal" if there's no active workspace#25892
ravicious merged 6 commits intomasterfrom
ravicious/new-terminal-no-workspace

Conversation

@ravicious
Copy link
Copy Markdown
Member

After logging out from all clusters or before adding the first one, it was possible to open the additional actions menu and select "Open new terminal". Although it didn't do anything, it's better if we just disable that action in that situation.

To represent a disabled item, I used colors.buttons.bgDisabled and colors.buttons.textDisabled. Although it kinda makes the disabled action look sort of like the hovered one, I think it adheres to the theme so it should work fine with custom themes.

The second item here is disabled, the third one has hover:

disabled vs hover

Copy link
Copy Markdown
Member Author

@ravicious ravicious May 9, 2023

Choose a reason for hiding this comment

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

I replaced levels.surface as the background of the keyboard shortcut with spotBackground[0].

Initially I wanted to use buttons.bgDisabled since it also uses an alpha channel. But once people start implementing custom themes, they might use a solid color there instead. spotBackground feels more likely to continue to use the alpha channel.

Before After
before after

@ravicious ravicious force-pushed the ravicious/new-terminal-no-workspace branch from dc8e93b to b3b6cb7 Compare May 9, 2023 14:00
@ravicious ravicious marked this pull request as ready for review May 9, 2023 14:01
@github-actions github-actions Bot requested review from kimlisa and ryanclark May 9, 2023 14:01
@ravicious ravicious requested review from avatus and gzdunek and removed request for kimlisa and ryanclark May 9, 2023 14:02
Comment on lines +39 to +42
} & (MenuItemAlwaysEnabled | MenuItemConditionallyDisabled);

type MenuItemAlwaysEnabled = { isDisabled?: false };
type MenuItemConditionallyDisabled = { isDisabled: true; disabledText: string };
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm trying out something new here. I defined these two explicitly as separate types so that the error message is nicer.

What I wanted to achieve is to force any item that has isDisabled set to true to also specify disabledText.

@ryanclark
Copy link
Copy Markdown
Member

Thoughts on making the icon dimmer on the disabled state?

@gzdunek
Copy link
Copy Markdown
Contributor

gzdunek commented May 9, 2023

Thoughts on dimming only the text and the icon (without changing the background)? Similarly to Tags... here:
image

I'm quite overwhelmed by the amount of shadows on the first image 😬

@ravicious
Copy link
Copy Markdown
Member Author

More like no thoughts, head empty on my part. idk what I was thinking, I was super fixated on using the new colorscheme so for some reason I thought I just had to use another background color. 😅

Dimming the icon + text only should work better, I'll try to update this tomorrow.

@ravicious
Copy link
Copy Markdown
Member Author

This is how it looks after dimming only the text and icon color:

updated additional actions

I also made it so that the cursor on disabled is just default rather than not-allowed. Browsers don't add cursor: not-allowed to disabled items by default. And the default not-allowed cursor on macOS actually obscures the title with the reason as to why the given action is disabled.

@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from gzdunek May 11, 2023 15:33
Copy link
Copy Markdown
Contributor

@gzdunek gzdunek left a comment

Choose a reason for hiding this comment

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

Much better now!


&:disabled {
cursor: default;
color: ${props => props.theme.colors.buttons.textDisabled};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WDYT about using props.theme.colors.text.disabled here? Opacity of buttons.textDisabled is 0.3 while for text.disabled it is 0.36 (which should be our default 'disabled' opacity looking at Figma). DevTools shows quite low contrast ratio for that text, it would be nice if we could increase it at least a little.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point, it also makes more sense semantic-wise.

Before After
before after

@ravicious ravicious enabled auto-merge May 16, 2023 11:20
@ravicious ravicious added this pull request to the merge queue May 16, 2023
Merged via the queue into master with commit 79ded4d May 16, 2023
@ravicious ravicious deleted the ravicious/new-terminal-no-workspace branch May 16, 2023 11:40
@public-teleport-github-review-bot
Copy link
Copy Markdown

@ravicious See the table below for backport results.

Branch Result
branch/v13 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants