-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve preboostable logic, feedback and layout #1482
Changes from 2 commits
76ac353
42bd1d7
a4440a1
dcb7137
05a67d1
884b068
8f69db1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { IProposalStage, IProposalState } from "@daostack/client"; | ||
|
||
import BN = require("bn.js"); | ||
import classNames from "classnames"; | ||
import { formatTokens } from "lib/util"; | ||
import * as React from "react"; | ||
|
@@ -26,32 +25,34 @@ export default class BoostAmount extends React.Component<IProps, null> { | |
[css.wrapper]: true, | ||
[css.detailView]: detailView, | ||
}); | ||
const nothing = <span className={css.boostedAmount}><b> </b></span>; | ||
|
||
return ( | ||
<div className={wrapperClass}> | ||
{ | ||
proposal.stage === IProposalStage.Queued && !expired && proposal.upstakeNeededToPreBoost.gte(new BN(0)) ? | ||
!expired ? ((proposal.stage === IProposalStage.Queued && proposal.upstakeNeededToPreBoost.gten(0)) ? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think this is right, cant you still boost/unboost a pre-boosted proposal that is expired? or do we want to turn that off There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was misinterpreting what "expired" meant (forgetting that it often means expired only within the context of the current phase, but not necessarily that the proposal is dead, and not necessarily that the expired state is even represented yet in the blockchain). So good catch. I have reverted the change. |
||
<span className={css.boostedAmount}> | ||
<b> | ||
{detailView ? <img src="/assets/images/Icon/Boost-slate.svg" /> : ""} | ||
> {formatTokens(proposal.upstakeNeededToPreBoost, "GEN")} to boost | ||
> {formatTokens(proposal.upstakeNeededToPreBoost, "GEN")} on Pass to boost | ||
</b> | ||
</span> | ||
: proposal.stage === IProposalStage.PreBoosted && proposal.downStakeNeededToQueue.lte(new BN(0)) ? | ||
: proposal.stage === IProposalStage.PreBoosted && proposal.downStakeNeededToQueue.lten(0) ? | ||
<span className={css.boostedAmount}> | ||
<b> | ||
{detailView ? <img src="/assets/images/Icon/Boost-slate.svg" /> : ""} | ||
> {formatTokens(proposal.downStakeNeededToQueue.abs(), "GEN")} Pass to stay boosted | ||
> {formatTokens(proposal.downStakeNeededToQueue.abs(), "GEN")} on Pass to stay boosted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this fit? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
</b> | ||
</span> | ||
: proposal.stage === IProposalStage.PreBoosted && proposal.downStakeNeededToQueue.gt(new BN(0)) ? | ||
: proposal.stage === IProposalStage.PreBoosted && proposal.downStakeNeededToQueue.gtn(0) ? | ||
<span className={css.boostedAmount + " " + css.unboostAmount}> | ||
<b> | ||
{detailView ? <img src="/assets/images/Icon/Boost-slate.svg" /> : ""} | ||
{formatTokens(proposal.downStakeNeededToQueue, "GEN")} on Fail to un-boost | ||
>= {formatTokens(proposal.downStakeNeededToQueue, "GEN")} on Fail to un-boost | ||
</b> | ||
</span> | ||
: <span className={css.boostedAmount}><b> </b></span> | ||
: nothing | ||
) : nothing | ||
} | ||
</div> | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure this works? didn't use to, maybe they fixed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has always worked for me. testing the functionality seems to work