Skip to content

Commit 0d26ff3

Browse files
committed
Merge branch 'master' of github.com:codesandbox/codesandbox-client
2 parents 26637f9 + 788ffdc commit 0d26ff3

File tree

4 files changed

+64
-68
lines changed

4 files changed

+64
-68
lines changed

packages/app/src/app/overmind/namespaces/live/actions.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ export const roomJoined: AsyncAction<{
3939
state.live.isLoading = false;
4040
});
4141

42-
export const createLiveClicked: AsyncAction<{
43-
sandboxId: string;
44-
}> = async ({ state, effects, actions }, { sandboxId }) => {
42+
export const createLiveClicked: AsyncAction<string> = async (
43+
{ actions, effects, state },
44+
sandboxId
45+
) => {
4546
effects.analytics.track('Create Live Session');
4647

4748
const roomId = await effects.api.createLiveRoom(sandboxId);
@@ -186,9 +187,9 @@ export const onSendChat: Action<{ message: string }> = (
186187
effects.live.sendChat(message);
187188
};
188189

189-
export const onChatEnabledChange: Action<{ enabled: boolean }> = (
190+
export const onChatEnabledChange: Action<boolean> = (
190191
{ effects, state },
191-
{ enabled }
192+
enabled
192193
) => {
193194
effects.analytics.track('Enable Live Chat');
194195

packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Live/index.tsx

Lines changed: 53 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
1-
import { useOvermind } from 'app/overmind';
21
import React, { FunctionComponent } from 'react';
32

3+
import { useOvermind } from 'app/overmind';
4+
45
import {
56
Description,
67
ErrorDescription,
78
WorkspaceInputContainer,
89
WorkspaceSubtitle,
910
} from '../../elements';
11+
1012
import { More } from '../More';
13+
1114
import LiveButton from './LiveButton';
1215
import LiveInfo from './LiveInfo';
1316

1417
export const Live: FunctionComponent = () => {
1518
const {
19+
actions: {
20+
live: {
21+
createLiveClicked,
22+
onAddEditorClicked,
23+
onChatEnabledChange,
24+
onFollow,
25+
onModeChanged,
26+
onRemoveEditorClicked,
27+
onSessionCloseClicked,
28+
onToggleNotificationsHidden,
29+
},
30+
},
1631
state: {
17-
isLoggedIn,
32+
editor: {
33+
currentSandbox: { id, owned },
34+
isAllModulesSynced,
35+
},
1836
live: {
37+
followingUserId,
1938
isLive,
39+
isLoading,
2040
isOwner,
2141
isTeam,
22-
roomInfo,
2342
liveUserId,
24-
reconnecting,
2543
notificationsHidden,
26-
followingUserId,
27-
isLoading,
28-
},
29-
editor: {
30-
isAllModulesSynced,
31-
currentSandbox: { owned, id },
32-
},
33-
},
34-
actions: {
35-
live: {
36-
onModeChanged,
37-
onAddEditorClicked,
38-
onRemoveEditorClicked,
39-
onSessionCloseClicked,
40-
onToggleNotificationsHidden,
41-
onChatEnabledChange,
42-
onFollow,
43-
createLiveClicked,
44+
reconnecting,
45+
roomInfo,
4446
},
47+
isLoggedIn,
4548
},
4649
} = useOvermind();
47-
const hasUnsyncedModules = !isAllModulesSynced;
48-
4950
const showPlaceHolder = (!isLive && !owned) || !isLoggedIn;
5051

5152
if (showPlaceHolder) {
@@ -66,26 +67,22 @@ export const Live: FunctionComponent = () => {
6667
<div>
6768
{isLive ? (
6869
<LiveInfo
69-
setMode={onModeChanged}
7070
addEditor={onAddEditorClicked}
71-
removeEditor={onRemoveEditorClicked}
71+
chatEnabled={roomInfo.chatEnabled}
72+
currentUserId={liveUserId}
73+
followingUserId={followingUserId}
7274
isOwner={isOwner}
7375
isTeam={isTeam}
74-
roomInfo={roomInfo}
76+
notificationsHidden={notificationsHidden}
77+
onSessionCloseClicked={onSessionCloseClicked}
7578
ownerIds={roomInfo.ownerIds}
76-
currentUserId={liveUserId}
7779
reconnecting={reconnecting}
78-
onSessionCloseClicked={onSessionCloseClicked}
79-
notificationsHidden={notificationsHidden}
80-
toggleNotificationsHidden={onToggleNotificationsHidden}
81-
chatEnabled={roomInfo.chatEnabled}
82-
toggleChatEnabled={() => {
83-
onChatEnabledChange({
84-
enabled: !roomInfo.chatEnabled,
85-
});
86-
}}
80+
removeEditor={onRemoveEditorClicked}
81+
roomInfo={roomInfo}
8782
setFollowing={onFollow}
88-
followingUserId={followingUserId}
83+
setMode={onModeChanged}
84+
toggleChatEnabled={() => onChatEnabledChange(!roomInfo.chatEnabled)}
85+
toggleNotificationsHidden={onToggleNotificationsHidden}
8986
/>
9087
) : (
9188
<>
@@ -95,29 +92,25 @@ export const Live: FunctionComponent = () => {
9592
re doing it live!
9693
</Description>
9794

98-
<>
99-
<WorkspaceSubtitle>Create live room</WorkspaceSubtitle>
100-
<Description>
101-
To invite others you need to generate a URL that others can join.
102-
</Description>
95+
<WorkspaceSubtitle>Create live room</WorkspaceSubtitle>
96+
97+
<Description>
98+
To invite others you need to generate a URL that others can join.
99+
</Description>
100+
101+
{!isAllModulesSynced && (
102+
<ErrorDescription>
103+
Save all your files before going live
104+
</ErrorDescription>
105+
)}
103106

104-
{hasUnsyncedModules && (
105-
<ErrorDescription>
106-
Save all your files before going live
107-
</ErrorDescription>
108-
)}
109-
<WorkspaceInputContainer>
110-
<LiveButton
111-
onClick={() => {
112-
createLiveClicked({
113-
sandboxId: id,
114-
});
115-
}}
116-
isLoading={isLoading}
117-
disable={hasUnsyncedModules}
118-
/>
119-
</WorkspaceInputContainer>
120-
</>
107+
<WorkspaceInputContainer>
108+
<LiveButton
109+
disable={!isAllModulesSynced}
110+
isLoading={isLoading}
111+
onClick={() => createLiveClicked(id)}
112+
/>
113+
</WorkspaceInputContainer>
121114
</>
122115
)}
123116
</div>

packages/app/src/app/pages/Sandbox/Editor/Workspace/items/NotOwnedSandboxInfo/NotOwnedSandboxInfo.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ import { WorkspaceItem } from '../../WorkspaceItem';
1010
export const NotOwnedSandboxInfo = () => {
1111
const [editActions, setEditActions] = useState(null);
1212
const {
13-
state: { editor },
13+
state: { editor, hasLogIn },
1414
} = useOvermind();
1515
const staticTemplate = editor.currentSandbox.template === 'static';
1616

1717
return (
1818
<div style={{ marginTop: '1rem' }}>
1919
<Margin bottom={1.5}>
2020
<SandboxInfo sandbox={editor.currentSandbox} />
21-
{editor.currentSandbox.customTemplate && <BookmarkTemplateButton />}
21+
{editor.currentSandbox.customTemplate && hasLogIn && (
22+
<BookmarkTemplateButton />
23+
)}
2224
</Margin>
2325

2426
<WorkspaceItem actions={editActions} defaultOpen title="Files">

packages/homepage/src/screens/home/hero/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export default () => {
158158
{sandboxesCreatedCount}{' '}
159159
</span>
160160
{sandboxesCreatedCount === 1 ? 'sandbox' : 'sandboxes'} created
161-
since you've opened this page
161+
since you opened this page
162162
</CountText>
163163

164164
<div style={{ position: 'relative' }}>

0 commit comments

Comments
 (0)