Skip to content

Commit

Permalink
Add Paramterization Proposal page view
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Ferrer committed May 21, 2018
1 parent c4e7d1f commit 10e92b8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/dapp/src/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Listing from "./listing/Listing";
import Editor from "./Editor";
import NewsroomManagement from "./newsroom/NewsroomManagement";
import Parameterizer from "./Parameterizer";
import ParameterizerProposal from "./parameterizer/Proposal";
import CreateNewsroom from "./CreateNewsroom";
import Article from "./Article";
import { getCivil } from "../helpers/civilInstance";
Expand Down Expand Up @@ -35,6 +36,7 @@ class Main extends React.Component<DispatchProp<any> & RouteComponentProps<any>>
<Route path="/listing/:listing" component={Listing} />
<Route path="/editor" component={Editor} />
<Route path="/mgmt/:newsroomAddress" component={NewsroomManagement} />
<Route path="/parameterizer/proposal/:propId" component={ParameterizerProposal} />
<Route path="/parameterizer" component={Parameterizer} />
<Route path="/createNewsroom" component={CreateNewsroom} />
<Route path="/article/:newsroomAddress/:articleId" component={Article} />
Expand Down
51 changes: 51 additions & 0 deletions packages/dapp/src/components/parameterizer/Proposal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import * as React from "react";
import { connect } from "react-redux";
import { State } from "../../reducers";
import { PageView, ViewModule, ViewModuleHeader } from "../utility/ViewModules";
import { Link } from "react-router-dom";

export interface ProposalPageProps {
match: any;
}

export interface ProposalReduxProps {
proposal: any;
error: any;
}

class Proposal extends React.Component<ProposalPageProps & ProposalReduxProps> {
public render(): JSX.Element {
return (
<PageView>
<ViewModule>
<Link to="/parameterizer">&laquo; Back to Parameterizer</Link>
<ViewModuleHeader>Parameterizer Proposal</ViewModuleHeader>
{this.props.proposal && (
<dl>
<dt>Parameter Name</dt>
<dd>{this.props.proposal.paramName}</dd>
<dt>New Value</dt>
<dd>{this.props.proposal.propValue.toString()}</dd>
</dl>
)}
{!this.props.proposal && this.renderProposalNotFound()}
</ViewModule>
</PageView>
);
}

private renderProposalNotFound = (): JSX.Element => {
return <>Proposal Not Found</>;
};
}

const mapStateToProps = (state: State, ownProps: ProposalPageProps): ProposalReduxProps => {
const { proposals } = state;

return {
proposal: proposals.get(ownProps.match.params.propId),
error: undefined,
};
};

export default connect(mapStateToProps)(Proposal);

0 comments on commit 10e92b8

Please sign in to comment.