Files
Ivan Fontosh 278eb78637 feat(playlists): библиотека плейлистов приложения
CRUD в редакторе, read-only окно на пульте, отдельный аудиоканал, экспорт/импорт и маппинг из Foundry.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-03 10:37:21 +08:00

20 lines
629 B
TypeScript

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;
}