File tree Expand file tree Collapse file tree 4 files changed +46
-19
lines changed
Expand file tree Collapse file tree 4 files changed +46
-19
lines changed Original file line number Diff line number Diff line change @@ -26,13 +26,46 @@ import { parseConfigurations } from 'app/overmind/utils/parse-configurations';
2626import { json } from 'overmind' ;
2727
2828export 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 [ ] = [ ] ;
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ export function getDisabledItems(store: any): INavigationItem[] {
8989}
9090
9191export 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
Original file line number Diff line number Diff 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' ,
Original file line number Diff line number Diff line change @@ -10,8 +10,6 @@ import React from 'react';
1010
1111import { Collaborator , CollaboratorItem , Invitation } from './Collaborator' ;
1212
13- y ;
14-
1513const Animated = ( { showMountAnimations, ...props } ) => (
1614 < motion . div
1715 animate = { { opacity : 1 , height : 'auto' } }
You can’t perform that action at this time.
0 commit comments