2018-12-15 19:09:31 +00:00
|
|
|
import React from 'react'
|
2018-12-15 20:15:17 +00:00
|
|
|
import Divider from '@material-ui/core/Divider'
|
2018-12-15 19:09:31 +00:00
|
|
|
import { FundingContext } from '../context'
|
|
|
|
import PledgesTable from './PledgesTable'
|
|
|
|
import FunderProfilesTable from './FunderProfilesTable'
|
2018-12-15 20:15:17 +00:00
|
|
|
import AddFunder from './AddFunder'
|
|
|
|
import CreateFunding from './CreateFunding'
|
2018-12-15 19:09:31 +00:00
|
|
|
|
|
|
|
const FundsManagement = ({ open }) => {
|
2019-01-18 19:03:01 +00:00
|
|
|
const windowWidth = window.visualViewport.width
|
2019-02-06 19:33:08 +00:00
|
|
|
const maxWidth = open ? `${windowWidth * 0.80}px` : '90vw'
|
2019-02-07 20:44:36 +00:00
|
|
|
const height = `${window.visualViewport.height * 2.2}px`
|
2019-01-18 19:03:01 +00:00
|
|
|
const WebkitTransition = 'all 0.25s ease-out 0s'
|
2018-12-15 19:09:31 +00:00
|
|
|
return (
|
|
|
|
<FundingContext.Consumer>
|
2019-01-23 17:40:11 +00:00
|
|
|
{({ appendPledges, appendFundProfile }) =>
|
2019-02-07 20:44:36 +00:00
|
|
|
<div style={{ maxWidth, WebkitTransition, height, display: 'flex', flexDirection: 'column', justifyContent: 'space-between' }}>
|
2019-01-23 17:40:11 +00:00
|
|
|
<PledgesTable />
|
2019-01-18 21:14:33 +00:00
|
|
|
<FunderProfilesTable />
|
2018-12-15 20:15:17 +00:00
|
|
|
<AddFunder appendFundProfile={appendFundProfile} />
|
|
|
|
<Divider variant="middle" />
|
|
|
|
<CreateFunding refreshTable={appendPledges} />
|
2018-12-15 19:09:31 +00:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</FundingContext.Consumer>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default FundsManagement
|