Skip to content

Commit

Permalink
Merge pull request #503 from joincivil/am9u/dapp/playtest-fixes
Browse files Browse the repository at this point in the history
Fixes for Submit Challenge / Request Appeal
  • Loading branch information
am9u committed Oct 8, 2018
2 parents 6e764e9 + 3fb3b1c commit ed66555
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
16 changes: 14 additions & 2 deletions packages/dapp/src/components/listing/RequestAppeal.tsx
Expand Up @@ -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 {
Expand Down Expand Up @@ -75,16 +77,21 @@ class RequestAppealComponent extends React.Component<RequestAppealProps & Reques
updateStatementValue: this.updateStatement,
transactions,
modalContentComponents,
postExecuteTransactions: this.onSubmitChallengeSuccess,
};

return <RequestAppealStatementComponent {...props} />;
}

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<TwoStepEthTransaction<any>> => {
const {
Expand Down Expand Up @@ -173,7 +180,12 @@ const RequestAppealPage: React.SFC<RequestAppealPageProps> = props => {
const listingURI = `/listing/${listingAddress}`;
const governanceGuideURI = "https://civil.co";
return (
<RequestAppeal listingAddress={listingAddress} listingURI={listingURI} governanceGuideURI={governanceGuideURI} />
<RequestAppeal
listingAddress={listingAddress}
listingURI={listingURI}
governanceGuideURI={governanceGuideURI}
history={props.history}
/>
);
};

Expand Down
17 changes: 14 additions & 3 deletions packages/dapp/src/components/listing/SubmitChallenge.tsx
Expand Up @@ -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;
Expand Down Expand Up @@ -88,16 +90,21 @@ class SubmitChallengeComponent extends React.Component<
updateStatementValue: this.updateStatement,
transactions,
modalContentComponents,
postExecuteTransactions: this.onSubmitChallengeSuccess,
};

return <SubmitChallengeStatementComponent {...props} />;
}

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`;
this.setState(() => ({ [stateKey]: value }));
};

private onSubmitChallengeSuccess = (): void => {
this.props.history.push("/listing/" + this.props.listingAddress);
};

// Transactions
private challenge = async (): Promise<TwoStepEthTransaction<any>> => {
const {
Expand Down Expand Up @@ -164,7 +171,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]),
Expand Down Expand Up @@ -196,7 +202,12 @@ const SubmitChallengePage: React.SFC<SubmitChallengePageProps> = props => {
const listingURI = `/listing/${listingAddress}`;
const governanceGuideURI = "https://civil.co";
return (
<SubmitChallenge listingAddress={listingAddress} listingURI={listingURI} governanceGuideURI={governanceGuideURI} />
<SubmitChallenge
listingAddress={listingAddress}
listingURI={listingURI}
governanceGuideURI={governanceGuideURI}
history={props.history}
/>
);
};

Expand Down

0 comments on commit ed66555

Please sign in to comment.