Skip to content

Commit 016bc81

Browse files
committed
Merge branch 'refactor-DeploymentModal' of https://github.com/sajadhsm/codesandbox-client into sajadhsm-refactor-DeploymentModal
2 parents 0d26ff3 + ebe6882 commit 016bc81

File tree

9 files changed

+61
-98
lines changed

9 files changed

+61
-98
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,15 @@
14661466
"contributions": [
14671467
"code"
14681468
]
1469+
},
1470+
{
1471+
"login": "sajadhsm",
1472+
"name": "Sajad Hashemian",
1473+
"avatar_url": "https://avatars3.githubusercontent.com/u/20022818?v=4",
1474+
"profile": "https://github.com/sajadhsm",
1475+
"contributions": [
1476+
"code"
1477+
]
14691478
}
14701479
],
14711480
"contributorsPerLine": 7,

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ Thanks goes to these wonderful people
241241
<td align="center"><a href="http://yevhenorlov.com"><img src="https://avatars2.githubusercontent.com/u/17388747?v=4" width="100px;" alt="yevhen orlov"/><br /><sub><b>yevhen orlov</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=yevhenorlov" title="Code">💻</a></td>
242242
<td align="center"><a href="https://github.com/NileshPatel17"><img src="https://avatars2.githubusercontent.com/u/27020381?v=4" width="100px;" alt="Nilesh Patel"/><br /><sub><b>Nilesh Patel</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=NileshPatel17" title="Code">💻</a></td>
243243
<td align="center"><a href="https://github.com/22PoojaGaur"><img src="https://avatars2.githubusercontent.com/u/43316760?v=4" width="100px;" alt="Pooja Gaur"/><br /><sub><b>Pooja Gaur</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=22PoojaGaur" title="Code">💻</a></td>
244+
<td align="center"><a href="https://github.com/sajadhsm"><img src="https://avatars3.githubusercontent.com/u/20022818?v=4" width="100px;" alt="Sajad Hashemian"/><br /><sub><b>Sajad Hashemian</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=sajadhsm" title="Code">💻</a></td>
244245
</tr>
245246
</table>
246247

247248
<!-- markdownlint-enable -->
248249
<!-- prettier-ignore-end -->
250+
249251
<!-- ALL-CONTRIBUTORS-LIST:END -->

packages/app/src/app/components/IntegrationModal/IntegrationModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313

