diff --git a/src/components/projects/FundProject.jsx b/src/components/projects/FundProject.jsx index 940eb73..3d33849 100644 --- a/src/components/projects/FundProject.jsx +++ b/src/components/projects/FundProject.jsx @@ -1,6 +1,7 @@ import React, { useContext, useMemo } from 'react' import { Formik } from 'formik' import classnames from 'classnames' +import { useQuery } from '@apollo/react-hooks' import LiquidPledging from '../../embarkArtifacts/contracts/LiquidPledging' import Button from '@material-ui/core/Button' import Typography from '@material-ui/core/Typography' @@ -14,11 +15,12 @@ import Icon from '../base/icons/IconByName' import { convertTokenAmountUsd } from '../../utils/prices' import { getAmountsPledged } from '../../utils/pledges' import { useProjectData } from './hooks' -import { getMediaType, getMediaSrc } from '../../utils/project' +import { getMediaType, getMediaSrc, formatProjectId } from '../../utils/project' import { getDateCreated, convertToHours } from '../../utils/dates' import { getTokenLabel, getTokenByAddress } from '../../utils/currencies' import MediaView from '../base/MediaView' import StatusTextField from '../base/TextField' +import { getProfileById } from './queries' const { addGiverAndDonate } = LiquidPledging.methods @@ -203,7 +205,6 @@ const SubmissionSection = ({ classes, projectData, projectId, pledges, commitTim const totalPledged = amountsPledged[0] ? amountsPledged[0][1] : 0 const percentToGoal = manifest ? (Number(totalPledged) / Number(manifest.goal)) * 100 : 0 const isCreator = projectData.creator === account - return ( diff --git a/src/components/projects/queries.js b/src/components/projects/queries.js new file mode 100644 index 0000000..3119a4d --- /dev/null +++ b/src/components/projects/queries.js @@ -0,0 +1,15 @@ +import { gql } from 'apollo-boost' + +export const getProfileById = gql` +query Profile($id: ID!){ + profile(id: $id) { + id + addr + commitTime + url, + profileId, + type, + name + } +} +` diff --git a/src/dapp.js b/src/dapp.js index 257940a..86756a2 100644 --- a/src/dapp.js +++ b/src/dapp.js @@ -5,7 +5,7 @@ import EmbarkJS from './embarkArtifacts/embarkjs' import LiquidPledging from './embarkArtifacts/contracts/LiquidPledging' import Snackbar from '@material-ui/core/Snackbar' import { ApolloProvider } from '@apollo/react-hooks' -import ApolloClient, { gql } from 'apollo-boost' +import ApolloClient from 'apollo-boost' import { initVaultAndLP, vaultPledgingNeedsInit, standardTokenApproval } from './utils/initialize' import { getAuthorizedPayments } from './utils/events' import { FundingContext } from './context' diff --git a/src/utils/project.js b/src/utils/project.js index 142b061..50520f2 100644 --- a/src/utils/project.js +++ b/src/utils/project.js @@ -1,5 +1,9 @@ +/*global web3*/ import { uniqBy, length } from 'ramda' +const { utils } = web3 + +export const formatProjectId = id => utils.toHex(id) const getFile = filePath => filePath.split('/').slice(-1)[0] const formatMedia = content => { const type = 'video/mp4'