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

Commit 2e94aff

Browse files
committed
refactor: Move selectors to their own file
1 parent 1e0f4da commit 2e94aff

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

pages/maker/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react'
22
import { Flex, Box, Type } from 'blockstack-ui'
33
import { connect } from 'react-redux'
44

5-
import { selectMaker, selectAppList, selectCurrentApp } from '@stores/maker/reducer'
5+
import { selectMaker, selectAppList, selectCurrentApp } from '@stores/maker/selectors'
66
import { fetchApps, selectAppAction } from '@stores/maker/actions'
77
import { selectApiServer, selectUser } from '@stores/apps/selectors'
88
import { Page } from '@components/page'

stores/maker/reducer.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,3 @@ function makerReducer(state = initialState, action) {
7474
}
7575

7676
export default makerReducer
77-
78-
export const selectMaker = state => state.maker
79-
export const selectAppList = state => state.maker.appIds.map(id => state.maker.appEntities[id])
80-
export const selectCurrentApp = state => state.maker.appEntities[state.maker.selectedAppId]

stores/maker/selectors.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const updateEntity = (state, id, newProps) => ({
2+
...state,
3+
appEntities: {
4+
...state.appEntities,
5+
[id]: {
6+
...state.appEntities[id],
7+
...newProps
8+
}
9+
}
10+
})
11+
12+
export const selectMaker = state => state.maker
13+
14+
export const selectAppList = state => state.maker.appIds.map(id => state.maker.appEntities[id])
15+
16+
export const selectCurrentApp = state => state.maker.appEntities[state.maker.selectedAppId]
17+
18+
// export const selectCompetionStatus = state => {
19+
// const selectedApp = state.appEntities[state.selectedAppId]
20+
// return {
21+
// paymentDetailsComplete
22+
// }
23+
// }

0 commit comments

Comments
 (0)