|
1 | | -import React, { useEffect } from 'react'; |
2 | | -import ProgressButton from '@codesandbox/common/lib/components/ProgressButton'; |
3 | 1 | import Margin from '@codesandbox/common/lib/components/spacing/Margin'; |
| 2 | +import ProgressButton from '@codesandbox/common/lib/components/ProgressButton'; |
4 | 3 | import track from '@codesandbox/common/lib/utils/analytics'; |
5 | | -import { inject, hooksObserver } from 'app/componentConnectors'; |
| 4 | +import React, { FunctionComponent, useEffect } from 'react'; |
6 | 5 |
|
| 6 | +import { useOvermind } from 'app/overmind'; |
7 | 7 | import { SignInButton } from 'app/pages/common/SignInButton'; |
8 | 8 |
|
9 | 9 | import { Description } from '../../elements'; |
10 | 10 |
|
11 | 11 | interface Props { |
12 | 12 | id: string; |
13 | 13 | message: string | JSX.Element; |
14 | | - store: any; |
15 | | - signals: any; |
16 | 14 | } |
17 | 15 |
|
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]); |
34 | 30 |
|
35 | | - return ( |
36 | | - <div> |
37 | | - <Description>{message}</Description> |
| 31 | + return ( |
| 32 | + <div> |
| 33 | + <Description>{message}</Description> |
38 | 34 |
|
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