Skip to content

Commit 2035084

Browse files
authored
Merge pull request #11459 from nextcloud/fix/ui/settings-checkboxes-icon-loading-size
fix(ui): replace wrongly sized and jumping checkbox loading icon
2 parents 15ec932 + 668f7b6 commit 2035084

File tree

1 file changed

+66
-84
lines changed

1 file changed

+66
-84
lines changed

src/components/AppSettingsMenu.vue

Lines changed: 66 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -112,44 +112,33 @@
112112
</div>
113113

114114
<h4>{{ t('mail', 'Search in body') }}</h4>
115-
<p v-if="loadingPrioritySettings" class="app-settings">
116-
{{ prioritySettingsText }}
117-
</p>
118-
<p v-else class="app-settings">
119-
<input id="priority-inbox-toggle"
120-
class="checkbox"
121-
type="checkbox"
115+
<p class="app-settings">
116+
<NcCheckboxRadioSwitch id="priority-inbox-toggle"
122117
:checked="searchPriorityBody"
123-
@change="onToggleSearchPriorityBody">
124-
<label for="priority-inbox-toggle">{{ prioritySettingsText }}</label>
118+
:loading="loadingPrioritySettings"
119+
@update:checked="onToggleSearchPriorityBody">
120+
{{ prioritySettingsText }}
121+
</NcCheckboxRadioSwitch>
125122
</p>
126123

127124
<h4>{{ t('mail', 'Reply text position') }}</h4>
128-
<p v-if="loadingReplySettings" class="app-settings reply-settings">
129-
<IconLoading :size="16" />
130-
{{ replySettingsText }}
131-
</p>
132-
<p v-else class="app-settings">
133-
<input id="bottom-reply-enabled"
134-
class="checkbox"
135-
type="checkbox"
125+
<p class="app-settings reply-settings">
126+
<NcCheckboxRadioSwitch id="bottom-reply-enabled"
136127
:checked="useBottomReplies"
137-
@change="onToggleButtonReplies">
138-
<label for="bottom-reply-enabled">{{ replySettingsText }}</label>
128+
:loading="loadingReplySettings"
129+
@update:checked="onToggleButtonReplies">
130+
{{ replySettingsText }}
131+
</NcCheckboxRadioSwitch>
139132
</p>
140133

141134
<h4>{{ t('mail', 'Gravatar settings') }}</h4>
142-
<p v-if="loadingAvatarSettings" class="app-settings avatar-settings">
143-
<IconLoading :size="16" />
144-
{{ t('mail', 'Use Gravatar and favicon avatars') }}
145-
</p>
146-
<p v-else class="app-settings">
147-
<input id="gravatar-enabled"
148-
class="checkbox"
149-
type="checkbox"
135+
<p class="app-settings avatar-settings">
136+
<NcCheckboxRadioSwitch id="gravatar-enabled"
150137
:checked="useExternalAvatars"
151-
@change="onToggleExternalAvatars">
152-
<label for="gravatar-enabled">{{ t('mail', 'Use Gravatar and favicon avatars') }}</label>
138+
:loading="loadingAvatarSettings"
139+
@update:checked="onToggleExternalAvatars">
140+
{{ t('mail', 'Use Gravatar and favicon avatars') }}
141+
</NcCheckboxRadioSwitch>
153142
</p>
154143

155144
<h4>{{ t('mail', 'Mailto') }}</h4>
@@ -185,17 +174,13 @@
185174
<p class="settings-hint">
186175
{{ t('mail', 'Allow the app to collect data about your interactions. Based on this data, the app will adapt to your preferences. The data will only be stored locally.') }}
187176
</p>
188-
<p v-if="loadingOptOutSettings" class="app-settings">
189-
<IconLoading :size="16" />
190-
{{ optOutSettingsText }}
191-
</p>
192-
<p v-else class="app-settings">
193-
<input id="data-collection-toggle"
194-
class="checkbox"
195-
type="checkbox"
177+
<p class="app-settings">
178+
<NcCheckboxRadioSwitch id="data-collection-toggle"
196179
:checked="useDataCollection"
197-
@change="onToggleCollectData">
198-
<label for="data-collection-toggle">{{ optOutSettingsText }}</label>
180+
:loading="loadingOptOutSettings"
181+
@update:checked="onToggleCollectData">
182+
{{ optOutSettingsText }}
183+
</NcCheckboxRadioSwitch>
199184
</p>
200185

