()
| 8 | import { useQueueStore } from '../stores/queueStore'; |
| 9 | |
| 10 | export const createQueueHost = (): QueueHost => { |
| 11 | return { |
| 12 | getQueue: async () => { |
| 13 | const state = useQueueStore.getState(); |
| 14 | return { |
| 15 | items: state.items, |
| 16 | currentIndex: state.currentIndex, |
| 17 | }; |
| 18 | }, |
| 19 | |
| 20 | getCurrentItem: async () => { |
| 21 | return useQueueStore.getState().getCurrentItem(); |
| 22 | }, |
| 23 | |
| 24 | addToQueue: async (tracks: Track[]) => { |
| 25 | useQueueStore.getState().addToQueue(tracks); |
| 26 | }, |
| 27 | |
| 28 | addNext: async (tracks: Track[]) => { |
| 29 | useQueueStore.getState().addNext(tracks); |
| 30 | }, |
| 31 | |
| 32 | addAt: async (tracks: Track[], index: number) => { |
| 33 | useQueueStore.getState().addAt(tracks, index); |
| 34 | }, |
| 35 | |
| 36 | removeByIds: async (ids: string[]) => { |
| 37 | useQueueStore.getState().removeByIds(ids); |
| 38 | }, |
| 39 | |
| 40 | removeByIndices: async (indices: number[]) => { |
| 41 | useQueueStore.getState().removeByIndices(indices); |
| 42 | }, |
| 43 | |
| 44 | clearQueue: async () => { |
| 45 | useQueueStore.getState().clearQueue(); |
| 46 | }, |
| 47 | |
| 48 | reorder: async (fromIndex: number, toIndex: number) => { |
| 49 | useQueueStore.getState().reorder(fromIndex, toIndex); |
| 50 | }, |
| 51 | |
| 52 | updateItemState: async (id: string, updates: QueueItemStateUpdate) => { |
| 53 | useQueueStore.getState().updateItemState(id, updates); |
| 54 | }, |
| 55 | |
| 56 | goToNext: async () => { |
| 57 | useQueueStore.getState().goToNext(); |
| 58 | }, |
| 59 | |
| 60 | goToPrevious: async () => { |
| 61 | useQueueStore.getState().goToPrevious(); |
| 62 | }, |
| 63 | |
| 64 | goToIndex: async (index: number) => { |
| 65 | useQueueStore.getState().goToIndex(index); |
| 66 | }, |
| 67 |
no test coverage detected