UNPKG

labo-components

Version:
54 lines (44 loc) 2.41 kB
import React from 'react'; /* Context for the new resource viewer. Please consult which properties are always available and which functions can be called by all child components at all times. Note: the ResourceViewer is the provider of this context and uses it's state to keep the context updated Note: components that also (can) exist outside this context should still receive certain properties via the props */ export const ResourceViewerContext = React.createContext({ singleResource: null, // just show a single resource instead of a result set resourceEvents: null, //used to communicate changes in resource props (such as async loaded entities) mediaEvents: null, // Used for communication between media player and components recipe: null, // TODO remove later, now still used by the AVPlayer user: null, // who is viewing the resource userProjects: null, // a list of user projects query: null, // the user's query before arriving at this resource collectionConfig: null, // mapping functions for the resource (unique instance per collection) resource: null, // main object to be displayed in the resource viewer; instance of SearchResult activeTypes: null, // active Annotation types setActiveAnnotationTypes: annotationTypes =>{ console.debug('implement this context function in the ResourceViewer'); }, activeProject: null, // which project is active setActiveProject: project => { console.debug('implement this context function in the ResourceViewer'); }, activeMediaObject: null, // which media object is active setActiveMediaObject: (mediaObject, segment) => { console.debug('implement this context function in the ResourceViewer'); }, getActiveTranscripts : () => { console.debug('implement this context function in the ResourceViewer'); }, getActiveTranscript : () => { console.debug('implement this context function in the ResourceViewer'); }, getFirstHitInTranscript : () => { console.debug('implement this context function in the ResourceViewer'); }, annotationClient: null, //any component can call the annotation client for doing annotation stuff playerAPI: null, //playerAPI can be used everywhere! setPlayerAPI: playerAPI => { console.debug('implement this context function in the ResourceViewer'); } });