201186
<h4>{{ t('mail', 'Trusted senders') }}</h4>
@@ -206,12 +191,12 @@
206191
{{ t('mail', 'Highlight external email addresses by enabling this feature, manage your internal addresses and domains to ensure recognized contacts stay unmarked.') }}
207192
</p>
208193
<p class="app-settings">
209-
<input id="internal-address-toggle"
210-
class="checkbox"
211-
type="checkbox"
194+
<NcCheckboxRadioSwitch id="internal-address-toggle"
212195
:checked="useInternalAddresses"
213-
@change="onToggleInternalAddress">
214-
<label for="internal-address-toggle">{{ internalAddressText }}</label>
196+
:loading="loadingInternalAddresses"
197+
@update:checked="onToggleInternalAddress">
198+
{{ internalAddressText }}
199+
</NcCheckboxRadioSwitch>
215200
</p>
216201
<InternalAddress />
217202

@@ -256,24 +241,21 @@
256241
</NcAppSettingsSection>
257242

258243
<NcAppSettingsSection id="autotagging-settings" :name="t('mail', 'Assistance features')">
259-
<p v-if="toggleAutoTagging" class="app-settings">
260-
<IconLoading :size="16" />
261-
</p>
262-
<p v-else class="app-settings">
263-
<input id="auto-tagging-toggle"
264-
class="checkbox"
265-
type="checkbox"
244+
<p class="app-settings">
245+
<NcCheckboxRadioSwitch id="auto-tagging-toggle"
266246
:checked="useAutoTagging"
267-
@change="onToggleAutoTagging">
268-
<label for="auto-tagging-toggle">{{ autoTaggingText }}</label>
247+
:loading="toggleAutoTagging"
248+
@update:checked="onToggleAutoTagging">
249+
{{ autoTaggingText }}
250+
</NcCheckboxRadioSwitch>
269251
</p>
270252
<p v-if="followUpFeatureAvailable" class="app-settings">
271-
<input id="follow-up-reminder-toggle"
272-
class="checkbox"
273-
type="checkbox"
253+
<NcCheckboxRadioSwitch id="follow-up-reminder-toggle"
274254
:checked="useFollowUpReminders"
275-
@change="onToggleFollowUpReminders">
276-
<label for="follow-up-reminder-toggle">{{ followUpReminderText }}</label>
255+
:loading="loadingFollowUpReminders"
256+
@update:checked="onToggleFollowUpReminders">
257+
{{ followUpReminderText }}
258+
</NcCheckboxRadioSwitch>
277259
</p>
278260
</NcAppSettingsSection>
279261
<NcAppSettingsSection id="about-settings" :name="t('mail', 'About')">
@@ -365,7 +347,7 @@ import { generateUrl } from '@nextcloud/router'
365347
import { showError } from '@nextcloud/dialogs'
366348
import CompactMode from 'vue-material-design-icons/ReorderHorizontal.vue'
367349
368-
import { NcAppSettingsSection, NcAppSettingsDialog, NcButton, NcLoadingIcon as IconLoading, NcCheckboxRadioSwitch, NcDialog, NcInputField } from '@nextcloud/vue'
350+
import { NcAppSettingsSection, NcAppSettingsDialog, NcButton, NcCheckboxRadioSwitch, NcDialog, NcInputField } from '@nextcloud/vue'
369351
import TextEditor from './TextEditor.vue'
370352
import IconAdd from 'vue-material-design-icons/Plus.vue'
371353
import IconEmail from 'vue-material-design-icons/EmailOutline.vue'
@@ -392,7 +374,6 @@ export default {
392374
NcButton,
393375
IconEmail,
394376
IconAdd,
395-
IconLoading,
396377
IconLock,
397378
IconClose,
398379
IconCheck,
@@ -423,6 +404,7 @@ export default {
423404
// eslint-disable-next-line
424405
optOutSettingsText: t('mail', 'Activate'),
425406
loadingOptOutSettings: false,
407+
loadingInternalAddresses: false,
426408
// eslint-disable-next-line
427409
replySettingsText: t('mail', 'Put my text to the bottom of a reply instead of on top of it.'),
428410
loadingReplySettings: false,
@@ -432,6 +414,7 @@ export default {
432414
followUpReminderText: t('mail', 'Remind about messages that require a reply but received none'),
433415
internalAddressText: t('mail', 'Use internal addresses'),
434416
toggleAutoTagging: false,
417+
loadingFollowUpReminders: false,
435418
displaySmimeCertificateModal: false,
436419
sortOrder: 'newest',
437420
showSettings: false,
@@ -539,49 +522,50 @@ export default {
539522
async onOpen() {
540523
this.showSettings = true
541524
},
542-
onToggleButtonReplies(e) {
525+
onToggleButtonReplies(atBottom) {
543526
this.loadingReplySettings = true
544527
545528
this.mainStore.savePreference({
546529
key: 'reply-mode',
547-
value: e.target.checked ? 'bottom' : 'top',
530+
value: atBottom ? 'bottom' : 'top',
548531
})
549532
.catch((error) => Logger.error('could not save preferences', { error }))
550533
.then(() => {
551534
this.loadingReplySettings = false
552535
})
553536
},
554-
onToggleExternalAvatars(e) {
537+
onToggleExternalAvatars(enabled) {
555538
this.loadingAvatarSettings = true
556539
557540
this.mainStore.savePreference({
558541
key: 'external-avatars',
559-
value: e.target.checked ? 'true' : 'false',
542+
value: enabled ? 'true' : 'false',
560543
})
561544
.catch((error) => Logger.error('could not save preferences', { error }))
562545
.then(() => {
563546
this.loadingAvatarSettings = false
564547
})
565548
},
566-
async onToggleSearchPriorityBody(e) {
549+
async onToggleSearchPriorityBody(enabled) {
567550
this.loadingPrioritySettings = true
551+
568552
try {
569553
await this.mainStore.savePreference({
570554
key: 'search-priority-body',
571-
value: e.target.checked ? 'true' : 'false',
555+
value: enabled ? 'true' : 'false',
572556
})
573557
} catch (error) {
574558
Logger.error('could not save preferences', { error })
575559
} finally {
576560
this.loadingPrioritySettings = false
577561
}
578562
},
579-
onToggleCollectData(e) {
563+
onToggleCollectData(collect) {
580564
this.loadingOptOutSettings = true
581565
582566
this.mainStore.savePreference({
583567
key: 'collect-data',
584-
value: e.target.checked ? 'true' : 'false',
568+
value: collect ? 'true' : 'false',
585569
})
586570
.catch((error) => Logger.error('could not save preferences', { error }))
587571
.then(() => {
@@ -603,13 +587,13 @@ export default {
603587
showError(t('mail', 'Could not update preference'))
604588
}
605589
},
606-
async onToggleAutoTagging(e) {
590+
async onToggleAutoTagging(enabled) {
607591
this.toggleAutoTagging = true
608592
609593
try {
610594
await this.mainStore.savePreference({
611595
key: 'tag-classified-messages',
612-
value: e.target.checked ? 'true' : 'false',
596+
value: enabled ? 'true' : 'false',
613597
})
614598
} catch (error) {
615599
Logger.error('could not save preferences', { error })
@@ -619,26 +603,34 @@ export default {
619603
this.toggleAutoTagging = false
620604
}
621605
},
622-
async onToggleFollowUpReminders(e) {
606+
async onToggleFollowUpReminders(enabled) {
607+
this.loadingFollowUpReminders = true
608+
623609
try {
624610
await this.mainStore.savePreference({
625611
key: 'follow-up-reminders',
626-
value: e.target.checked ? 'true' : 'false',
612+
value: enabled ? 'true' : 'false',
627613
})
628614
} catch (error) {
629615
Logger.error('Could not save preferences', { error })
630616
showError(t('mail', 'Could not update preference'))
617+
} finally {
618+
this.loadingFollowUpReminders = false
631619
}
632620
},
633-
async onToggleInternalAddress(e) {
621+
async onToggleInternalAddress(enabled) {
622+
this.loadingInternalAddresses = true
623+
634624
try {
635625
await this.mainStore.savePreference({
636626
key: 'internal-addresses',
637-
value: e.target.checked ? 'true' : 'false',
627+
value: enabled ? 'true' : 'false',
638628
})
639629
} catch (error) {
640630
Logger.error('Could not save preferences', { error })
641631
showError(t('mail', 'Could not update preference'))
632+
} finally {
633+
this.loadingInternalAddresses = false
642634
}
643635
},
644636
registerProtocolHandler() {
@@ -681,12 +673,6 @@ export default {
681673
</script>
682674

683675
<style lang="scss" scoped>
684-
p.app-settings span.loading-icon {
685-
display: inline-block;
686-
vertical-align: middle;
687-
padding: var(--default-grid-baseline) 0;
688-
}
689-
690676
p.app-settings {
691677
padding: calc(var(--default-grid-baseline) * 2) 0;
692678
}
@@ -771,10 +757,6 @@ p.app-settings {
771757
.app-settings-section {
772758
list-style: none;
773759
}
774-
// align it with the checkbox
775-
.internal_address {
776-
margin-inline-start: 3px;
777-
}
778760
779761
.text-block-buttons {
780762
width: 100%;

0 commit comments

Comments
 (0)