Skip to content

Commit 5cdb82f

Browse files
committed
Refactored app/pages/common/Modals/ForkServerModal
1 parent f7a25a3 commit 5cdb82f

File tree

2 files changed

+48
-45
lines changed

2 files changed

+48
-45
lines changed

packages/app/src/app/pages/common/Modals/ForkServerModal/index.js

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React, { useEffect } from 'react';
2+
import { useOvermind } from 'app/overmind';
3+
import getTemplateDefinition from '@codesandbox/common/lib/templates';
4+
import { SignInButton } from 'app/pages/common/SignInButton';
5+
6+
import { Container, Heading, Explanation } from '../elements';
7+
8+
export const ForkServerModal: React.FC = () => {
9+
const {
10+
state: {
11+
isLoggedIn,
12+
editor: { currentSandbox },
13+
},
14+
actions: {
15+
modalClosed,
16+
editor: { forkSandboxClicked },
17+
},
18+
} = useOvermind();
19+
20+
useEffect(() => {
21+
// Which means that the user signed in in the meantime with the intention to
22+
// fork
23+
if (isLoggedIn) {
24+
forkSandboxClicked();
25+
modalClosed();
26+
}
27+
}, [forkSandboxClicked, isLoggedIn, modalClosed]);
28+
29+
const templateDefinition = getTemplateDefinition(currentSandbox.template);
30+
const niceName = (
31+
<span style={{ color: templateDefinition.color(), fontWeight: 500 }}>
32+
{templateDefinition.niceName}
33+
</span>
34+
);
35+
36+
return (
37+
<Container>
38+
<Heading>Fork {niceName} Sandbox</Heading>
39+
<Explanation>
40+
We execute {niceName} sandboxes in a server container. This is still in
41+
beta, so we require you to sign in before you can fork a {niceName}{' '}
42+
sandbox.
43+
</Explanation>
44+
45+
<SignInButton style={{ marginTop: 12 }} />
46+
</Container>
47+
);
48+
};

0 commit comments

Comments
 (0)