1414
interface IIntegrationModalProps {
1515
title: string;
16-
subtitle: string;
16+
subtitle: string | React.ReactNode;
1717
signedIn: boolean;
1818
Integration: React.ComponentType;
1919
name: string;

packages/app/src/app/pages/common/Modals/DeploymentModal/Cube/elements.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/app/src/app/pages/common/Modals/DeploymentModal/Cube/index.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/app/src/app/pages/common/Modals/DeploymentModal/index.js renamed to packages/app/src/app/pages/common/Modals/DeploymentModal/DeploymentModal.tsx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from 'react';
1+
import React, { FunctionComponent } from 'react';
22
import { Button } from '@codesandbox/common/lib/components/Button';
33
import Centered from '@codesandbox/common/lib/components/flex/Centered';
44
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
5-
import { inject, observer } from 'app/componentConnectors';
5+
import { useOvermind } from 'app/overmind';
66
import { ZeitIntegration } from 'app/pages/common/ZeitIntegration';
77
import { IntegrationModal } from 'app/components/IntegrationModal';
88
import track from '@codesandbox/common/lib/utils/analytics';
@@ -17,10 +17,20 @@ import {
1717
DeploymentManagementNotice,
1818
} from './elements';
1919

20-
function DeploymentModal({ store, signals }) {
21-
const { user } = store;
20+
export const DeploymentModal: FunctionComponent = () => {
21+
const {
22+
state: {
23+
user: {
24+
integrations: { zeit },
25+
},
26+
deployment: { deploying, url },
27+
},
28+
actions: {
29+
deployment: { deployClicked },
30+
},
31+
} = useOvermind();
2232

23-
const zeitSignedIn = user.integrations.zeit;
33+
const zeitSignedIn = !!zeit;
2434

2535
return (
2636
<IntegrationModal
@@ -43,10 +53,10 @@ function DeploymentModal({ store, signals }) {
4353
signedIn={zeitSignedIn}
4454
>
4555
<Centered horizontal>
46-
{store.deployment.deploying && (
56+
{deploying && (
4757
<Margin top={1}>
4858
<DeployText>Deploying sandbox...</DeployText>
49-
<DeployAnimationContainer deploying={store.deployment.deploying}>
59+
<DeployAnimationContainer deploying={deploying}>
5060
<StyledLogo width={70} height={70} />
5161
{[0, 1, 2, 3].map(i => (
5262
<StyledCube key={i} i={i} size={20} />
@@ -56,17 +66,17 @@ function DeploymentModal({ store, signals }) {
5666
</Margin>
5767
)}
5868

59-
{store.deployment.url ? (
69+
{url ? (
6070
<Margin top={1} bottom={2}>
6171
<Centered horizontal>
6272
<DeployText>Deployed!</DeployText>
6373

6474
<DeployedLink
65-
href={store.deployment.url}
75+
href={url}
6676
rel="nofollow noreferrer"
6777
target="_blank"
6878
>
69-
{store.deployment.url}
79+
{url}
7080
</DeployedLink>
7181

7282
<DeploymentManagementNotice>
@@ -83,13 +93,13 @@ function DeploymentModal({ store, signals }) {
8393
</Centered>
8494
</Margin>
8595
) : (
86-
<ButtonContainer deploying={store.deployment.deploying}>
96+
<ButtonContainer deploying={deploying}>
8797
<Button
8898
onClick={() => {
8999
track('Deploy Clicked', { provider: 'zeit' });
90-
signals.deployment.deployClicked();
100+
deployClicked();
91101
}}
92-
disabled={!zeitSignedIn || store.deployment.deploying}
102+
disabled={!zeitSignedIn || deploying}
93103
>
94104
Deploy Now
95105
</Button>
@@ -98,6 +108,4 @@ function DeploymentModal({ store, signals }) {
98108
</Centered>
99109
</IntegrationModal>
100110
);
101-
}
102-
103-
export default inject('store', 'signals')(observer(DeploymentModal));
111+
};

packages/app/src/app/pages/common/Modals/DeploymentModal/elements.js renamed to packages/app/src/app/pages/common/Modals/DeploymentModal/elements.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import styled, { keyframes } from 'styled-components';
1+
import styled, { css, keyframes } from 'styled-components';
22
import delayInEffect from '@codesandbox/common/lib/utils/animation/delay-effect';
33
import delayOutEffect from '@codesandbox/common/lib/utils/animation/delay-out-effect';
44
import { NowLogo } from 'app/components/NowLogo';
55
import { OpaqueLogo } from 'app/components/OpaqueLogo';
6-
import Cube from './Cube';
6+
import { Cube } from 'app/components/Cube';
77

88
const cubeAnimation = keyframes`
99
0% {
@@ -23,24 +23,28 @@ const cubeAnimation = keyframes`
2323
}
2424
`;
2525

26-
export const ButtonContainer = styled.div`
27-
margin: 2rem 4rem;
28-
margin-bottom: 3rem;
29-
${delayInEffect()} ${({ deploying }) =>
30-
deploying && delayOutEffect(0, false)};
26+
export const ButtonContainer = styled.div<{ deploying: boolean }>`
27+
${({ deploying }) => css`
28+
margin: 2rem 4rem;
29+
margin-bottom: 3rem;
30+
${delayInEffect()}
31+
${deploying && delayOutEffect(0, false)};
32+
`}
3133
`;
3234

33-
export const DeployAnimationContainer = styled.div`
34-
display: flex;
35-
justify-content: center;
36-
align-items: center;
37-
position: absolute;
38-
top: 16px;
39-
bottom: 10px;
40-
right: 0;
41-
left: 0;
35+
export const DeployAnimationContainer = styled.div<{ deploying: boolean }>`
36+
${({ deploying }) => css`
37+
display: flex;
38+
justify-content: center;
39+
align-items: center;
40+
position: absolute;
41+
top: 16px;
42+
bottom: 10px;
43+
right: 0;
44+
left: 0;
4245
43-
${({ deploying }) => deploying && delayInEffect(0, false)};
46+
${deploying && delayInEffect(0, false)};
47+
`}
4448
`;
4549

4650
export const StyledNowLogo = styled(NowLogo)`
@@ -49,7 +53,7 @@ export const StyledNowLogo = styled(NowLogo)`
4953
transform: translateY(10px) translateX(80px);
5054
`;
5155

52-
export const StyledCube = styled(Cube)`
56+
export const StyledCube = styled(Cube)<{ i: number }>`
5357
position: absolute;
5458
animation: ${cubeAnimation} 2s ease-in infinite;
5559
animation-delay: ${({ i }) => i * 0.5}s;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { DeploymentModal } from './DeploymentModal';

packages/app/src/app/pages/common/Modals/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ import CommitModal from './CommitModal';
1616
import { DeleteDeploymentModal } from './DeleteDeploymentModal';
1717
import { DeleteProfileSandboxModal } from './DeleteProfileSandboxModal';
1818
import DeleteSandboxModal from './DeleteSandboxModal';
19-
import DeploymentModal from './DeploymentModal';
19+
import { DeploymentModal } from './DeploymentModal';
2020
import { EmptyTrash } from './EmptyTrash';
2121
import ExportGitHubModal from './ExportGitHubModal';
2222
import { FeedbackModal } from './FeedbackModal';
2323
import { ForkServerModal } from './ForkServerModal';
2424
import { LiveSessionEnded } from './LiveSessionEnded';
2525
import LiveSessionVersionMismatch from './LiveSessionVersionMismatch';
26-
import {NetlifyLogs} from './NetlifyLogs';
26+
import { NetlifyLogs } from './NetlifyLogs';
2727
import { PickSandboxModal } from './PickSandboxModal';
2828
import PreferencesModal from './PreferencesModal';
2929
import PRModal from './PRModal';

0 commit comments

Comments
 (0)