From cf8e621528d91a2119ee41c1cf95557529b30523 Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Mon, 17 Sep 2018 15:15:22 -0500 Subject: [PATCH] Hidden Proposal Form auto-complete (#53) --- .../CreateProposal/exampleProposal.json | 27 +++++++++++++++++++ .../components/CreateProposal/index.tsx | 23 ++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 frontend/client/components/CreateProposal/exampleProposal.json diff --git a/frontend/client/components/CreateProposal/exampleProposal.json b/frontend/client/components/CreateProposal/exampleProposal.json new file mode 100644 index 00000000..97500b06 --- /dev/null +++ b/frontend/client/components/CreateProposal/exampleProposal.json @@ -0,0 +1,27 @@ +{ + "title": "An example proposal", + "proposalBody": + "## Hey\n\n### This is an example proposal\n\nIt even has some code!\n\n`print(\"Hello World!\")`", + "amountToRaise": "5.5", + "payOutAddress": "0x7ae4faf987a9316a03a44ad180b6679ac9df5400", + "trustees": [], + "deadline": 60, + "milestoneDeadline": 60, + "milestones": [ + { + "title": "First Milestone", + "description": "This is where I get some money", + "date": "October 2018", + "payoutPercent": 75, + "immediatePayout": true + }, + { + "title": "Second Milestone", + "description": "This is where I get more money", + "date": "December 2018", + "payoutPercent": 25, + "immediatePayout": false + } + ], + "category": "ACCESSIBILITY" +} diff --git a/frontend/client/components/CreateProposal/index.tsx b/frontend/client/components/CreateProposal/index.tsx index 7f3d49c0..73aca3e9 100644 --- a/frontend/client/components/CreateProposal/index.tsx +++ b/frontend/client/components/CreateProposal/index.tsx @@ -16,7 +16,9 @@ import { getAmountError } from 'utils/validators'; import MarkdownEditor from 'components/MarkdownEditor'; import * as Styled from './styled'; import { Wei, toWei } from 'utils/units'; +import exampleProposal from './exampleProposal.json'; import BN from 'bn.js'; + interface StateProps { crowdFundLoading: AppState['web3']['crowdFundLoading']; crowdFundError: AppState['web3']['crowdFundError']; @@ -90,6 +92,12 @@ class CreateProposal extends React.Component { } } + setExampleProposal() { + if (process.env.NODE_ENV !== 'production') { + this.setState(exampleProposal); + } + } + handleInputChange = ( event: React.ChangeEvent, ) => { @@ -171,7 +179,6 @@ class CreateProposal extends React.Component { milestones, category, } = this.state; - const backendData = { content: proposalBody, title, category }; const targetInWei = toWei(amountToRaise, 'ether'); const milestoneAmounts = milestones.map(milestone => @@ -304,7 +311,9 @@ class CreateProposal extends React.Component { return (
- Create a proposal + this.setExampleProposal()}> + Create a proposal + All fields are required { size="large" style={{ display: 'flex', textAlign: 'center' }} > + {deadline === 60 && ( + + 60 Seconds + + )} 30 Days @@ -454,6 +468,11 @@ class CreateProposal extends React.Component { size="large" style={{ display: 'flex', textAlign: 'center' }} > + {milestoneDeadline === 60 && ( + + 60 Seconds + + )} 3 Days