Skip to content

Commit daa185a

Browse files
🔨 Refactored 🧠 Overmind Hacktober | /app/pages/Sandbox/Editor… (codesandbox#2738)
🔨 Refactored 🧠 Overmind Hacktober | /app/pages/Sandbox/Editor/Workspace/items/Deployment/Netlify/SiteInfo/SiteInfo.tsx : replace Cerebral with Overmind & fixes NetlifySite id type
2 parents 8d11130 + f28189b commit daa185a

File tree

1 file changed

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

1 file changed

+35
-35
lines changed
Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react';
2-
import { inject, hooksObserver } from 'app/componentConnectors';
1+
import React, { FunctionComponent } from 'react';
2+
import { useOvermind } from 'app/overmind';
33

44
import getNetlifyConfig from 'app/utils/getNetlifyConfig';
55

@@ -29,43 +29,43 @@ const getFunctionDir = sandbox => {
2929
}
3030
};
3131

32-
export const SiteInfo = inject('store')(
33-
hooksObserver(
34-
({
35-
store: {
36-
deployment: { building, netlifyLogs, netlifySite },
37-
editor: { currentSandbox },
32+
export const SiteInfo: FunctionComponent = () => {
33+
const {
34+
state: {
35+
deployment: {
36+
building,
37+
netlifyLogs,
38+
netlifySite: { id, name },
3839
},
39-
}) => {
40-
const functionDirectory = getFunctionDir(currentSandbox);
41-
const functions = functionDirectory
42-
? currentSandbox.modules.filter(
43-
({ directoryShortid }) =>
44-
directoryShortid === functionDirectory.shortid
45-
)
46-
: [];
40+
editor: { currentSandbox },
41+
},
42+
} = useOvermind();
43+
const functionDirectory = getFunctionDir(currentSandbox);
44+
const functions = functionDirectory
45+
? currentSandbox.modules.filter(
46+
({ directoryShortid }) => directoryShortid === functionDirectory.shortid
47+
)
48+
: [];
4749

48-
return (
49-
<SiteInfoWrapper>
50-
<WorkspaceSubtitle>Sandbox Site</WorkspaceSubtitle>
50+
return (
51+
<SiteInfoWrapper>
52+
<WorkspaceSubtitle>Sandbox Site</WorkspaceSubtitle>
5153

52-
<WorkspaceInputContainer>
53-
<Deploys>
54-
<Deploy key={netlifySite.uid}>
55-
<Name light>{netlifySite.name}</Name>
54+
<WorkspaceInputContainer>
55+
<Deploys>
56+
<Deploy key={id}>
57+
<Name light>{name}</Name>
5658

57-
{!building && <div>Building</div>}
59+
{!building && <div>Building</div>}
5860

59-
{functions.length ? <Functions functions={functions} /> : null}
61+
{functions.length ? <Functions functions={functions} /> : null}
6062

61-
<Actions />
63+
<Actions />
6264

63-
{netlifyLogs ? <ViewLogsButton /> : null}
64-
</Deploy>
65-
</Deploys>
66-
</WorkspaceInputContainer>
67-
</SiteInfoWrapper>
68-
);
69-
}
70-
)
71-
);
65+
{netlifyLogs ? <ViewLogsButton /> : null}
66+
</Deploy>
67+
</Deploys>
68+
</WorkspaceInputContainer>
69+
</SiteInfoWrapper>
70+
);
71+
};

0 commit comments

Comments
 (0)