1- import React , { useEffect } from 'react'
1+ import React from 'react'
22import { useRouter } from 'next/router'
33import { Flex , Box , Type } from 'blockstack-ui'
44import { connect } from 'react-redux'
@@ -11,7 +11,6 @@ import { MakerContainer, MakerContentBox, MakerStickyStatusBox } from '@componen
1111import { Page } from '@components/page'
1212import Head from '@containers/head'
1313import Maker from '@components/maker'
14- import { red } from '@atlaskit/theme/dist/cjs/colors'
1514
1615const mapStateToProps = ( state ) => ( {
1716 user : selectUser ( state ) ,
@@ -22,18 +21,6 @@ const mapStateToProps = (state) => ({
2221 completionStatus : selectCompetionStatus ( state )
2322} )
2423
25- const LoadingPage = ( { message = 'Loading...' , ...rest } ) => (
26- < Page innerPadding = { 0 } wrap >
27- < Flex >
28- < Box width = { 1 } >
29- < Type fontSize = { 5 } my = { 7 } textAlign = "center" >
30- { message }
31- </ Type >
32- </ Box >
33- </ Flex >
34- </ Page >
35- )
36-
3724const handleChangingApp = ( event , fn ) => ( dispatch ) => {
3825 event . persist ( )
3926 const id = event . target . value
@@ -48,62 +35,72 @@ const getAppId = (params) => {
4835 return id
4936}
5037
51- const MakerPortal = connect ( ) (
52- ( { maker, selectedApp, appList, appId, apiServer, completionStatus, user, dispatch, ...rest } ) => {
53- const router = useRouter ( )
38+ const LoadingPage = ( { message = 'Loading...' } ) => (
39+ < Page innerPadding = { 0 } wrap >
40+ < Flex >
41+ < Box width = { 1 } >
42+ < Type fontSize = { 5 } my = { 7 } textAlign = "center" >
43+ { message }
44+ </ Type >
45+ </ Box >
46+ </ Flex >
47+ </ Page >
48+ )
49+
50+ const MakerPortal = connect ( ) ( ( { maker, selectedApp, appList, appId, apiServer, completionStatus, user, dispatch } ) => {
51+ const router = useRouter ( )
5452
55- const updateMakerRoute = ( id ) =>
56- router . push ( '/maker/apps' , `/maker/apps/${ id } ` , {
57- shallow : true
58- } )
53+ const updateMakerRoute = ( id ) =>
54+ router . push ( '/maker/apps' , `/maker/apps/${ id } ` , {
55+ shallow : true
56+ } )
5957
60- if ( maker . loading || ! selectedApp ) return < LoadingPage />
58+ if ( maker . loading || ! selectedApp ) return < LoadingPage />
6159
62- return (
63- < Page innerPadding = { 0 } wrap >
64- < Head title = { selectedApp . name } />
65- < MakerContainer >
60+ return (
61+ < Page innerPadding = { 0 } wrap >
62+ < Head title = { selectedApp . name } />
63+ < MakerContainer >
64+ < Box >
65+ { appList . length && (
66+ < select onChange = { ( e ) => handleChangingApp ( e , updateMakerRoute ) ( dispatch ) } value = { appId } >
67+ { appList . map ( ( { name, id } ) => (
68+ < option key = { id } value = { id } >
69+ { name }
70+ </ option >
71+ ) ) }
72+ </ select >
73+ ) }
74+ </ Box >
75+ < Type fontSize = { 3 } fontWeight = { 500 } mx = { [ 4 , 6 ] } py = { 6 } px = { [ 20 , 0 ] } >
76+ { selectedApp . name }
77+ </ Type >
78+ < Flex
79+ flexDirection = { [ 'column' , 'column' , 'row-reverse' ] }
80+ maxWidth = { [ 'unset' , 'unset' , 1140 ] }
81+ alignItems = "flex-start"
82+ >
83+ < MakerStickyStatusBox >
84+ < Maker . Status app = { selectedApp } apiServer = { apiServer } status = { completionStatus } />
85+ </ MakerStickyStatusBox >
6686 < Box >
67- { appList . length && (
68- < select onChange = { ( e ) => handleChangingApp ( e , updateMakerRoute ) ( dispatch ) } value = { appId } >
69- { appList . map ( ( { name , id } ) => (
70- < option key = { id } value = { id } >
71- { name }
72- </ option >
73- ) ) }
74- </ select >
75- ) }
87+ < MakerContentBox >
88+ < Maker . PaymentDetails app = { selectedApp } user = { user } apiServer = { apiServer } dispatch = { dispatch } / >
89+ </ MakerContentBox >
90+ < MakerContentBox >
91+ < Maker . KYC app = { selectedApp } user = { user } apiServer = { apiServer } />
92+ </ MakerContentBox >
93+ < MakerContentBox >
94+ < Maker . ParticipationAgreement app = { selectedApp } user = { user } apiServer = { apiServer } / >
95+ </ MakerContentBox >
7696 </ Box >
77- < Type fontSize = { 3 } fontWeight = { 500 } mx = { [ 4 , 6 ] } py = { 6 } px = { [ 20 , 0 ] } >
78- { selectedApp . name }
79- </ Type >
80- < Flex
81- flexDirection = { [ 'column' , 'column' , 'row-reverse' ] }
82- maxWidth = { [ 'unset' , 'unset' , 1140 ] }
83- alignItems = "flex-start"
84- >
85- < MakerStickyStatusBox >
86- < Maker . Status app = { selectedApp } apiServer = { apiServer } status = { completionStatus } />
87- </ MakerStickyStatusBox >
88- < Box >
89- < MakerContentBox >
90- < Maker . PaymentDetails app = { selectedApp } user = { user } apiServer = { apiServer } dispatch = { dispatch } />
91- </ MakerContentBox >
92- < MakerContentBox >
93- < Maker . KYC app = { selectedApp } user = { user } apiServer = { apiServer } />
94- </ MakerContentBox >
95- < MakerContentBox >
96- < Maker . ParticipationAgreement app = { selectedApp } user = { user } apiServer = { apiServer } />
97- </ MakerContentBox >
98- </ Box >
99- </ Flex >
100- </ MakerContainer >
101- </ Page >
102- )
103- }
104- )
97+ </ Flex >
98+ </ MakerContainer >
99+ </ Page >
100+ )
101+ } )
105102
106- MakerPortal . getInitialProps = async ( { req, reduxStore, ... ctx } ) => {
103+ MakerPortal . getInitialProps = async ( { req, reduxStore } ) => {
107104 const { params, universalCookies } = req
108105 const userCookie = universalCookies . cookies . jwt
109106 const appId = getAppId ( params )
0 commit comments