File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
overmind/namespaces/editor Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,15 @@ export const createZipClicked: Action = ({ state, effects }) => {
219219 effects . zip . download ( state . editor . currentSandbox ) ;
220220} ;
221221
222+ export const forkExternalSandbox : AsyncAction < string > = async (
223+ { actions } ,
224+ sandboxId
225+ ) => {
226+ await actions . editor . internal . forkSandbox ( {
227+ sandboxId,
228+ } ) ;
229+ } ;
230+
222231export const forkSandboxClicked : AsyncAction = async ( {
223232 state,
224233 effects,
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import theme from '@codesandbox/common/lib/theme';
1717import track from '@codesandbox/common/lib/utils/analytics' ;
1818
1919import { ESC , ENTER } from '@codesandbox/common/lib/utils/keycodes' ;
20+ import { Sandbox } from '@codesandbox/common/lib/types' ;
2021import { RENAME_SANDBOX_MUTATION } from '../../queries' ;
2122
2223import {
@@ -48,7 +49,7 @@ type Props = {
4849 selectedCount : number ;
4950 collectionPath : string ; // eslint-disable-line react/no-unused-prop-types
5051 collectionTeamId : string | undefined ;
51- sandbox : Object ;
52+ sandbox : Sandbox ;
5253 page : string | undefined ;
5354 privacy : number ;
5455 isPatron : boolean ;
@@ -63,6 +64,7 @@ type Props = {
6364 permanentlyDeleteSandboxes : ( ) => void ;
6465 undeleteSandboxes : ( ) => void ;
6566 makeTemplates : ( teamId ?: string ) => void ;
67+ forkSandbox : ( id : string ) => void ;
6668
6769 // React-DnD, lazy typings
6870 connectDragSource : any ;
@@ -280,6 +282,13 @@ class SandboxItemComponent extends React.PureComponent<Props, State> {
280282 return true ;
281283 } ,
282284 } ,
285+ {
286+ title : 'Fork Sandbox' ,
287+ action : ( ) => {
288+ this . props . forkSandbox ( this . props . sandbox . id ) ;
289+ return true ;
290+ } ,
291+ } ,
283292 {
284293 title : 'Export Sandbox' ,
285294 action : ( ) => {
Original file line number Diff line number Diff line change @@ -6,8 +6,9 @@ import { uniq } from 'lodash-es';
66import { basename } from 'path' ;
77import { camelizeKeys } from 'humps' ;
88
9- import track from '@codesandbox/common/lib/utils/analytics' ;
109import { protocolAndHost } from '@codesandbox/common/lib/utils/url-generator' ;
10+ import track from '@codesandbox/common/lib/utils/analytics' ;
11+
1112import Grid from 'react-virtualized/dist/commonjs/Grid' ;
1213import Column from 'react-virtualized/dist/commonjs/Table/Column' ;
1314import Table from 'react-virtualized/dist/commonjs/Table' ;
@@ -170,6 +171,10 @@ class SandboxGridComponent extends React.Component<*, State> {
170171 ) ;
171172 } ;
172173
174+ forkSandbox = id => {
175+ this . props . signals . editor . forkExternalSandbox ( id ) ;
176+ } ;
177+
173178 onMouseDown = ( event : MouseEvent ) = > {
174179 this . setState ( {
175180 selection : {
@@ -317,6 +322,7 @@ class SandboxGridComponent extends React.Component<*, State> {
317322 }
318323 collectionPath = { item . collection . path }
319324 collectionTeamId = { item . collection . teamId }
325+ forkSandbox = { this . forkSandbox }
320326 deleteSandboxes = { this . deleteSandboxes }
321327 undeleteSandboxes = { this . undeleteSandboxes }
322328 permanentlyDeleteSandboxes = { this . permanentlyDeleteSandboxes }
You can’t perform that action at this time.
0 commit comments