-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Paramterization Proposal page view
- Loading branch information
Jon Ferrer
committed
May 21, 2018
1 parent
c4e7d1f
commit 10e92b8
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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">« 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); |