feat(playlists): библиотека плейлистов приложения
CRUD в редакторе, read-only окно на пульте, отдельный аудиоканал, экспорт/импорт и маппинг из Foundry. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { ipcChannels } from '../../../shared/ipc/contracts';
|
||||
import type { PlaylistsState } from '../../../shared/types/appPlaylists';
|
||||
import { getDndApi } from '../dndApi';
|
||||
|
||||
const EMPTY: PlaylistsState = { playlists: [], audios: [] };
|
||||
|
||||
export function useAppPlaylists(): PlaylistsState {
|
||||
const api = getDndApi();
|
||||
const [state, setState] = useState<PlaylistsState>(EMPTY);
|
||||
|
||||
useEffect(() => {
|
||||
void api.invoke(ipcChannels.playlists.getState, {}).then(setState);
|
||||
return api.on(ipcChannels.playlists.stateChanged, (next) => setState(next));
|
||||
}, [api]);
|
||||
|
||||
return state;
|
||||
}
|
||||
Reference in New Issue
Block a user