feat: Add global toggle

This commit is contained in:
benonymity 2022-07-06 20:05:34 -04:00
parent eecd1c714b
commit 1f2b1abee0
6 changed files with 36 additions and 19 deletions

View file

@ -15,7 +15,7 @@
<div class="w-full h-px bg-primary my-4" />
<div class="flex items-center py-1">
<div v-if="isGlobalSharing" class="flex items-center py-1">
<ui-toggle-switch v-model="isSharingActivity" @input="changeSharingSetting" />
<ui-tooltip text="Share your latest listening activity with other users in the social tab">
<p class="pl-4">
@ -25,7 +25,7 @@
</ui-tooltip>
</div>
<div class="w-full h-px bg-primary my-4" />
<div v-if="isGlobalSharing" class="w-full h-px bg-primary my-4" />
<p v-if="!isGuest" class="mb-4 text-lg">Change Password</p>
<form v-if="!isGuest" @submit.prevent="submitChangePassword">
@ -78,6 +78,9 @@ export default {
},
isSharingActivity() {
return this.$store.getters['user/getUserSetting']('shareListeningActivity')
},
isGlobalSharing() {
return this.$store.getters['getServerSetting']('sharedListeningStats')
}
},
methods: {
@ -128,8 +131,6 @@ export default {
})
},
changeSharingSetting() {
console.log('test')
console.log(String(!this.isSharingActivity))
this.$store.dispatch('user/updateUserSettings', { shareListeningActivity: !this.isSharingActivity })
}
},

View file

@ -48,6 +48,16 @@
<p class="pl-4">Chromecast support</p>
</div>
<div class="flex items-center py-2">
<ui-toggle-switch v-model="newServerSettings.sharedListeningStats" :disabled="updatingServerSettings" @input="(val) => updateSettingsKey('sharedListeningStats', val)" />
<ui-tooltip :text="tooltips.shareStats">
<p class="pl-4">
Shared Listening Stats
<span class="material-icons icon-text text-sm">info_outlined</span>
</p>
</ui-tooltip>
</div>
<div class="pt-4">
<h2 class="font-semibold">Display</h2>
</div>
@ -268,7 +278,8 @@ export default {
storeMetadataWithItem: 'By default metadata files are stored in /metadata/items, enabling this setting will store metadata files in your library item folders. Uses .abs file extension',
coverAspectRatio: 'Prefer to use square covers over standard 1.6:1 book covers',
enableEReader: 'E-reader is still a work in progress, but use this setting to open it up to all your users (or use the "Experimental Features" toggle just for use by you)',
scannerPreferOverdriveMediaMarker: 'MP3 files from Overdrive come with chapter timings embedded as custom metadata. Enabling this will use these tags for chapter timings automatically'
scannerPreferOverdriveMediaMarker: 'MP3 files from Overdrive come with chapter timings embedded as custom metadata. Enabling this will use these tags for chapter timings automatically',
shareStats: 'Allow users to share latest listening activity with other users on an opt-in basis'
},
showConfirmPurgeCache: false
}

View file

@ -24,12 +24,10 @@
</ui-tooltip>
</nuxt-link>
<p class="text-lg px-2 font-book text-white">{{ user.username }}&nbsp;</p>
<div class="">
<p class="text-xs text-white text-opacity-50">{{user.latest.lastUpdate != null ? "Last listened " + $dateDistanceFromNow(user.latest.lastUpdate) : "Never listened" }}</p>
</div>
<p class="text-xs text-white text-opacity-50">{{ "Last listened " + $dateDistanceFromNow(user.latest.lastUpdate) }}</p>
<div class="flex-grow" />
<div class="w-30 text-right">
<p class="text-sm font-bold">{{ user.minutesListened > 0 ? "Has listened for " + $elapsedPrettyExtended(user.minutesListened) : "No listening time" }}</p>
<div class="w-30 pl-4 text-right">
<p class="text-sm font-bold">{{ "Has listened for " + $elapsedPrettyExtended(user.minutesListened) }}</p>
</div>
<widgets-online-indicator class="mx-2" :value="!!usersOnline[user.id]" />
</div>
@ -64,7 +62,7 @@ export default {
},
users() {
if (!this.listeningStats) return []
return this.listeningStats.filter(c => c.latest)
return this.listeningStats.sort(function(a, b) {return b.latest.lastUpdate - a.latest.lastUpdate})
},
userMediaProgress() {
return this.user.mediaProgress || []
@ -109,7 +107,6 @@ export default {
})
}
}
console.log('Loaded users shared listening data', listeningStats)
this.listeningStats = listeningStats
},
async getLibraryItem(user) {
@ -121,8 +118,6 @@ export default {
})
},
changeSharingSetting() {
console.log('test')
console.log(String(!this.isSharingActivity))
this.$store.dispatch('user/updateUserSettings', { shareListeningActivity: !this.isSharingActivity })
this.init()
}