Skip to content

Commit 5a0df17

Browse files
some more fixes
1 parent 2bbda2d commit 5a0df17

File tree

4 files changed

+46
-19
lines changed

4 files changed

+46
-19
lines changed

packages/app/src/app/overmind/namespaces/editor/models/EditorSandbox.ts

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,46 @@ import { parseConfigurations } from 'app/overmind/utils/parse-configurations';
2626
import { json } from 'overmind';
2727

2828
export class EditorSandbox {
29-
private currentSandbox: Sandbox = ({
30-
id: null,
31-
title: 'New',
32-
owned: false,
33-
userLiked: false,
29+
private currentSandbox: Sandbox = {
30+
id: '',
31+
alias: null,
32+
title: null,
33+
description: '',
34+
viewCount: 0,
3435
likeCount: 0,
35-
} as unknown) as Sandbox;
36+
forkCount: 0,
37+
userLiked: false,
38+
modules: [],
39+
directories: [],
40+
featureFlags: {},
41+
collection: null,
42+
owned: false,
43+
authorization: 'none',
44+
npmDependencies: {},
45+
customTemplate: null,
46+
forkedTemplate: null,
47+
forkedTemplateSandbox: null,
48+
externalResources: [],
49+
team: null,
50+
roomId: null,
51+
privacy: 0,
52+
author: null,
53+
forkedFromSandbox: null,
54+
git: null,
55+
tags: [],
56+
isFrozen: false,
57+
environmentVariables: null,
58+
sourceId: '',
59+
source: undefined,
60+
template: 'custom',
61+
entry: '',
62+
originalGit: null,
63+
originalGitCommitSha: null,
64+
originalGitChanges: null,
65+
version: 0,
66+
screenshotUrl: null,
67+
previewSecret: null,
68+
};
3669

3770
private currentModuleShortid: string | null = null;
3871
private changedModuleShortids: string[] = [];

packages/app/src/app/overmind/utils/items.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export function getDisabledItems(store: any): INavigationItem[] {
8989
}
9090

9191
export default function getItems(store: any): INavigationItem[] {
92-
if (!store.editor.currentSandbox) {
92+
if (!store.editor.sandbox.id) {
9393
return [];
9494
}
9595
if (
@@ -101,7 +101,7 @@ export default function getItems(store: any): INavigationItem[] {
101101
store.live.roomInfo &&
102102
store.live.roomInfo.ownerIds.indexOf(store.user.id) > -1)
103103
) &&
104-
!hasPermission(store.editor.currentSandbox.authorization, 'write_project')
104+
!store.editor.sandbox.hasPermission('write_project')
105105
) {
106106
return [FILES, LIVE];
107107
}
@@ -119,8 +119,8 @@ export default function getItems(store: any): INavigationItem[] {
119119
CONFIGURATION,
120120
];
121121

122-
if (store.isLoggedIn && sandbox) {
123-
const templateDef = getTemplate(sandbox.template);
122+
if (store.isLoggedIn) {
123+
const templateDef = sandbox.templateDefinition;
124124
if (templateDef.isServer) {
125125
items.push(SERVER);
126126
}
@@ -138,11 +138,7 @@ export default function getItems(store: any): INavigationItem[] {
138138
items.push(DEPLOYMENT);
139139
}
140140

141-
if (
142-
store.isLoggedIn &&
143-
sandbox &&
144-
hasPermission(sandbox.authorization, 'write_code')
145-
) {
141+
if (store.isLoggedIn && sandbox.hasPermission('write_code')) {
146142
items.push(LIVE);
147143
}
148144

packages/app/src/app/pages/Sandbox/Editor/Content/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export const MainWorkspace: React.FC<{ theme: any }> = ({ theme }) => {
6363
const template = sandbox && getTemplateDefinition(sandbox.template);
6464
const views = state.editor.devToolTabs;
6565
const currentPosition = state.editor.currentDevToolsPosition;
66-
const modulePath = sandbox.currentModule.path;
67-
const config = template.configurationFiles[modulePath];
66+
const modulePath = sandbox.currentModule?.path;
67+
const config = modulePath ? template.configurationFiles[modulePath] : null;
6868

6969
const browserConfig = {
7070
id: 'codesandbox.browser',

packages/app/src/app/pages/Sandbox/Editor/Header/Collaborators/CollaboratorList.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import React from 'react';
1010

1111
import { Collaborator, CollaboratorItem, Invitation } from './Collaborator';
1212

13-
y;
14-
1513
const Animated = ({ showMountAnimations, ...props }) => (
1614
<motion.div
1715
animate={{ opacity: 1, height: 'auto' }}

0 commit comments

Comments
 (0)