diff --git a/packages/app/src/app/overmind/namespaces/live/actions.ts b/packages/app/src/app/overmind/namespaces/live/actions.ts index 657a9c170aa..c83410f2913 100755 --- a/packages/app/src/app/overmind/namespaces/live/actions.ts +++ b/packages/app/src/app/overmind/namespaces/live/actions.ts @@ -39,9 +39,10 @@ export const roomJoined: AsyncAction<{ state.live.isLoading = false; }); -export const createLiveClicked: AsyncAction<{ - sandboxId: string; -}> = async ({ state, effects, actions }, { sandboxId }) => { +export const createLiveClicked: AsyncAction = async ( + { actions, effects, state }, + sandboxId +) => { effects.analytics.track('Create Live Session'); const roomId = await effects.api.createLiveRoom(sandboxId); @@ -186,9 +187,9 @@ export const onSendChat: Action<{ message: string }> = ( effects.live.sendChat(message); }; -export const onChatEnabledChange: Action<{ enabled: boolean }> = ( +export const onChatEnabledChange: Action = ( { effects, state }, - { enabled } + enabled ) => { effects.analytics.track('Enable Live Chat'); diff --git a/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Live/index.tsx b/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Live/index.tsx index c6ae652f221..4fffdb98941 100644 --- a/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Live/index.tsx +++ b/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Live/index.tsx @@ -1,51 +1,52 @@ -import { useOvermind } from 'app/overmind'; import React, { FunctionComponent } from 'react'; +import { useOvermind } from 'app/overmind'; + import { Description, ErrorDescription, WorkspaceInputContainer, WorkspaceSubtitle, } from '../../elements'; + import { More } from '../More'; + import LiveButton from './LiveButton'; import LiveInfo from './LiveInfo'; export const Live: FunctionComponent = () => { const { + actions: { + live: { + createLiveClicked, + onAddEditorClicked, + onChatEnabledChange, + onFollow, + onModeChanged, + onRemoveEditorClicked, + onSessionCloseClicked, + onToggleNotificationsHidden, + }, + }, state: { - isLoggedIn, + editor: { + currentSandbox: { id, owned }, + isAllModulesSynced, + }, live: { + followingUserId, isLive, + isLoading, isOwner, isTeam, - roomInfo, liveUserId, - reconnecting, notificationsHidden, - followingUserId, - isLoading, - }, - editor: { - isAllModulesSynced, - currentSandbox: { owned, id }, - }, - }, - actions: { - live: { - onModeChanged, - onAddEditorClicked, - onRemoveEditorClicked, - onSessionCloseClicked, - onToggleNotificationsHidden, - onChatEnabledChange, - onFollow, - createLiveClicked, + reconnecting, + roomInfo, }, + isLoggedIn, }, } = useOvermind(); - const hasUnsyncedModules = !isAllModulesSynced; - const showPlaceHolder = (!isLive && !owned) || !isLoggedIn; if (showPlaceHolder) { @@ -66,26 +67,22 @@ export const Live: FunctionComponent = () => {
{isLive ? ( { - onChatEnabledChange({ - enabled: !roomInfo.chatEnabled, - }); - }} + removeEditor={onRemoveEditorClicked} + roomInfo={roomInfo} setFollowing={onFollow} - followingUserId={followingUserId} + setMode={onModeChanged} + toggleChatEnabled={() => onChatEnabledChange(!roomInfo.chatEnabled)} + toggleNotificationsHidden={onToggleNotificationsHidden} /> ) : ( <> @@ -95,29 +92,25 @@ export const Live: FunctionComponent = () => { re doing it live! - <> - Create live room - - To invite others you need to generate a URL that others can join. - + Create live room + + + To invite others you need to generate a URL that others can join. + + + {!isAllModulesSynced && ( + + Save all your files before going live + + )} - {hasUnsyncedModules && ( - - Save all your files before going live - - )} - - { - createLiveClicked({ - sandboxId: id, - }); - }} - isLoading={isLoading} - disable={hasUnsyncedModules} - /> - - + + createLiveClicked(id)} + /> + )}