Disabling mutually exclusive settings (#1822)

* Adds :disabled styling/functionality for ft-button & ft-select

* Disable proxy, external player, & SponsorBlock settings when applicable

* Changes Invidious General Settings, Proxy Settings, and SponsorBlock settings to disappear when appropriate

* Update ft-toggle-switch.sass

* Switches to styling with disabled class for ft-toggle-switch

* Sets cursor to not-allowed for disabled controls
This commit is contained in:
Jason 2021-10-20 13:14:49 +00:00 committed by GitHub
parent ed37371f01
commit 41fedf8b2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 169 additions and 115 deletions

View File

@ -21,6 +21,7 @@
<ft-toggle-switch <ft-toggle-switch
:label="$t('Settings.External Player Settings.Ignore Unsupported Action Warnings')" :label="$t('Settings.External Player Settings.Ignore Unsupported Action Warnings')"
:default-value="externalPlayerIgnoreWarnings" :default-value="externalPlayerIgnoreWarnings"
:disabled="externalPlayer===''"
:compact="true" :compact="true"
:tooltip="$t('Tooltips.External Player Settings.Ignore Warnings')" :tooltip="$t('Tooltips.External Player Settings.Ignore Warnings')"
@change="updateExternalPlayerIgnoreWarnings" @change="updateExternalPlayerIgnoreWarnings"

View File

@ -19,6 +19,11 @@
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
} }
.btn:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.ripple { .ripple {
position: relative; position: relative;
overflow: hidden; overflow: hidden;

View File

@ -2,6 +2,11 @@
position: relative; position: relative;
} }
.disabled label, .disabled .ft-input{
opacity: 0.4;
cursor: not-allowed;
}
.clearInputTextButton { .clearInputTextButton {
position: absolute; position: absolute;
/* horizontal intentionally reduced to keep "I-beam pointer" visible */ /* horizontal intentionally reduced to keep "I-beam pointer" visible */

View File

@ -5,7 +5,8 @@
search: isSearch, search: isSearch,
forceTextColor: forceTextColor, forceTextColor: forceTextColor,
showActionButton: showActionButton, showActionButton: showActionButton,
showClearTextButton: showClearTextButton showClearTextButton: showClearTextButton,
disabled: disabled
}" }"
> >
<label <label

View File

@ -28,6 +28,11 @@
margin-top: 30px; margin-top: 30px;
} }
.disabled, .disabled + svg.iconSelect {
opacity: 0.4;
cursor: not-allowed;
}
.select-text { .select-text {
position: relative; position: relative;
font-family: inherit; font-family: inherit;

View File

@ -26,6 +26,10 @@ export default Vue.extend({
tooltip: { tooltip: {
type: String, type: String,
default: '' default: ''
},
disabled: {
type: Boolean,
default: false
} }
} }
}) })

View File

@ -2,7 +2,9 @@
<div class="select"> <div class="select">
<select <select
class="select-text" class="select-text"
:class="{disabled: disabled}"
:value="value" :value="value"
:disabled="disabled"
@change="$emit('change', $event.target.value)" @change="$emit('change', $event.target.value)"
> >
<option <option
@ -19,7 +21,10 @@
/> />
<span class="select-highlight" /> <span class="select-highlight" />
<span class="select-bar" /> <span class="select-bar" />
<label class="select-label"> <label
class="select-label"
:hidden="disabled"
>
{{ placeholder }} {{ placeholder }}
</label> </label>
<ft-tooltip <ft-tooltip

View File

@ -7,6 +7,13 @@
&.compact &.compact
margin: 0 margin: 0
.disabled
.switch-label
cursor: not-allowed
.switch-label-text
opacity: 0.4
.switch-input .switch-input
-moz-appearance: none -moz-appearance: none
-webkit-appearance: none -webkit-appearance: none
@ -69,3 +76,4 @@
.switch-input:disabled + & .switch-input:disabled + &
background-color: #BDBDBD background-color: #BDBDBD

View File

@ -1,7 +1,10 @@
<template> <template>
<div <div
class="switch-ctn" class="switch-ctn"
:class="{compact}" :class="{
compact,
disabled: disabled
}"
> >
<input <input
:id="id" :id="id"
@ -17,7 +20,9 @@
:for="id" :for="id"
class="switch-label" class="switch-label"
> >
<span class="switch-label-text">
{{ label }} {{ label }}
</span>
<ft-tooltip <ft-tooltip
v-if="tooltip !== ''" v-if="tooltip !== ''"
class="selectTooltip" class="selectTooltip"

View File

@ -93,6 +93,9 @@
@change="updateExternalLinkHandling" @change="updateExternalLinkHandling"
/> />
</div> </div>
<div
v-if="backendPreference === 'invidious' || backendFallback"
>
<ft-flex-box class="generalSettingsFlexBox"> <ft-flex-box class="generalSettingsFlexBox">
<ft-input <ft-input
:placeholder="$t('Settings.General Settings.Current Invidious Instance')" :placeholder="$t('Settings.General Settings.Current Invidious Instance')"
@ -137,6 +140,7 @@
@click="handleClearDefaultInstanceClick" @click="handleClearDefaultInstanceClick"
/> />
</ft-flex-box> </ft-flex-box>
</div>
</details> </details>
</template> </template>

View File

@ -13,6 +13,9 @@
@change="handleUpdateProxy" @change="handleUpdateProxy"
/> />
</ft-flex-box> </ft-flex-box>
<div
v-if="useProxy"
>
<ft-flex-box> <ft-flex-box>
<ft-select <ft-select
:placeholder="$t('Settings.Proxy Settings.Proxy Protocol')" :placeholder="$t('Settings.Proxy Settings.Proxy Protocol')"
@ -38,7 +41,10 @@
@input="handleUpdateProxyPort" @input="handleUpdateProxyPort"
/> />
</ft-flex-box> </ft-flex-box>
<p class="center"> <p
class="center"
:style="{opacity: useProxy ? 1 : 0.4}"
>
{{ $t('Settings.Proxy Settings.Clicking on Test Proxy will send a request to') }} https://freegeoip.app/json/ {{ $t('Settings.Proxy Settings.Clicking on Test Proxy will send a request to') }} https://freegeoip.app/json/
</p> </p>
<ft-flex-box> <ft-flex-box>
@ -70,6 +76,7 @@
{{ $t('Settings.Proxy Settings.City') }}: {{ proxyCity }} {{ $t('Settings.Proxy Settings.City') }}: {{ proxyCity }}
</p> </p>
</div> </div>
</div>
</details> </details>
</template> </template>

View File

@ -13,6 +13,9 @@
@change="handleUpdateSponsorBlock" @change="handleUpdateSponsorBlock"
/> />
</ft-flex-box> </ft-flex-box>
<div
v-if="useSponsorBlock"
>
<ft-flex-box class="sponsorBlockSettingsFlexBox"> <ft-flex-box class="sponsorBlockSettingsFlexBox">
<ft-toggle-switch <ft-toggle-switch
:label="$t('Settings.SponsorBlock Settings.Notify when sponsor segment is skipped')" :label="$t('Settings.SponsorBlock Settings.Notify when sponsor segment is skipped')"
@ -29,6 +32,7 @@
@input="handleUpdateSponsorBlockUrl" @input="handleUpdateSponsorBlockUrl"
/> />
</ft-flex-box> </ft-flex-box>
</div>
</details> </details>
</template> </template>