From b13aef480e54a5f416494375de6d99e3577b3cad Mon Sep 17 00:00:00 2001 From: Jon Ferrer Date: Mon, 8 Oct 2018 16:49:13 -0400 Subject: [PATCH 1/3] Fix for submitting challenge / requestion appeal --- packages/dapp/src/components/listing/RequestAppeal.tsx | 2 +- packages/dapp/src/components/listing/SubmitChallenge.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/dapp/src/components/listing/RequestAppeal.tsx b/packages/dapp/src/components/listing/RequestAppeal.tsx index 9dc7409116..84d682bfc1 100644 --- a/packages/dapp/src/components/listing/RequestAppeal.tsx +++ b/packages/dapp/src/components/listing/RequestAppeal.tsx @@ -81,7 +81,7 @@ class RequestAppealComponent extends React.Component { - const stateKey = `appealStatement{key.charAt(0).toUpperCase()}${key.substring(1)}`; + const stateKey = `appealStatement${key.charAt(0).toUpperCase()}${key.substring(1)}`; this.setState(() => ({ [stateKey]: value })); }; diff --git a/packages/dapp/src/components/listing/SubmitChallenge.tsx b/packages/dapp/src/components/listing/SubmitChallenge.tsx index 3292dcfa9d..39220d5efd 100644 --- a/packages/dapp/src/components/listing/SubmitChallenge.tsx +++ b/packages/dapp/src/components/listing/SubmitChallenge.tsx @@ -94,7 +94,7 @@ class SubmitChallengeComponent extends React.Component< } private updateStatement = (key: string, value: any): void => { - const stateKey = `challengeStatement{key.charAt(0).toUpperCase()}${key.substring(1)}`; + const stateKey = `challengeStatement${key.charAt(0).toUpperCase()}${key.substring(1)}`; this.setState(() => ({ [stateKey]: value })); }; From 0d4e37010fc642d30c629151e30759e43be9aeff Mon Sep 17 00:00:00 2001 From: Jon Ferrer Date: Mon, 8 Oct 2018 17:35:11 -0400 Subject: [PATCH 2/3] - Additional key fix for challenge/appeal statements - Redirect user to listing page after successful challenge / appeal request --- .../src/components/listing/RequestAppeal.tsx | 16 +++++++++++++-- .../components/listing/SubmitChallenge.tsx | 20 ++++++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/packages/dapp/src/components/listing/RequestAppeal.tsx b/packages/dapp/src/components/listing/RequestAppeal.tsx index 84d682bfc1..3111d297f1 100644 --- a/packages/dapp/src/components/listing/RequestAppeal.tsx +++ b/packages/dapp/src/components/listing/RequestAppeal.tsx @@ -18,12 +18,14 @@ import { State } from "../../reducers"; export interface RequestAppealPageProps { match: any; + history?: any; } interface RequestAppealProps { listingAddress: EthAddress; listingURI: string; governanceGuideURI: string; + history?: any; } interface RequestAppealReduxProps { @@ -75,16 +77,21 @@ class RequestAppealComponent extends React.Component; } private updateStatement = (key: string, value: any): void => { - const stateKey = `appealStatement${key.charAt(0).toUpperCase()}${key.substring(1)}`; + const stateKey = `appealStatement${key.charAt(0).toUpperCase()}${key.substring(1)}Value`; this.setState(() => ({ [stateKey]: value })); }; + private onSubmitChallengeSuccess = (): void => { + this.props.history.push("/listing/" + this.props.listingAddress); + }; + // Transactions private appeal = async (): Promise> => { const { @@ -173,7 +180,12 @@ const RequestAppealPage: React.SFC = props => { const listingURI = `/listing/${listingAddress}`; const governanceGuideURI = "https://civil.co"; return ( - + ); }; diff --git a/packages/dapp/src/components/listing/SubmitChallenge.tsx b/packages/dapp/src/components/listing/SubmitChallenge.tsx index 39220d5efd..74456c048c 100644 --- a/packages/dapp/src/components/listing/SubmitChallenge.tsx +++ b/packages/dapp/src/components/listing/SubmitChallenge.tsx @@ -18,9 +18,11 @@ import { State } from "../../reducers"; export interface SubmitChallengePageProps { match: any; + history?: any; } interface SubmitChallengeProps { + history?: any; listingAddress: EthAddress; listingURI: string; governanceGuideURI: string; @@ -88,18 +90,25 @@ class SubmitChallengeComponent extends React.Component< updateStatementValue: this.updateStatement, transactions, modalContentComponents, + postExecuteTransactions: this.onSubmitChallengeSuccess, }; return ; } private updateStatement = (key: string, value: any): void => { - const stateKey = `challengeStatement${key.charAt(0).toUpperCase()}${key.substring(1)}`; + const stateKey = `challengeStatement${key.charAt(0).toUpperCase()}${key.substring(1)}Value`; + console.log(stateKey); this.setState(() => ({ [stateKey]: value })); }; + private onSubmitChallengeSuccess = (): void => { + this.props.history.push("/listing/" + this.props.listingAddress); + }; + // Transactions private challenge = async (): Promise> => { + console.log("challenging"); const { challengeStatementSummaryValue, challengeStatementCiteConstitutionValue, @@ -110,6 +119,7 @@ class SubmitChallengeComponent extends React.Component< citeConstitution: challengeStatementCiteConstitutionValue.toString("html"), details: challengeStatementDetailsValue.toString("html"), }; + console.log(this.props.listingAddress, JSON.stringify(jsonToSave)); return challengeListing(this.props.listingAddress, JSON.stringify(jsonToSave)); }; } @@ -164,7 +174,6 @@ const mapStateToProps = ( let revealStageLen = ""; if (parameters && Object.keys(parameters).length) { const civil = getCivil(); - console.log(parameters); minDeposit = getFormattedParameterValue( Parameters.minDeposit, civil.toBigNumber(parameters[Parameters.minDeposit]), @@ -196,7 +205,12 @@ const SubmitChallengePage: React.SFC = props => { const listingURI = `/listing/${listingAddress}`; const governanceGuideURI = "https://civil.co"; return ( - + ); }; From 3fb3b1cc2d31d900a4d2888ad90e7b8d7dcb617a Mon Sep 17 00:00:00 2001 From: Jon Ferrer Date: Mon, 8 Oct 2018 17:43:52 -0400 Subject: [PATCH 3/3] Remove `console.log` statements --- packages/dapp/src/components/listing/SubmitChallenge.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/dapp/src/components/listing/SubmitChallenge.tsx b/packages/dapp/src/components/listing/SubmitChallenge.tsx index 74456c048c..c16a04dcb3 100644 --- a/packages/dapp/src/components/listing/SubmitChallenge.tsx +++ b/packages/dapp/src/components/listing/SubmitChallenge.tsx @@ -98,7 +98,6 @@ class SubmitChallengeComponent extends React.Component< private updateStatement = (key: string, value: any): void => { const stateKey = `challengeStatement${key.charAt(0).toUpperCase()}${key.substring(1)}Value`; - console.log(stateKey); this.setState(() => ({ [stateKey]: value })); }; @@ -108,7 +107,6 @@ class SubmitChallengeComponent extends React.Component< // Transactions private challenge = async (): Promise> => { - console.log("challenging"); const { challengeStatementSummaryValue, challengeStatementCiteConstitutionValue, @@ -119,7 +117,6 @@ class SubmitChallengeComponent extends React.Component< citeConstitution: challengeStatementCiteConstitutionValue.toString("html"), details: challengeStatementDetailsValue.toString("html"), }; - console.log(this.props.listingAddress, JSON.stringify(jsonToSave)); return challengeListing(this.props.listingAddress, JSON.stringify(jsonToSave)); }; }