diff --git a/client/components/prompt/Confirm.vue b/client/components/prompt/Confirm.vue
new file mode 100644
index 00000000..e0e4e69b
--- /dev/null
+++ b/client/components/prompt/Confirm.vue
@@ -0,0 +1,106 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/client/layouts/default.vue b/client/layouts/default.vue
index bf398e3c..29414485 100644
--- a/client/layouts/default.vue
+++ b/client/layouts/default.vue
@@ -15,6 +15,7 @@
+
diff --git a/client/pages/config/sessions.vue b/client/pages/config/sessions.vue
index 628d58bc..8eb3c598 100644
--- a/client/pages/config/sessions.vue
+++ b/client/pages/config/sessions.vue
@@ -39,7 +39,7 @@
{{ $elapsedPretty(session.timeListening) }}
|
-
+ |
{{ $secondsToTimestamp(session.currentTime) }}
|
@@ -57,7 +57,7 @@
No sessions yet...
-
+
@@ -89,7 +89,8 @@ export default {
total: 0,
currentPage: 0,
userFilter: null,
- selectedUser: ''
+ selectedUser: '',
+ processingGoToTimestamp: false
}
},
computed: {
@@ -110,6 +111,41 @@ export default {
}
},
methods: {
+ async clickCurrentTime(session) {
+ if (this.processingGoToTimestamp) return
+ this.processingGoToTimestamp = true
+ const libraryItem = await this.$axios.$get(`/api/items/${session.libraryItemId}`).catch((error) => {
+ console.error('Failed to get library item', error)
+ return null
+ })
+
+ if (!libraryItem) {
+ this.$toast.error('Failed to get library item')
+ this.processingGoToTimestamp = false
+ return
+ }
+ if (session.episodeId && !libraryItem.media.episodes.find((ep) => ep.id === session.episodeId)) {
+ this.$toast.error('Failed to get podcast episode')
+ this.processingGoToTimestamp = false
+ return
+ }
+
+ const payload = {
+ message: `Start playback for "${session.displayTitle}" at ${this.$secondsToTimestamp(session.currentTime)}?`,
+ callback: (confirmed) => {
+ if (confirmed) {
+ this.$eventBus.$emit('play-item', {
+ libraryItemId: libraryItem.id,
+ episodeId: session.episodeId || null,
+ startTime: session.currentTime
+ })
+ }
+ this.processingGoToTimestamp = false
+ },
+ type: 'yesNo'
+ }
+ this.$store.commit('globals/setConfirmPrompt', payload)
+ },
updateUserFilter() {
this.loadSessions(0)
},
diff --git a/client/store/globals.js b/client/store/globals.js
index f1bb51f4..8a5edc36 100644
--- a/client/store/globals.js
+++ b/client/store/globals.js
@@ -6,6 +6,8 @@ export const state = () => ({
showEditCollectionModal: false,
showEditPodcastEpisode: false,
showViewPodcastEpisodeModal: false,
+ showConfirmPrompt: false,
+ confirmPromptOptions: null,
showEditAuthorModal: false,
selectedEpisode: null,
selectedCollection: null,
@@ -69,6 +71,13 @@ export const mutations = {
setShowViewPodcastEpisodeModal(state, val) {
state.showViewPodcastEpisodeModal = val
},
+ setShowConfirmPrompt(state, val) {
+ state.showConfirmPrompt = val
+ },
+ setConfirmPrompt(state, options) {
+ state.confirmPromptOptions = options
+ state.showConfirmPrompt = true
+ },
setEditCollection(state, collection) {
state.selectedCollection = collection
state.showEditCollectionModal = true
|