Skip to content

Commit 234dbb7

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
🔨 Switch Netlify to use useOvermind (codesandbox#2579)
1 parent aa0c471 commit 234dbb7

File tree

1 file changed

+35
-36
lines changed
  • packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Netlify

1 file changed

+35
-36
lines changed
Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
11
import getTemplate from '@codesandbox/common/lib/templates';
2-
import { inject, hooksObserver } from 'app/componentConnectors';
3-
import React, { useEffect, useState } from 'react';
2+
3+
import React, { FunctionComponent, useEffect, useState } from 'react';
4+
5+
import { useOvermind } from 'app/overmind';
46

57
import { Wrapper } from '../elements';
68

79
import { DeployButton } from './DeployButton';
810
import { SiteInfo } from './SiteInfo';
911

10-
export const Netlify = inject('store', 'signals')(
11-
hooksObserver(
12-
({
13-
signals: {
14-
deployment: { getNetlifyDeploys },
15-
},
16-
store: {
17-
deployment: { deploying, netlifySite },
18-
editor: { currentSandbox },
19-
},
20-
}) => {
21-
const [isVisible, setVisible] = useState(false);
22-
23-
useEffect(() => {
24-
getNetlifyDeploys();
25-
}, [getNetlifyDeploys]);
26-
27-
const template = getTemplate(currentSandbox.template);
28-
29-
return (
30-
template.netlify !== false && (
31-
<Wrapper loading={deploying}>
32-
<DeployButton
33-
isOpen={isVisible}
34-
toggle={() => setVisible(show => !show)}
35-
/>
36-
37-
{netlifySite && isVisible ? <SiteInfo /> : null}
38-
</Wrapper>
39-
)
40-
);
41-
}
42-
)
43-
);
12+
export const Netlify: FunctionComponent = () => {
13+
const {
14+
actions: {
15+
deployment: { getNetlifyDeploys },
16+
},
17+
state: {
18+
deployment: { deploying, netlifySite },
19+
editor: { currentSandbox },
20+
},
21+
} = useOvermind();
22+
const [isVisible, setVisible] = useState(false);
23+
24+
useEffect(() => {
25+
getNetlifyDeploys();
26+
}, [getNetlifyDeploys]);
27+
28+
const template = getTemplate(currentSandbox.template);
29+
30+
return (
31+
template.netlify !== false && (
32+
<Wrapper loading={deploying}>
33+
<DeployButton
34+
isOpen={isVisible}
35+
toggle={() => setVisible(show => !show)}
36+
/>
37+
38+
{netlifySite && isVisible ? <SiteInfo /> : null}
39+
</Wrapper>
40+
)
41+
);
42+
};

0 commit comments

Comments
 (0)