refactor(frontend): inputs only from the root of Player (as becoming library)

This commit is contained in:
Alex Kaminskii 2022-11-15 16:57:09 +01:00
parent 59f3245bf3
commit 13a0f88b16
23 changed files with 32 additions and 35 deletions

View file

@ -2,7 +2,7 @@ import React, { useState } from 'react'
import stl from './ChatControls.module.css'
import cn from 'classnames'
import { Button, Icon } from 'UI'
import type { LocalStream } from 'Player/MessageDistributor/managers/LocalStream';
import type { LocalStream } from 'Player';
interface Props {

View file

@ -5,7 +5,7 @@ import Counter from 'App/components/shared/SessionItem/Counter';
import stl from './chatWindow.module.css';
import ChatControls from '../ChatControls/ChatControls';
import Draggable from 'react-draggable';
import type { LocalStream } from 'Player/MessageDistributor/managers/LocalStream';
import type { LocalStream } from 'Player';
import { toggleVideoLocalStream } from 'Player'
export interface Props {

View file

@ -3,7 +3,7 @@ import { Button, Tooltip } from 'UI';
import { connect } from 'react-redux';
import cn from 'classnames';
import { toggleChatWindow } from 'Duck/sessions';
import { connectPlayer } from 'Player/store';
import { connectPlayer } from 'Player';
import ChatWindow from '../../ChatWindow';
import {
callPeer,
@ -16,9 +16,9 @@ import {
CallingState,
ConnectionStatus,
RemoteControlStatus,
} from 'Player/MessageDistributor/managers/AssistManager';
import RequestLocalStream from 'Player/MessageDistributor/managers/LocalStream';
import type { LocalStream } from 'Player/MessageDistributor/managers/LocalStream';
RequestLocalStream,
} from 'Player';
import type { LocalStream } from 'Player';
import { toast } from 'react-toastify';
import { confirm } from 'UI';
import stl from './AassistActions.module.css';

View file

@ -8,7 +8,6 @@ import { Link, NoContent, Loader } from 'UI';
import { sessions as sessionsRoute } from 'App/routes';
import withPermissions from 'HOCs/withPermissions'
import WebPlayer from './WebPlayer';
import IOSPlayer from './IOSPlayer';
import { useStore } from 'App/mstore';
const SESSIONS_ROUTE = sessionsRoute();
@ -49,10 +48,7 @@ function Session({
}
>
<Loader className="flex-1" loading={ loading || initializing }>
{ session.isIOS
? <IOSPlayer session={session} />
: <WebPlayer />
}
<WebPlayer />
</Loader>
</NoContent>
);

View file

@ -3,8 +3,7 @@ import { connect } from 'react-redux';
import { setAutoplayValues } from 'Duck/sessions';
import { session as sessionRoute } from 'App/routes';
import { Link, Icon, Toggler, Tooltip } from 'UI';
import { connectPlayer } from 'Player/store';
import { Controls as PlayerControls } from 'Player';
import { Controls as PlayerControls, connectPlayer } from 'Player';
import cn from 'classnames';
function Autoplay(props) {

View file

@ -1,4 +1,4 @@
import { connectPlayer } from 'App/player';
import { connectPlayer } from 'Player';
import { toggleBottomBlock } from 'Duck/components/player';
import React, { useEffect } from 'react';
import BottomBlock from '../BottomBlock';

View file

@ -1,6 +1,6 @@
import React from 'react';
import VerticalLine from '../VerticalLine';
import { connectPlayer, Controls } from 'App/player';
import { connectPlayer, Controls } from 'Player';
interface Props {
children: React.ReactNode;

View file

@ -1,5 +1,5 @@
import React from 'react';
import { connectPlayer } from 'App/player';
import { connectPlayer } from 'Player';
import { AreaChart, Area, Tooltip, ResponsiveContainer } from 'recharts';
interface Props {

View file

@ -1,5 +1,5 @@
import React from 'react';
import { Controls } from 'App/player';
import { Controls } from 'Player';
import { NETWORK, EXCEPTIONS } from 'Duck/components/player';
import { useModal } from 'App/components/Modal';
import { Icon, Tooltip } from 'UI';

View file

@ -1,5 +1,5 @@
import React from 'react';
import { connectPlayer } from 'App/player';
import { connectPlayer } from 'Player';
import { millisToMinutesAndSeconds } from 'App/utils';
interface Props {

View file

@ -1,5 +1,5 @@
import React from 'react';
import { connectPlayer } from 'App/player';
import { connectPlayer } from 'Player';
import VerticalLine from '../VerticalLine';
interface Props {

View file

@ -1,7 +1,7 @@
import React, { useState } from 'react';
import stl from './SelectorCard.module.css';
import cn from 'classnames';
import type { MarkedTarget } from 'Player/MessageDistributor/StatedScreen/StatedScreen';
import type { MarkedTarget } from 'Player';
import { activeTarget } from 'Player';
import { Tooltip } from 'react-tippy';

View file

@ -1,8 +1,8 @@
import React from 'react';
import { NoContent } from 'UI';
import { connectPlayer } from 'Player/store';
import { connectPlayer } from 'Player';
import SelectorCard from '../SelectorCard/SelectorCard';
import type { MarkedTarget } from 'Player/MessageDistributor/StatedScreen/StatedScreen';
import type { MarkedTarget } from 'Player';
import stl from './selectorList.module.css';
interface Props {

View file

@ -6,7 +6,7 @@ import {
STORAGE_TYPES,
selectStorageType,
selectStorageListNow,
} from 'Player/store';
} from 'Player';
import LiveTag from 'Shared/LiveTag';
import { jumpToLive } from 'Player';

View file

@ -1,8 +1,8 @@
import React from 'react';
import { connectPlayer } from 'Player';
import { getStatusText } from 'Player/MessageDistributor/managers/AssistManager';
import type { MarkedTarget } from 'Player/MessageDistributor/StatedScreen/StatedScreen';
import { CallingState, ConnectionStatus, RemoteControlStatus } from 'Player/MessageDistributor/managers/AssistManager';
import { getStatusText } from 'Player';
import type { MarkedTarget } from 'Player';
import { CallingState, ConnectionStatus, RemoteControlStatus } from 'Player';
import AutoplayTimer from './Overlay/AutoplayTimer';
import PlayIconLayer from './Overlay/PlayIconLayer';

View file

@ -1,5 +1,5 @@
import React from 'react';
import type { MarkedTarget } from 'Player/MessageDistributor/StatedScreen/StatedScreen';
import type { MarkedTarget } from 'Player';
import cn from 'classnames';
import stl from './Marker.module.css';
import { activeTarget } from 'Player';

View file

@ -1,6 +1,6 @@
import React from 'react';
import ovStl from './overlay.module.css';
import { ConnectionStatus } from 'Player/MessageDistributor/managers/AssistManager';
import { ConnectionStatus } from 'Player';
import { Loader } from 'UI';
interface Props {

View file

@ -7,7 +7,7 @@ import {
STORAGE_TYPES,
selectStorageListNow,
selectStorageList,
} from 'Player/store';
} from 'Player';
import { JSONTree, NoContent, Tooltip } from 'UI';
import { formatMs } from 'App/date';
import { diff } from 'deep-diff';

View file

@ -7,7 +7,7 @@ import {
STORAGE_TYPES,
selectStorageListNow,
selectStorageList,
} from 'Player/store';
} from 'Player';
import { JSONTree, NoContent } from 'UI';
import { formatMs } from 'App/date';
import { diff } from 'deep-diff';

View file

@ -18,7 +18,7 @@ function dummyTrack(): MediaStreamTrack {
return canvas.captureStream(60).getTracks()[0];
}
export default function RequestLocalStream(): Promise<LocalStream> {
export function RequestLocalStream(): Promise<LocalStream> {
return navigator.mediaDevices.getUserMedia({ audio:true })
.then(aStream => {
const aTrack = aStream.getAudioTracks()[0]

View file

@ -1,2 +1,4 @@
export { PlayerProvider, connectPlayer } from './store';
export * from './singletone';
export * from './store';
export * from './singletone';
export * from './MessageDistributor/managers/AssistManager';
export * from './MessageDistributor/managers/LocalStream';

View file

@ -1,5 +1,5 @@
import Player from './Player';
import { update, clean as cleanStore, getState } from './store';
import { update, cleanStore, getState } from './store';
import { clean as cleanLists } from './lists';
/** @type {Player} */

View file

@ -13,7 +13,7 @@ export function update(...args) {
return store.dispatch(action);
}
export function clean() {
export function cleanStore() {
return store.dispatch(cleanAction());
}