Skip to content

Commit d018244

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
🔨 Switch More to use useOvermind (codesandbox#2534)
1 parent 597b9f1 commit d018244

File tree

1 file changed

+37
-43
lines changed
  • packages/app/src/app/pages/Sandbox/Editor/Workspace/items/More

1 file changed

+37
-43
lines changed
Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,51 @@
1-
import React, { useEffect } from 'react';
2-
import ProgressButton from '@codesandbox/common/lib/components/ProgressButton';
31
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
2+
import ProgressButton from '@codesandbox/common/lib/components/ProgressButton';
43
import track from '@codesandbox/common/lib/utils/analytics';
5-
import { inject, hooksObserver } from 'app/componentConnectors';
4+
import React, { FunctionComponent, useEffect } from 'react';
65

6+
import { useOvermind } from 'app/overmind';
77
import { SignInButton } from 'app/pages/common/SignInButton';
88

99
import { Description } from '../../elements';
1010

1111
interface Props {
1212
id: string;
1313
message: string | JSX.Element;
14-
store: any;
15-
signals: any;
1614
}
1715

18-
export const More = inject('store', 'signals')(
19-
hooksObserver(
20-
({
21-
id,
22-
message,
23-
signals: {
24-
editor: { forkSandboxClicked },
25-
},
26-
store: {
27-
isLoggedIn,
28-
editor: { isForkingSandbox },
29-
},
30-
}: Props) => {
31-
useEffect(() => {
32-
track('Workspace - More Opened', { id });
33-
}, [id]);
16+
export const More: FunctionComponent<Props> = ({ id, message }) => {
17+
const {
18+
actions: {
19+
editor: { forkSandboxClicked },
20+
},
21+
state: {
22+
isLoggedIn,
23+
editor: { isForkingSandbox },
24+
},
25+
} = useOvermind();
26+
27+
useEffect(() => {
28+
track('Workspace - More Opened', { id });
29+
}, [id]);
3430

35-
return (
36-
<div>
37-
<Description>{message}</Description>
31+
return (
32+
<div>
33+
<Description>{message}</Description>
3834

39-
<Margin margin={1}>
40-
{!isLoggedIn ? (
41-
<SignInButton block />
42-
) : (
43-
<ProgressButton
44-
block
45-
loading={isForkingSandbox}
46-
onClick={() => forkSandboxClicked()}
47-
small
48-
>
49-
{isForkingSandbox ? 'Forking Sandbox...' : 'Fork Sandbox'}
50-
</ProgressButton>
51-
)}
52-
</Margin>
53-
</div>
54-
);
55-
}
56-
)
57-
);
35+
<Margin margin={1}>
36+
{!isLoggedIn ? (
37+
<SignInButton block />
38+
) : (
39+
<ProgressButton
40+
block
41+
loading={isForkingSandbox}
42+
onClick={() => forkSandboxClicked()}
43+
small
44+
>
45+
{isForkingSandbox ? 'Forking Sandbox...' : 'Fork Sandbox'}
46+
</ProgressButton>
47+
)}
48+
</Margin>
49+
</div>
50+
);
51+
};

0 commit comments

Comments
 (0)