feat: show optimistic history queue entries
This commit is contained in:
4 files changed
+89
-14
No files matched your search
@@ -9,6 +9,7 @@ const status = ref<BotStatus | null>(null)
|
||||
const connected = ref(false)
|
||||
/** Wstrzymuje przyjmowanie aktualizacji, gdy użytkownik przeciąga utwory. */
|
||||
const paused = ref(false)
|
||||
const pendingTracks = ref<{ id: string; guildId: string; title: string }[]>([])
|
||||
|
||||
let socket: WebSocket | null = null
|
||||
let reconnectTimer: number | null = null
|
||||
@@ -88,7 +89,27 @@ export function useBotStatus() {
|
||||
}
|
||||
}
|
||||
|
||||
function addPendingTrack(guildId: string, title: string) {
|
||||
const id = `pending-${Date.now()}-${Math.random().toString(36).slice(2)}`
|
||||
pendingTracks.value.push({ id, guildId, title })
|
||||
return id
|
||||
}
|
||||
|
||||
function removePendingTrack(id: string) {
|
||||
pendingTracks.value = pendingTracks.value.filter((track) => track.id !== id)
|
||||
}
|
||||
|
||||
onUnmounted(disconnect)
|
||||
|
||||
return { status, connected, paused, connect, disconnect, selectGuild }
|
||||
return {
|
||||
status,
|
||||
connected,
|
||||
paused,
|
||||
pendingTracks,
|
||||
connect,
|
||||
disconnect,
|
||||
selectGuild,
|
||||
addPendingTrack,
|
||||
removePendingTrack,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user