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

Remove mode button when there is only one mode available. #219

Open
robairhome opened this issue Dec 9, 2023 · 2 comments
Open

Remove mode button when there is only one mode available. #219

robairhome opened this issue Dec 9, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@robairhome
Copy link

robairhome commented Dec 9, 2023

When there is only one mode available (i.e disableModes as been used for two modes), the UI will be cleaner if we automatically hide the mode select dropdown. Example below -

image

I see we have this behaviour when only day mode is available:

But I'd propose to modify this code:

onlyDayModeIsEnabled() {
const weekIsDisabled = this.config.disableModes?.includes('week');
const monthIsDisabled = this.config.disableModes?.includes('month');

  return this.config.disableModes && weekIsDisabled && monthIsDisabled;
},

To implement "onlyOneModelIsAvailable" to handle cases where dayIsDisabled and weekIsDisabled but month is not disabled. I.e:

onlyOneModeIsAvailable() {
return this.config.disableModes?.length === 2
},

@tomosterlund tomosterlund added the enhancement New feature or request label Dec 11, 2023
@tomosterlund
Copy link
Owner

This sounds reasonable! Probably I just forgot this back when the month was made small-screen compatible.

Do you want to implement it?

@robairhome
Copy link
Author

Great, thanks, yes I'd like to do it - its very useful for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants