mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-01-12 20:44:43 +00:00
add project query
This commit is contained in:
parent
cc2c2a073a
commit
309d301938
@ -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 (
|
||||
<Formik
|
||||
initialValues={{
|
||||
@ -333,6 +334,12 @@ const SubmissionSection = ({ classes, projectData, projectId, pledges, commitTim
|
||||
function FundProject({ classes, match, history, projectAddedEvents, pledges, profile }) {
|
||||
const projectId = match.params.id
|
||||
const projectData = useProjectData(projectId, projectAddedEvents)
|
||||
const { loading, error, data } = useQuery(getProfileById, {
|
||||
variables: { id: formatProjectId(projectId) }
|
||||
});
|
||||
|
||||
console.log({loading,error,data})
|
||||
|
||||
const commitTime = convertToHours(profile[0].commitTime)
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
|
15
src/components/projects/queries.js
Normal file
15
src/components/projects/queries.js
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
`
|
@ -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'
|
||||
|
@ -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'
|
||||
|
Loading…
x
Reference in New Issue
Block a user