@@ -5,13 +5,14 @@ import { createSelector } from 'reselect';
55import { bindActionCreators } from 'redux' ;
66import { connect } from 'react-redux' ;
77import { Link } from 'react-router-dom' ;
8- import styled from 'styled-components' ;
8+ import styled , { ThemeProvider } from 'styled-components' ;
99
1010import type { Sandbox , User } from 'common/types' ;
1111import sandboxActionCreators from 'app/store/entities/sandboxes/actions' ;
1212import { modulesFromSandboxNotSavedSelector } from 'app/store/entities/sandboxes/modules/selectors' ;
1313import { usersSelector } from 'app/store/entities/users/selectors' ;
1414import { isPatronSelector } from 'app/store/user/selectors' ;
15+ import getTemplateDefinition from 'common/templates' ;
1516
1617import showAlternativeComponent from 'app/hoc/show-alternative-component' ;
1718import fadeIn from 'app/utils/animation/fade-in' ;
@@ -80,76 +81,85 @@ const Workspace = ({
8081 sandboxActions,
8182 isPatron,
8283} : Props ) =>
83- < Container >
84- < div >
85- < Logo />
86- < WorkspaceItem defaultOpen title = "Project" >
87- < Project
88- updateSandboxInfo = { sandboxActions . updateSandboxInfo }
89- id = { sandbox . id }
90- title = { sandbox . title }
91- viewCount = { sandbox . viewCount }
92- likeCount = { sandbox . likeCount }
93- forkCount = { sandbox . forkCount }
94- git = { sandbox . git }
95- description = { sandbox . description }
96- forkedSandbox = { sandbox . forkedFromSandbox }
97- preventTransition = { preventTransition }
98- owned = { sandbox . owned }
99- author = { user }
100- privacy = { sandbox . privacy }
101- />
102- </ WorkspaceItem >
103-
104- < WorkspaceItem defaultOpen title = "Files" >
105- < Files sandbox = { sandbox } sandboxActions = { sandboxActions } />
106- </ WorkspaceItem >
107-
108- < WorkspaceItem title = "Dependencies" >
109- < Dependencies
110- sandboxId = { sandbox . id }
111- npmDependencies = { sandbox . npmDependencies }
112- externalResources = { sandbox . externalResources }
113- sandboxActions = { sandboxActions }
114- processing = {
115- ! ! ( sandbox . dependencyBundle && sandbox . dependencyBundle . processing )
116- }
117- />
118- </ WorkspaceItem >
119-
120- { ( sandbox . owned || sandbox . tags . length > 0 ) &&
121- < WorkspaceItem title = "Tags" >
122- < Tags
123- sandboxId = { sandbox . id }
124- addTag = { sandboxActions . addTag }
125- removeTag = { sandboxActions . removeTag }
126- isOwner = { sandbox . owned }
127- tags = { sandbox . tags }
128- />
129- </ WorkspaceItem > }
130-
131- { sandbox . owned &&
132- < WorkspaceItem title = "Sandbox Actions" >
133- < SandboxActions
84+ console . log ( getTemplateDefinition ( sandbox . template ) . color ) ||
85+ < ThemeProvider
86+ theme = { {
87+ templateColor : getTemplateDefinition ( sandbox . template ) . color ,
88+ } }
89+ >
90+ < Container >
91+ < div >
92+ < Logo />
93+ < WorkspaceItem defaultOpen title = "Project" >
94+ < Project
95+ updateSandboxInfo = { sandboxActions . updateSandboxInfo }
13496 id = { sandbox . id }
135- deleteSandbox = { sandboxActions . deleteSandbox }
136- newSandboxUrl = { sandboxActions . newSandboxUrl }
137- setSandboxPrivacy = { sandboxActions . setSandboxPrivacy }
138- isPatron = { isPatron }
97+ title = { sandbox . title }
98+ viewCount = { sandbox . viewCount }
99+ likeCount = { sandbox . likeCount }
100+ forkCount = { sandbox . forkCount }
101+ git = { sandbox . git }
102+ description = { sandbox . description }
103+ forkedSandbox = { sandbox . forkedFromSandbox }
104+ preventTransition = { preventTransition }
105+ owned = { sandbox . owned }
106+ author = { user }
139107 privacy = { sandbox . privacy }
140108 />
141- </ WorkspaceItem > }
142- </ div >
143-
144- < div >
145- < ConnectionNotice />
146- < TermsContainer >
147- By using CodeSandbox you agree to our{ ' ' }
148- < Link to = { tosUrl ( ) } > Terms and Conditions</ Link > and{ ' ' }
149- < Link to = { privacyUrl ( ) } > Privacy Policy</ Link > .
150- </ TermsContainer >
151- </ div >
152- </ Container > ;
109+ </ WorkspaceItem >
110+
111+ < WorkspaceItem defaultOpen title = "Files" >
112+ < Files sandbox = { sandbox } sandboxActions = { sandboxActions } />
113+ </ WorkspaceItem >
114+
115+ < WorkspaceItem title = "Dependencies" >
116+ < Dependencies
117+ sandboxId = { sandbox . id }
118+ npmDependencies = { sandbox . npmDependencies }
119+ externalResources = { sandbox . externalResources }
120+ sandboxActions = { sandboxActions }
121+ processing = {
122+ ! ! (
123+ sandbox . dependencyBundle && sandbox . dependencyBundle . processing
124+ )
125+ }
126+ />
127+ </ WorkspaceItem >
128+
129+ { ( sandbox . owned || sandbox . tags . length > 0 ) &&
130+ < WorkspaceItem title = "Tags" >
131+ < Tags
132+ sandboxId = { sandbox . id }
133+ addTag = { sandboxActions . addTag }
134+ removeTag = { sandboxActions . removeTag }
135+ isOwner = { sandbox . owned }
136+ tags = { sandbox . tags }
137+ />
138+ </ WorkspaceItem > }
139+
140+ { sandbox . owned &&
141+ < WorkspaceItem title = "Sandbox Actions" >
142+ < SandboxActions
143+ id = { sandbox . id }
144+ deleteSandbox = { sandboxActions . deleteSandbox }
145+ newSandboxUrl = { sandboxActions . newSandboxUrl }
146+ setSandboxPrivacy = { sandboxActions . setSandboxPrivacy }
147+ isPatron = { isPatron }
148+ privacy = { sandbox . privacy }
149+ />
150+ </ WorkspaceItem > }
151+ </ div >
152+
153+ < div >
154+ < ConnectionNotice />
155+ < TermsContainer >
156+ By using CodeSandbox you agree to our{ ' ' }
157+ < Link to = { tosUrl ( ) } > Terms and Conditions</ Link > and{ ' ' }
158+ < Link to = { privacyUrl ( ) } > Privacy Policy</ Link > .
159+ </ TermsContainer >
160+ </ div >
161+ </ Container >
162+ </ ThemeProvider > ;
153163
154164// The skeleton to show if sandbox doesn't exist
155165const Skeleton = ( ) => < Container /> ;
0 commit comments