From 6178061e6c5e5868d216e45eb42b3dc5c523b75a Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Mon, 18 Nov 2019 10:43:02 -0500 Subject: [PATCH] add check using idx --- config/webpack.config.js | 1 + package.json | 2 ++ src/components/projects/FundProject.jsx | 3 ++- yarn.lock | 15 ++++++++++----- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index 94f5d1f..fe6f88a 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -347,6 +347,7 @@ module.exports = function(webpackEnv) { }, }, ], + require.resolve('babel-plugin-idx') ], // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ diff --git a/package.json b/package.json index 4e268f3..7889088 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "babel-eslint": "9.0.0", "babel-jest": "23.6.0", "babel-loader": "8.0.5", + "babel-plugin-idx": "^2.4.0", "babel-plugin-named-asset-import": "^0.3.1", "babel-preset-react-app": "^7.0.2", "bfj": "6.1.1", @@ -112,6 +113,7 @@ "graphql": "^14.4.2", "html-webpack-plugin": "4.0.0-alpha.2", "identity-obj-proxy": "3.0.0", + "idx": "^2.5.6", "ipfs": "^0.38.0", "ipfs-http-client": "^38.2.0", "jest": "23.6.0", diff --git a/src/components/projects/FundProject.jsx b/src/components/projects/FundProject.jsx index 86714f3..a537bdf 100644 --- a/src/components/projects/FundProject.jsx +++ b/src/components/projects/FundProject.jsx @@ -2,6 +2,7 @@ import React, { useContext, useState, useMemo, useEffect } from 'react' import { Formik } from 'formik' import { makeStyles } from '@material-ui/core/styles' import classnames from 'classnames' +import idx from 'idx' import { useQuery } from '@apollo/react-hooks' import LiquidPledging from '../../embarkArtifacts/contracts/LiquidPledging' import SwapProxy from '../../embarkArtifacts/contracts/SwapProxy' @@ -318,7 +319,7 @@ function FundProject({ match, history }) { profileData={data.profile} startPolling={startPolling} /> - {!!Number(data.profile.pledgesInfos[0].lifetimeReceived) &&
+ {!!Number(idx(data, _ => _.profile.pledgesInfos[0].lifetimeReceived)) &&
This project received pledges. You have funds available to withdraw. diff --git a/yarn.lock b/yarn.lock index 60040a0..d4f0af6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3285,6 +3285,11 @@ babel-plugin-emotion@^9.2.11: source-map "^0.5.7" touch "^2.0.1" +babel-plugin-idx@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/babel-plugin-idx/-/babel-plugin-idx-2.4.0.tgz#5d144eb337fb22c4bf1ff75cb2e1c051a76a0323" + integrity sha512-+rEYZgSCLh0suJDlgZ64isSLhDW7Qxu6AnUMGhl/mW1kyYvfwqLqsDmgj3e5QXH0oX7A4Hq2x0BgqdU8tiuo5A== + babel-plugin-istanbul@^4.1.6: version "4.1.6" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz#36c59b2192efce81c5b378321b74175add1c9a45" @@ -7589,11 +7594,6 @@ embark@^4.1.0-beta.0: window-size "1.1.1" ws "7.1.2" -embarkjs-connector-web3@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/embarkjs-connector-web3/-/embarkjs-connector-web3-4.0.0.tgz#d474b23649668730082c7f6fa74b6a8c2cd0a447" - integrity sha512-mqLDRGawEfyqXgoSb2NgTwhlbAHwDrk7eyHrtEvywWgKfEPer+S+5IN+KGXi85d7QxcNKJSZ+BHve8wvWX0FfQ== - embarkjs-ens@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/embarkjs-ens/-/embarkjs-ens-4.1.1.tgz#ab4a75a6eed31985fc5f9fb94c764d94013f0037" @@ -10613,6 +10613,11 @@ idna-uts46-hx@^2.3.1: dependencies: punycode "2.1.0" +idx@^2.5.6: + version "2.5.6" + resolved "https://registry.yarnpkg.com/idx/-/idx-2.5.6.tgz#1f824595070100ae9ad585c86db08dc74f83a59d" + integrity sha512-WFXLF7JgPytbMgelpRY46nHz5tyDcedJ76pLV+RJWdb8h33bxFq4bdZau38DhNSzk5eVniBf1K3jwfK+Lb5nYA== + ieee754@^1.1.4, ieee754@^1.1.8: version "1.1.13" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"