Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier506 committed Jan 11, 2022
2 parents e8b9a1d + b8f71a6 commit a2470b2
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ REACT_APP_UAL_API_PORT=443
REACT_APP_UAL_CHAIN_ID=71ee83bcf52142d61019d95f9cc5427ba6a0d7ff8accd9e2088ae2abeaf3d3dd
REACT_APP_HASURA_URL=http://localhost:8080/v1/graphql
REACT_APP_BLOCK_EXPLORER_URL=https://testnet.protonscan.io
REACT_APP_AFFILIATE_ACCOUNT=affiliate
REACT_APP_AFFILIATE_ACCOUNT=earnproton
REACT_APP_USE_TESTNET=true
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contributing to EOS Costa Rica's Open Source Projects
👍🎉 First off, thanks for taking the time to contribute! 🎉👍

The following is a set of guidelines for contributing to EOS Costa Rica's Open Source Projects and its packages, which are hosted in the [`eoscostarica`](https://github.com/eoscostarica/) Organization on GitHub.


### [View Open Source Contributing Guidelines](https://guide.eoscostarica.io/docs/open-source-guidelines)

These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to [this document](https://github.com/eoscostarica/guide.eoscostarica.io/blob/master/docs/open-source-guidelines.md) in a pull request.
10 changes: 6 additions & 4 deletions webapp/src/components/Accordion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ const AccordionComponent = ({
event.stopPropagation()
setAnchorEl(event.currentTarget)
}
const handleClose = newFilterBy => {
const handleClose = () => {
setAnchorEl(null)
handleOnFilter(newFilterBy)
}

return (
Expand Down Expand Up @@ -81,14 +80,17 @@ const AccordionComponent = ({
vertical: 'top',
horizontal: 'right'
}}
onClose={() => handleClose(0)}
onClose={handleClose}
>
{(filterValues || []).map((item, index) => {
return (
<MenuItem
key={index}
className={classes.menu}
onClick={() => handleClose(index)}
onClick={() => {
handleClose()
handleOnFilter(index)
}}
>
<Typography className={classes.menuLabel}>{item}</Typography>

Expand Down
3 changes: 2 additions & 1 deletion webapp/src/config/main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export const appVersion =
export const name = process.env.REACT_APP_NAME
export const title = process.env.REACT_APP_TITLE
export const blockExplorer = process.env.REACT_APP_BLOCK_EXPLORER_URL
export const affiliateAccount = process.env.REACT_APP_AFFILIATE_ACCOUNT
export const affiliateAccount =
process.env.REACT_APP_AFFILIATE_ACCOUNT || 'earnproton'
export const eosioProtonAccount = 'eosio.proton'
export const logo = process.env.REACT_APP_CHAIN_LOGO
export const isTestnet = process.env.REACT_APP_USE_TESTNET === 'true'
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/context/state.context.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const loginWallet = async (restoreSession = false) => {
restoreSession
},
transportOptions: {
requestStatus: true,
requestAccount: mainConfig.affiliateAccount
requestAccount: mainConfig.affiliateAccount,
requestStatus: true
},
selectorOptions: {
appName: sdkConfig.appName,
Expand Down
10 changes: 5 additions & 5 deletions webapp/src/routes/Admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,13 @@ const Admin = () => {

const handleOnLoadMoreUsers = async usePagination => {
const pagination = usePagination ? userPagination : {}
const users = await affiliateUtil.getUsers(pagination.cursor)
const usersByRole = users.rows.filter(
({ role }) => !filterRowsBy || role === affiliateUtil.ROLES[filterRowsBy]
const users = await affiliateUtil.getUsersByRole(
pagination.cursor,
filterRowsBy
)
const referrers = (usersByRole || []).map(item => item.user)
const referrers = (users.rows || []).map(item => item.user)
const { data } = await loadHistoryByReferrers({ referrers })
const newRows = (usersByRole || []).map(row => {
const newRows = (users.rows || []).map(row => {
const history = data.history.filter(
item => item.referral.referrer === row.user
)
Expand Down
30 changes: 29 additions & 1 deletion webapp/src/utils/affiliate.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,34 @@ const checkKyc = async acc => {
return !!rows[0]?.kyc?.length
}

const getUsers = async lowerBound => {
const getUsersByRole = async (lowerBound, filterRowsBy) => {
const users = await getUsers(lowerBound)
const filteredUsers = users.rows.filter(
({ role }) => !filterRowsBy || role === ROLES[filterRowsBy]
)

if (!(filteredUsers.length < 10 && users.hasMore)) {
return {
rows: filteredUsers,
cursor: users.cursor,
hasMore: users.hasMore
}
}

const {
rows: tempRows,
cursor: tempCursor,
hasMore: tempHasMore
} = await getUsersByRole(users.cursor, filterRowsBy)

return {
rows: tempRows ? [...filteredUsers, ...tempRows] : filteredUsers,
cursor: tempCursor,
hasMore: tempHasMore
}
}

const getUsers = async (lowerBound, filterRowsBy) => {
const {
rows,
more: hasMore,
Expand Down Expand Up @@ -329,6 +356,7 @@ export const affiliateUtil = {
removeUsers,
approveKyc,
checkKyc,
getUsersByRole,
getUsers,
getUser,
isAccountValidAsReferrer,
Expand Down
24 changes: 12 additions & 12 deletions webapp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8005,20 +8005,20 @@ fsevents@^1.2.7:

"fsevents@patch:fsevents@^1.2.7#~builtin<compat/fsevents>":
version: 1.2.13
resolution: "fsevents@patch:fsevents@npm%3A1.2.13#~builtin<compat/fsevents>::version=1.2.13&hash=18f3a7"
resolution: "fsevents@patch:fsevents@npm%3A1.2.13#~builtin<compat/fsevents>::version=1.2.13&hash=1cc4b2"
dependencies:
bindings: ^1.5.0
nan: ^2.12.1
checksum: 2587e64097c1251ae549440b6347954ef3c5ce390061f9e0f0810e83d5d604bb7222c382e7e3c39fc2ba4da53f115b118ea5359ca3bb0bcb96576596bc685d5a
checksum: b264407498db2cfdcc2a05287334a4160c985a88e4a989e2f2f8dcc6afc8b04a4fcd82c797266442452e11c1fb07d7747d138b078fe4bb1f8f4fd2a6f2484d7e
languageName: node
linkType: hard

"fsevents@patch:fsevents@^2.1.2#~builtin<compat/fsevents>, fsevents@patch:fsevents@^2.1.3#~builtin<compat/fsevents>, fsevents@patch:fsevents@~2.3.2#~builtin<compat/fsevents>":
version: 2.3.2
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7"
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=1cc4b2"
dependencies:
node-gyp: latest
checksum: edbd0fd80be379c14409605f77e52fdc78a119e17f875e8b90a220c3e5b29e54a1477c21d91fd30b957ea4866406dc3ff87b61432d2840ff8866b309e5866140
checksum: 78db9daf1f6526a49cefee3917cc988f62dc7f25b5dd80ad6de4ffc4af7f0cab7491ac737626ff53e482a111bc53aac9e411fe3602458eca36f6a003ecf69c16
languageName: node
linkType: hard

Expand Down Expand Up @@ -14639,31 +14639,31 @@ resolve@^2.0.0-next.3:

"resolve@patch:[email protected]#~builtin<compat/resolve>":
version: 1.18.1
resolution: "resolve@patch:resolve@npm%3A1.18.1#~builtin<compat/resolve>::version=1.18.1&hash=d4691f"
resolution: "resolve@patch:resolve@npm%3A1.18.1#~builtin<compat/resolve>::version=1.18.1&hash=00b1ff"
dependencies:
is-core-module: ^2.0.0
path-parse: ^1.0.6
checksum: 32933bdf7bcc93bb7e01646f60a471b2cee0262b465449170ce02f4efea71868e4a9624aded28ce3935bc333028c2cc10885ac2b578125381a9de6481e8c1ce2
checksum: 3a5051499a570cf94d74353d494cacadbfa489107def201f87e26cabd80d000bd8abccbe247783b86b06d86ce2c646eee5c55900c71cbf1ad2043a67a92b0242
languageName: node
linkType: hard

"resolve@patch:resolve@^1.10.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.10.1#~builtin<compat/resolve>, resolve@patch:resolve@^1.12.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.14.2#~builtin<compat/resolve>, resolve@patch:resolve@^1.17.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.18.1#~builtin<compat/resolve>, resolve@patch:resolve@^1.20.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.3.2#~builtin<compat/resolve>, resolve@patch:resolve@^1.8.1#~builtin<compat/resolve>":
version: 1.20.0
resolution: "resolve@patch:resolve@npm%3A1.20.0#~builtin<compat/resolve>::version=1.20.0&hash=d4691f"
resolution: "resolve@patch:resolve@npm%3A1.20.0#~builtin<compat/resolve>::version=1.20.0&hash=00b1ff"
dependencies:
is-core-module: ^2.2.0
path-parse: ^1.0.6
checksum: 028141533a81a4515c8ac07e38a0ccde5e2722a0fa6bb83ac53ec463a764f1b7c021dcb98fc9a511a4f6e403f354d034bf250fcf9b7b8399bceb2a889ddf78ff
checksum: bed00be983cd20a8af0e7840664f655c4b269786dbd9595c5f156cd9d8a0050e65cdbbbdafc30ee9b6245b230c78a2c8ab6447a52545b582f476c29adb188cc5
languageName: node
linkType: hard

"resolve@patch:resolve@^2.0.0-next.3#~builtin<compat/resolve>":
version: 2.0.0-next.3
resolution: "resolve@patch:resolve@npm%3A2.0.0-next.3#~builtin<compat/resolve>::version=2.0.0-next.3&hash=d4691f"
resolution: "resolve@patch:resolve@npm%3A2.0.0-next.3#~builtin<compat/resolve>::version=2.0.0-next.3&hash=00b1ff"
dependencies:
is-core-module: ^2.2.0
path-parse: ^1.0.6
checksum: 2b145f11f797d477c355e53dc70a1b991d95e7954ea6ab258bc1905d4c1658d477a7bcf912eda56c9643080206fe1f44a53fe96559e8da17140347447ce9c025
checksum: eb88c5e53843bc022215744307a5f5664446c0fdb8f43c33456dce98d5ee6b3162d0cd0a177bb6f1c3d5c8bf01391ac7ab2de0e936e35318725fb40ba7efdaf6
languageName: node
linkType: hard

Expand Down Expand Up @@ -16530,11 +16530,11 @@ typescript@*:

"typescript@patch:typescript@*#~builtin<compat/typescript>":
version: 4.4.4
resolution: "typescript@patch:typescript@npm%3A4.4.4#~builtin<compat/typescript>::version=4.4.4&hash=6454cb"
resolution: "typescript@patch:typescript@npm%3A4.4.4#~builtin<compat/typescript>::version=4.4.4&hash=d8b4e7"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: aaf433508f31ca748d391e488ccb10485407f5920084fff35926076e6089009474929c1c43d0d5a0dafca65fec51550e032e0f0b28ce63c68432adc70b1bc9b3
checksum: 4a639b6886be13616582ab82abdb4ffbbf5b0458069d13c10cd5d44fc1cafa33eab005e8ac8691ad8fae249fee85844bb7d523263c4568fe9a2ca31cd3c91c3d
languageName: node
linkType: hard

Expand Down

0 comments on commit a2470b2

Please sign in to comment.