1- import { inject , hooksObserver } from 'app/componentConnectors' ;
2- import React , { useEffect } from 'react' ;
1+ import React , { FunctionComponent , useEffect } from 'react' ;
2+
3+ import { useOvermind } from 'app/overmind' ;
34
45import { Description } from '../../elements' ;
56
@@ -8,52 +9,47 @@ import { More } from '../More';
89import { Netlify } from './Netlify' ;
910import { Zeit } from './Zeit' ;
1011
11- export const Deployment = inject ( 'store' , 'signals' ) (
12- hooksObserver (
13- ( {
14- store : {
15- editor : { currentSandbox } ,
16- isLoggedIn,
17- } ,
18- signals : {
19- deployment : { getDeploys } ,
20- } ,
21- } ) => {
22- const showPlaceholder = ! ( currentSandbox . owned && isLoggedIn ) ;
23-
24- useEffect ( ( ) => {
25- if ( ! showPlaceholder ) {
26- getDeploys ( ) ;
27- }
28- } , [ getDeploys , showPlaceholder ] ) ;
29-
30- if ( showPlaceholder ) {
31- const message = isLoggedIn ? (
32- < >
33- You need to own this sandbox to deploy this sandbox to Netlify or
34- ZEIT. < p > Fork this sandbox to make a deploy!</ p >
35- </ >
36- ) : (
37- < >
38- You need to be signed in to deploy this sandbox to Netlify or ZEIT.
39- </ >
40- ) ;
41-
42- return < More message = { message } id = "github" /> ;
43- }
44-
45- return (
46- < div >
47- < Description >
48- You can deploy a production version of your sandbox using one our
49- supported providers.
50- </ Description >
51-
52- < Zeit />
53-
54- < Netlify />
55- </ div >
56- ) ;
12+ export const Deployment : FunctionComponent = ( ) => {
13+ const {
14+ actions : {
15+ deployment : { getDeploys } ,
16+ } ,
17+ state : {
18+ editor : { currentSandbox } ,
19+ isLoggedIn,
20+ } ,
21+ } = useOvermind ( ) ;
22+ const showPlaceholder = ! ( currentSandbox . owned && isLoggedIn ) ;
23+
24+ useEffect ( ( ) => {
25+ if ( ! showPlaceholder ) {
26+ getDeploys ( ) ;
5727 }
58- )
59- ) ;
28+ } , [ getDeploys , showPlaceholder ] ) ;
29+
30+ if ( showPlaceholder ) {
31+ const message = isLoggedIn ? (
32+ < >
33+ You need to own this sandbox to deploy this sandbox to Netlify or ZEIT.{ ' ' }
34+ < p > Fork this sandbox to make a deploy!</ p >
35+ </ >
36+ ) : (
37+ < > You need to be signed in to deploy this sandbox to Netlify or ZEIT.</ >
38+ ) ;
39+
40+ return < More message = { message } id = "github" /> ;
41+ }
42+
43+ return (
44+ < div >
45+ < Description >
46+ You can deploy a production version of your sandbox using one our
47+ supported providers.
48+ </ Description >
49+
50+ < Zeit />
51+
52+ < Netlify />
53+ </ div >
54+ ) ;
55+ } ;
0 commit comments