{proposals.length === 0 ?
- This DAO hasn't passed any proposals yet. Checkout the DAO's installed schemes for any open proposals. :
+ this.state.filteredProposalSet ?
+ No proposals found whose title contains the given text. Note the filter is case-sensitive. :
+ {this.props.daoState.name} hasn't created any proposals yet. Go to the DAO's installed plugins to create proposals. :
+
@@ -77,7 +145,11 @@ class DaoHistoryPage extends React.Component {
- {proposalsHTML}
+
}
@@ -85,6 +157,8 @@ class DaoHistoryPage extends React.Component {
);
+
+ return result;
}
}
@@ -103,11 +177,12 @@ export default withSubscription({
// with all separate queries for votes and stakes and stuff...
let voterClause = "";
let stakerClause = "";
+
if (props.currentAccountAddress) {
voterClause = `(where: { voter: "${props.currentAccountAddress}"})`;
stakerClause = `(where: { staker: "${props.currentAccountAddress}"})`;
-
}
+
const prefetchQuery = gql`
query prefetchProposalDataForDAOHistory {
proposals (
@@ -117,12 +192,6 @@ export default withSubscription({
orderDirection: "desc"
where: {
dao: "${dao.id}"
- stage_in: [
- "${IProposalStage[IProposalStage.ExpiredInQueue]}",
- "${IProposalStage[IProposalStage.Executed]}",
- "${IProposalStage[IProposalStage.Queued]}"
- ]
- closingAt_lte: "${Math.floor(new Date().getTime() / 1000)}"
}
){
...ProposalFields
@@ -139,20 +208,10 @@ export default withSubscription({
${Stake.fragments.StakeFields}
${Scheme.fragments.SchemeFields}
`;
+
await arc.getObservable(prefetchQuery, { subscribe: true }).pipe(first()).toPromise();
- return dao.proposals({
- where: {
- // eslint-disable-next-line @typescript-eslint/camelcase
- stage_in: [IProposalStage.ExpiredInQueue, IProposalStage.Executed, IProposalStage.Queued],
- // eslint-disable-next-line @typescript-eslint/camelcase
- closingAt_lte: Math.floor(new Date().getTime() / 1000),
- },
- orderBy: "closingAt",
- orderDirection: "desc",
- first: PAGE_SIZE,
- skip: 0,
- }, { fetchAllData: true } // get and subscribe to all data, so that subcomponents do nto have to send separate queries
- );
+
+ return proposalsQuery(dao, 0);
},
// used for hacky pagination tracking
@@ -160,18 +219,6 @@ export default withSubscription({
getFetchMoreObservable: (props: IExternalProps, data: SubscriptionData) => {
const dao = props.daoState.dao;
- return dao.proposals({
- where: {
- // eslint-disable-next-line @typescript-eslint/camelcase
- stage_in: [IProposalStage.ExpiredInQueue, IProposalStage.Executed, IProposalStage.Queued],
- // eslint-disable-next-line @typescript-eslint/camelcase
- closingAt_lte: Math.floor(new Date().getTime() / 1000),
- },
- orderBy: "closingAt",
- orderDirection: "desc",
- first: PAGE_SIZE,
- skip: data.length,
- }, { fetchAllData: true } // get and subscribe to all data, so that subcomponents do nto have to send separate queries
- );
+ return proposalsQuery(dao, data.length);
},
});
diff --git a/src/components/Daos/DaosPage.tsx b/src/components/Daos/DaosPage.tsx
index 5e75be5f8..548f28b74 100644
--- a/src/components/Daos/DaosPage.tsx
+++ b/src/components/Daos/DaosPage.tsx
@@ -183,7 +183,9 @@ class DaosPage extends React.Component {
diff --git a/src/components/Proposal/Staking/StakeButtons.tsx b/src/components/Proposal/Staking/StakeButtons.tsx
index 08c8187bc..a1af50126 100644
--- a/src/components/Proposal/Staking/StakeButtons.tsx
+++ b/src/components/Proposal/Staking/StakeButtons.tsx
@@ -28,7 +28,7 @@ interface IExternalProps {
beneficiaryProfile?: IProfileState;
contextMenu?: boolean;
currentAccountAddress?: Address;
- currentAccountGens: BN|null;
+ currentAccountGens: BN | null;
currentAccountGenStakingAllowance: BN;
dao: IDAOState;
expired?: boolean;
@@ -77,7 +77,7 @@ class StakeButtons extends React.Component {
}
public showPreStakeModal = (prediction: number): (_event: any) => void => async (_event: any): Promise => {
- if (!await enableWalletProvider( { showNotification: this.props.showNotification })) { return; }
+ if (!await enableWalletProvider({ showNotification: this.props.showNotification })) { return; }
this.setState({ pendingPrediction: prediction, showPreStakeModal: true });
}
@@ -86,7 +86,7 @@ class StakeButtons extends React.Component {
}
public handleClickPreApprove = async (_event: any): Promise => {
- if (!await enableWalletProvider( { showNotification: this.props.showNotification })) { return; }
+ if (!await enableWalletProvider({ showNotification: this.props.showNotification })) { return; }
const { approveStakingGens } = this.props;
approveStakingGens(this.props.proposal.votingMachine);
@@ -177,9 +177,10 @@ class StakeButtons extends React.Component {
(proposal.stage === IProposalStage.PreBoosted);
const disabledMessage =
- (proposal.stage === IProposalStage.Queued && expired) || proposal.stage === IProposalStage.ExpiredInQueue ? "Can't predict on expired proposals" :
- (proposal.stage === IProposalStage.Boosted || proposal.stage === IProposalStage.QuietEndingPeriod) ? "Can't predict on boosted proposals" :
- (proposal.stage === IProposalStage.Executed) ? `Can't predict on ${proposal.winningOutcome === IProposalOutcome.Pass ? "passed" : "failed"} proposals` : "";
+ (proposal.stage !== IProposalStage.Executed) ?
+ ((proposal.stage === IProposalStage.Queued && expired) || proposal.stage === IProposalStage.ExpiredInQueue ? "Can't predict on expired proposals" :
+ (proposal.stage === IProposalStage.Boosted || proposal.stage === IProposalStage.QuietEndingPeriod) ? "Can't predict on boosted proposals" : "")
+ : "";
const hasGens = currentAccountGens && currentAccountGens.gt(new BN(0));
@@ -206,13 +207,13 @@ class StakeButtons extends React.Component {
const passButton = (
);
const failButton = (
);
diff --git a/src/components/Proposal/Voting/VoteButtons.tsx b/src/components/Proposal/Voting/VoteButtons.tsx
index e72e3e8a6..5fa7d5404 100644
--- a/src/components/Proposal/Voting/VoteButtons.tsx
+++ b/src/components/Proposal/Voting/VoteButtons.tsx
@@ -19,7 +19,7 @@ interface IExternalProps {
contextMenu?: boolean;
currentAccountAddress: Address;
currentAccountState: IMemberState;
- currentVote: IProposalOutcome|undefined;
+ currentVote: IProposalOutcome | undefined;
dao: IDAOState;
expired?: boolean;
parentPage: Page;
@@ -35,7 +35,7 @@ type IProps = IExternalProps & IDispatchProps;
interface IState {
contextMenu?: boolean;
- currentVote: IProposalOutcome|undefined;
+ currentVote: IProposalOutcome | undefined;
showPreVoteModal: boolean;
}
@@ -96,48 +96,48 @@ class VoteButtons extends React.Component {
} = this.props;
const votingDisabled = proposal.stage === IProposalStage.ExpiredInQueue ||
- proposal.stage === IProposalStage.Executed ||
- (proposal.stage === IProposalStage.Queued && expired) ||
- (proposal.stage === IProposalStage.Boosted && expired) ||
- (proposal.stage === IProposalStage.QuietEndingPeriod && expired) ||
- (currentAccountState && currentAccountState.reputation.eq(new BN(0))) ||
- (currentAccountState && (proposal.createdAt < currentAccountState.createdAt) &&
- //this is a workaround till https://github.com/daostack/subgraph/issues/548
- (targetedNetwork() !== "ganache")) ||
- currentVote === IProposalOutcome.Pass ||
- currentVote === IProposalOutcome.Fail
- ;
+ proposal.stage === IProposalStage.Executed ||
+ (proposal.stage === IProposalStage.Queued && expired) ||
+ (proposal.stage === IProposalStage.Boosted && expired) ||
+ (proposal.stage === IProposalStage.QuietEndingPeriod && expired) ||
+ (currentAccountState && currentAccountState.reputation.eq(new BN(0))) ||
+ (currentAccountState && (proposal.createdAt < currentAccountState.createdAt) &&
+ //this is a workaround till https://github.com/daostack/subgraph/issues/548
+ (targetedNetwork() !== "ganache")) ||
+ currentVote === IProposalOutcome.Pass ||
+ currentVote === IProposalOutcome.Fail
+ ;
/**
* only used when votingDisabled
*/
const disabledMessage =
- ((currentVote === IProposalOutcome.Pass) || (currentVote === IProposalOutcome.Fail)) ?
- "Can't change your vote" :
- (currentAccountState && currentAccountState.reputation.eq(new BN(0))) ?
- "Requires reputation in this DAO" :
- /**
- * The following condition deduces that the user could not have had rep when the
- * proposal was created because of the following behavior in the subgraph:
- *
- * 1) `currentAccountState` (`ReputationHolder` in the subgraph) represents an entity that associates
- * a single DAO with an ethereum account
- * 2) currentAccountState can only exist in the subgraph when the account has > 0 rep in the DAO
- * 3) `currentAccountState.createdAt` is set only once: When currentAccountState is being instantiated
- * for the first time, in response to a Mint event that brings the rep > 0
- * 4) when a Burn event brings the rep <= 0, then the entity is removed from the subgraph
- * 5) when `currentAccount` is not found in the subgraph, then a fake `currentAccountState` is created with
- * rep == 0
- */
- (currentAccountState && (proposal.createdAt < currentAccountState.createdAt)) ?
- "Must have had reputation in this DAO when the proposal was created" :
- proposal.stage === IProposalStage.ExpiredInQueue ||
+ (proposal.stage !== IProposalStage.Executed) ?
+ (((currentVote === IProposalOutcome.Pass) || (currentVote === IProposalOutcome.Fail)) ?
+ "Can't change your vote" :
+ (currentAccountState && currentAccountState.reputation.eq(new BN(0))) ?
+ "Requires reputation in this DAO" :
+ /**
+ * The following condition deduces that the user could not have had rep when the
+ * proposal was created because of the following behavior in the subgraph:
+ *
+ * 1) `currentAccountState` (`ReputationHolder` in the subgraph) represents an entity that associates
+ * a single DAO with an ethereum account
+ * 2) currentAccountState can only exist in the subgraph when the account has > 0 rep in the DAO
+ * 3) `currentAccountState.createdAt` is set only once: When currentAccountState is being instantiated
+ * for the first time, in response to a Mint event that brings the rep > 0
+ * 4) when a Burn event brings the rep <= 0, then the entity is removed from the subgraph
+ * 5) when `currentAccount` is not found in the subgraph, then a fake `currentAccountState` is created with
+ * rep == 0
+ */
+ (currentAccountState && (proposal.createdAt < currentAccountState.createdAt)) ?
+ "Must have had reputation in this DAO when the proposal was created" :
+ proposal.stage === IProposalStage.ExpiredInQueue ||
(proposal.stage === IProposalStage.Boosted && expired) ||
(proposal.stage === IProposalStage.QuietEndingPeriod && expired) ||
(proposal.stage === IProposalStage.Queued && expired) ?
- "Can't vote on expired proposals" :
- proposal.stage === IProposalStage.Executed ?
- `Can't vote on ${proposal.winningOutcome === IProposalOutcome.Pass ? "passed" : "failed"} proposals` : "";
+ "Can't vote on expired proposals" : "")
+ : "";
const voteUpButtonClass = classNames({
[css.votedFor]: currentVote === IProposalOutcome.Pass,
@@ -177,10 +177,10 @@ class VoteButtons extends React.Component {
- You voted
+ You voted
- Vote
+ Vote
@@ -188,13 +188,13 @@ class VoteButtons extends React.Component {
-
-
+
+
For
-
-
+
+
Against
@@ -204,18 +204,18 @@ class VoteButtons extends React.Component {
:
- {disabledMessage}
+ {disabledMessage}
}
@@ -228,12 +228,12 @@ class VoteButtons extends React.Component {
@@ -245,12 +245,12 @@ class VoteButtons extends React.Component {
- You voted
+ You voted
- - For
+ - For
- - Against
+ - Against