diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue index 416b0e08b..0aed923c9 100644 --- a/client/pages/item/_id/index.vue +++ b/client/pages/item/_id/index.vue @@ -72,18 +72,6 @@ - -
-

{{ $strings.LabelYourProgress }}: {{ Math.round(progressPercent * 100) }}%

-

{{ $strings.LabelFinished }} {{ $formatDate(userProgressFinishedAt, dateFormat) }}

-

{{ $getString('LabelTimeRemaining', [$elapsedPretty(userTimeRemaining)]) }}

-

{{ $strings.LabelStarted }} {{ $formatDate(userProgressStartedAt, dateFormat) }}

- -
- close -
-
-
@@ -134,6 +122,32 @@
+ +
+ + + + + + + + + + + + + + + + + +
{{ $strings.LabelProgress }}{{ $strings.LabelCurrent }}{{ $strings.LabelRemaining }}{{ $strings.LabelStarted }}{{ $strings.LabelFinished }}
{{ Math.round(progressPercent * 100) }}%{{ $elapsedPretty(userCurrentTime) }}{{ $elapsedPretty(userTimeRemaining) }}{{ $formatDate(userProgressStartedAt, dateFormat) }} {{ $formatDate(userProgressStartedAt, timeFormat) }}{{ $formatDate(userProgressFinishedAt, dateFormat) }} {{ $formatDate(userProgressFinishedAt, timeFormat) }} +
+ close +
+
+
+ @@ -201,6 +215,9 @@ export default { dateFormat() { return this.$store.state.serverSettings.dateFormat }, + timeFormat() { + return this.$store.state.serverSettings.timeFormat + }, userIsAdminOrUp() { return this.$store.getters['user/getIsAdminOrUp'] }, @@ -345,6 +362,9 @@ export default { const duration = this.userMediaProgress.duration || this.duration return duration - this.userMediaProgress.currentTime }, + userCurrentTime() { + return this.userMediaProgress ? this.userMediaProgress.currentTime : 0 + }, useEBookProgress() { if (!this.userMediaProgress || this.userMediaProgress.progress) return false return this.userMediaProgress.ebookProgress > 0 @@ -624,20 +644,27 @@ export default { }, clearProgressClick() { if (!this.userMediaProgress) return - if (confirm(`Are you sure you want to reset your progress?`)) { - this.resettingProgress = true - this.$axios - .$delete(`/api/me/progress/${this.userMediaProgress.id}`) - .then(() => { - console.log('Progress reset complete') - this.$toast.success(`Your progress was reset`) - this.resettingProgress = false - }) - .catch((error) => { - console.error('Progress reset failed', error) - this.resettingProgress = false - }) + const payload = { + message: this.$strings.ResetProgressQuestion, + callback: (confirmed) => { + if (confirmed) { + this.resettingProgress = true + this.$axios + .$delete(`/api/me/progress/${this.userMediaProgress.id}`) + .then(() => { + console.log('Progress reset complete') + this.$toast.success(this.$strings.ResetProgressSuccess) + this.resettingProgress = false + }) + .catch((error) => { + console.error('Progress reset failed', error) + this.resettingProgress = false + }) + } + }, + type: 'yesNo' } + this.$store.commit('globals/setConfirmPrompt', payload) }, clickRSSFeed() { this.$store.commit('globals/setRSSFeedOpenCloseModal', { diff --git a/client/strings/en-us.json b/client/strings/en-us.json index 111f9ef95..036b6ba3e 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -311,6 +311,7 @@ "LabelFilterByUser": "Filter by User", "LabelFindEpisodes": "Find Episodes", "LabelFinished": "Finished", + "LabelRemaining": "Remaining", "LabelFolder": "Folder", "LabelFolders": "Folders", "LabelFontBold": "Bold", @@ -851,5 +852,7 @@ "ToastSortingPrefixesUpdateFailed": "Failed to update sorting prefixes", "ToastSortingPrefixesUpdateSuccess": "Sorting prefixes updated ({0} items)", "ToastUserDeleteFailed": "Failed to delete user", - "ToastUserDeleteSuccess": "User deleted" + "ToastUserDeleteSuccess": "User deleted", + "ResetProgressQuestion": "Are you sure you want to reset your progress?", + "ResetProgressSuccess": "Your progress was reset" }