Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 2293613

Browse files
committed
fix: CAN REBASE AMEND, Infer status from state
1 parent 2e94aff commit 2293613

File tree

3 files changed

+11
-30
lines changed

3 files changed

+11
-30
lines changed

components/maker/status/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ const Status = ({ app, status }) => {
7070

7171
{isReady ? <AppMiningComplete /> : <AppMiningIncomplete/>}
7272

73-
<ItemToCompleteField label="Payment details" status={status.paymentDetailsComplete || hasPaymentDetails(app)} />
74-
<ItemToCompleteField label="Identity Verification" status={status.kycComplete || app.hasCollectedKYC} />
73+
<ItemToCompleteField label="Payment details" status={hasPaymentDetails(app)} />
74+
<ItemToCompleteField label="Identity Verification" status={app.hasCollectedKYC} />
7575
<ItemToCompleteField label="Tax Documents" status={app.isKYCVerified} />
7676
<ItemToCompleteField label="SEC Participation Agreement" status={app.hasAcceptedSECTerms} />
7777
</Box>

stores/maker/actions.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ export const SELECT_APP = '[Maker Page] SELECT_APP'
1717

1818
export const errorAction = () => ({ type: MAKER_AUTH_ERROR })
1919
export const setLoadingDoneAction = () => ({ type: SET_LOADING_DONE })
20-
export const setPaymentDetailsComplete = () => ({ type: SET_PAYMENT_DETAILS_COMPLETE })
2120
export const savePaymentDetailsAction = () => ({ type: SAVE_PAYMENT_DETAILS })
22-
export const savePaymentDetailsDoneAction = () => ({ type: SAVE_PAYMENT_DETAILS_DONE })
21+
export const savePaymentDetailsDoneAction = addresses => ({
22+
type: SAVE_PAYMENT_DETAILS_DONE,
23+
payload: addresses
24+
})
2325
export const savePaymentDetailsFailAction = () => ({ type: SAVE_PAYMENT_DETAILS_FAIL })
2426

2527
export const setKycComplete = () => ({ type: SET_KYC_COMPLETE })
@@ -46,14 +48,12 @@ export const savePaymentDetails = ({ apiServer, appId, jwt, btcAddress, stxAddre
4648
})
4749
})
4850
await response.json()
49-
dispatch(setPaymentDetailsComplete())
50-
dispatch(savePaymentDetailsDoneAction())
51+
dispatch(savePaymentDetailsDoneAction({ appId, btcAddress, stxAddress }))
5152
} catch (error) {
5253
dispatch(savePaymentDetailsFailAction(error))
5354
}
5455
}
5556

56-
5757
export const fetchApps = ({ user, apiServer }) => async dispatch => {
5858
dispatch(fetchAppsAction())
5959
if (!(user && user.jwt)) {
@@ -74,4 +74,3 @@ export const fetchApps = ({ user, apiServer }) => async dispatch => {
7474
dispatch(fetchAppsFailAction())
7575
}
7676
}
77-

stores/maker/reducer.js

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,12 @@ const initialState = {
77
appIds: [],
88
appEntities: {},
99
selectedAppId: null,
10-
errorMessage: null,
11-
status: {
12-
paymentDetailsComplete: false,
13-
kycComplete: false,
14-
legalComplete: false
15-
}
10+
errorMessage: null
1611
}
1712

18-
const updateStatus = (state, props) => ({
19-
...state,
20-
status: { ...state.status, ...props }
21-
})
22-
2313
function makerReducer(state = initialState, action) {
2414
switch (action.type) {
15+
2516
case MakerActions.SET_LOADING_DONE:
2617
return {
2718
...state,
@@ -43,15 +34,6 @@ function makerReducer(state = initialState, action) {
4334
selectedAppId: action.payload.apps.length ? action.payload.apps[0].id : null
4435
}
4536

46-
case MakerActions.SET_PAYMENT_DETAILS_COMPLETE:
47-
return updateStatus(state, { paymentDetailsComplete: true })
48-
49-
case MakerActions.SET_KYC_COMPLETE:
50-
return updateStatus(state, { kycComplete: true })
51-
52-
case MakerActions.SET_LEGAL_COMPLETE:
53-
return updateStatus(state, { legalComplete: true })
54-
5537
case MakerActions.SELECT_APP:
5638
return { ...state, selectedAppId: action.payload }
5739

@@ -60,8 +42,8 @@ function makerReducer(state = initialState, action) {
6042
...state,
6143
appEntities: {
6244
...state.appEntities,
63-
[action.payload.id]: {
64-
...state.appEntities[action.payload.id],
45+
[action.payload.appId]: {
46+
...state.appEntities[action.payload.appId],
6547
BTCAddress: action.payload.btcAddress,
6648
stacksAddress: action.payload.stxAddress
6749
}

0 commit comments

Comments
 (0)