context.ts 561 B

123456789101112131415161718
  1. import { createContext, Dispatch, SetStateAction } from 'react';
  2. import { nullDispatch } from '../../../context/state';
  3. import { LibraryState, ModeWindow } from './types';
  4. export const initialLibraryState: LibraryState = {
  5. artists: [],
  6. activeArtist: null,
  7. activeAlbum: null,
  8. activeSong: null,
  9. modeWindow: ModeWindow.ArtistList,
  10. visibleSongs: [],
  11. };
  12. export const LibraryStateContext = createContext<LibraryState>(initialLibraryState);
  13. export const LibraryDispatchContext = createContext<Dispatch<SetStateAction<LibraryState>>>(
  14. nullDispatch,
  15. );