openreplay/frontend/app/components/Session/playerContext.ts
Andrey Babushkin fd5c0c9747
Add lokalisation (#3092)
* applied eslint

* add locales and lint the project

* removed error boundary

* updated locales

* fix min files

* fix locales
2025-03-06 17:43:15 +01:00

38 lines
905 B
TypeScript

import { createContext, Context } from 'react';
import {
IWebPlayer,
IIosPlayer,
IIOSPlayerStore,
IWebPlayerStore,
IWebLivePlayer,
IWebLivePlayerStore,
} from 'Player';
export interface IOSPlayerContext {
player: IIosPlayer;
store: IIOSPlayerStore;
}
export interface IPlayerContext {
player: IWebPlayer;
store: IWebPlayerStore;
}
export interface ILivePlayerContext {
player: IWebLivePlayer;
store: IWebLivePlayerStore;
}
type WebContextType = IPlayerContext | ILivePlayerContext;
type MobileContextType = IOSPlayerContext;
export const defaultContextValue = { player: undefined, store: undefined };
const ContextProvider =
createContext<Partial<WebContextType | MobileContextType>>(
defaultContextValue,
);
export const PlayerContext = ContextProvider as Context<WebContextType>;
export const MobilePlayerContext =
ContextProvider as Context<MobileContextType>;