-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Join and FundingRequest proposals (read only) (#2099)
- Loading branch information
Showing
7 changed files
with
181 additions
and
3 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
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
73 changes: 73 additions & 0 deletions
73
src/components/Proposal/ProposalSummary/ProposalSummaryFundingRequest.tsx
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,73 @@ | ||
import { IDAOState, IFundingRequestProposalState } from "@daostack/arc.js"; | ||
import classNames from "classnames"; | ||
import { getNetworkName, linkToEtherScan, fromWei } from "lib/util"; | ||
import * as React from "react"; | ||
import { IProfileState } from "reducers/profilesReducer"; | ||
import i18next from "i18next"; | ||
import * as css from "./ProposalSummary.scss"; | ||
|
||
interface IExternalProps { | ||
beneficiaryProfile?: IProfileState; | ||
detailView?: boolean; | ||
daoState: IDAOState; | ||
proposalState: IFundingRequestProposalState; | ||
transactionModal?: boolean; | ||
} | ||
|
||
interface IState { | ||
network: string; | ||
} | ||
|
||
type IProps = IExternalProps; | ||
|
||
export default class ProposalSummary extends React.Component<IProps, IState> { | ||
|
||
constructor(props: IProps) { | ||
super(props); | ||
this.state = { | ||
network: "", | ||
}; | ||
|
||
} | ||
|
||
public async componentDidMount(): Promise<void> { | ||
this.setState({ network: (await getNetworkName()).toLowerCase() }); | ||
} | ||
|
||
public render(): RenderOutput { | ||
const { proposalState, detailView, transactionModal } = this.props; | ||
const proposalSummaryClass = classNames({ | ||
[css.detailView]: detailView, | ||
[css.transactionModal]: transactionModal, | ||
[css.proposalSummary]: true, | ||
[css.withDetails]: true, | ||
}); | ||
|
||
return ( | ||
<div className={proposalSummaryClass}> | ||
<div> | ||
<span className={css.summaryTitle}> | ||
<a href={linkToEtherScan(proposalState.beneficiary)} target="_blank" rel="noopener noreferrer">{proposalState.name}</a> | ||
</span> | ||
{detailView && | ||
<div className={css.summaryDetails}> | ||
<table><tbody> | ||
<tr> | ||
<th> | ||
{i18next.t("Address")} | ||
<a href={linkToEtherScan(proposalState.beneficiary)} target="_blank" rel="noopener noreferrer"> | ||
<img src="/assets/images/Icon/Link-blue.svg" /> | ||
</a> | ||
</th> | ||
<td>{proposalState.beneficiary}</td> | ||
</tr> | ||
<tr><th>{i18next.t("Amount")}</th><td>{fromWei(proposalState.amount)}</td></tr> | ||
<tr><th>{i18next.t("Amount Redeemed")}:</th><td>{fromWei(proposalState.amountRedeemed)}</td></tr> | ||
</tbody></table> | ||
</div> | ||
} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/components/Proposal/ProposalSummary/ProposalSummaryJoin.tsx
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,74 @@ | ||
import { IDAOState, IJoinProposalState } from "@daostack/arc.js"; | ||
import classNames from "classnames"; | ||
import { getNetworkName, linkToEtherScan, fromWei } from "lib/util"; | ||
import * as React from "react"; | ||
import { IProfileState } from "reducers/profilesReducer"; | ||
import i18next from "i18next"; | ||
import * as css from "./ProposalSummary.scss"; | ||
|
||
interface IExternalProps { | ||
beneficiaryProfile?: IProfileState; | ||
detailView?: boolean; | ||
daoState: IDAOState; | ||
proposalState: IJoinProposalState; | ||
transactionModal?: boolean; | ||
} | ||
|
||
interface IState { | ||
network: string; | ||
} | ||
|
||
type IProps = IExternalProps; | ||
|
||
export default class ProposalSummary extends React.Component<IProps, IState> { | ||
|
||
constructor(props: IProps) { | ||
super(props); | ||
this.state = { | ||
network: "", | ||
}; | ||
|
||
} | ||
|
||
public async componentDidMount(): Promise<void> { | ||
this.setState({ network: (await getNetworkName()).toLowerCase() }); | ||
} | ||
|
||
public render(): RenderOutput { | ||
const { proposalState, detailView, transactionModal } = this.props; | ||
const proposalSummaryClass = classNames({ | ||
[css.detailView]: detailView, | ||
[css.transactionModal]: transactionModal, | ||
[css.proposalSummary]: true, | ||
[css.withDetails]: true, | ||
}); | ||
|
||
return ( | ||
<div className={proposalSummaryClass}> | ||
<div> | ||
<span className={css.summaryTitle}> | ||
<a href={linkToEtherScan(proposalState.name)} target="_blank" rel="noopener noreferrer">{proposalState.name}</a> | ||
</span> | ||
{detailView && | ||
<div className={css.summaryDetails}> | ||
<table><tbody> | ||
<tr> | ||
<th> | ||
{i18next.t("Address")} | ||
<a href={linkToEtherScan(proposalState.proposedMember)} target="_blank" rel="noopener noreferrer"> | ||
<img src="/assets/images/Icon/Link-blue.svg" /> | ||
</a> | ||
</th> | ||
<td>{proposalState.proposedMember}</td> | ||
</tr> | ||
<tr><th>{i18next.t("Funding")}</th><td>{fromWei(proposalState.funding)}</td></tr> | ||
<tr><th>{i18next.t("Reputation Minted")}</th><td>{fromWei(proposalState.reputationMinted)}</td></tr> | ||
<tr><th>{i18next.t("Minimum DAO bounty")}</th><td>{fromWei(proposalState.genesisProtocolParams.minimumDaoBounty)}</td></tr> | ||
</tbody></table> | ||
</div> | ||
} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
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