- Voting on multiple proposals
-
- {Object.keys(STORAGE[daoId] || {})
- .map((id) => parseInt(id))
- .map(
- (id) =>
- "#" + id + ": " + indexToVote(STORAGE[daoId][id])
- )
- .reverse()
- .join(", ")}
-
-
- {
- onHideMultiSelect();
- },
- variant: "secondary outline",
- className: "me-auto"
- }}
- />
- {
- Storage.set(STORAGE_KEY, {});
- },
- variant: "secondary outline"
- }}
- />
- {
- handleSubmit();
- },
- variant: "secondary"
- }}
- />
-
-
- );
+ } else {
+ args["id"] = parseInt(id);
+ if (isCongressDaoID) {
+ args["vote"] = vote.replace("Vote", "");
+ } else {
+ args["action"] = vote;
+ }
+ calls.push({
+ contractName: daoId,
+ methodName: isCongressDaoID ? "vote" : "act_proposal",
+ args: args,
+ gas: 270000000000000
+ });
+ }
+ });
+ return Near.call(calls);
+ };
+
+ let Wrapper = styled.div`
+ position: fixed;
+ bottom: 12px;
+ left: 50%;
+ transform: translateX(-50%);
+ min-width: 500px;
+ max-width: 100vw;
+ background-color: #fff;
+ `;
+
+ const indexToVote = (i) => {
+ if (i === "0") return "Yes";
+ if (i === "1") return "No";
+ if (i === "2")
+ return isCongressDaoID || isVotingBodyDao ? "Abstain" : "Spam";
+ if (i === "2") return "Spam";
+ };
+ return (
+
+ Voting on multiple proposals
+
+ {Object.keys(STORAGE[daoId] || {})
+ .map((id) => parseInt(id))
+ .map((id) => "#" + id + ": " + indexToVote(STORAGE[daoId][id]))
+ .reverse()
+ .join(", ")}
+
+
+ {
+ onHideMultiSelect();
+ },
+ variant: "secondary outline",
+ className: "me-auto"
+ }}
+ />
+ {
+ Storage.set(STORAGE_KEY, {});
+ },
+ variant: "secondary outline"
+ }}
+ />
+ {
+ handleSubmit();
+ },
+ variant: "secondary"
+ }}
+ />
+
+
+ );
}
const proposal = props.proposal;
@@ -154,107 +149,107 @@ const canVote = props.canVote;
const selectedVote = STORAGE[daoId][proposal.id];
const handleClick = (e) => {
- const [proposalId, vote] = e.target.value.split(",");
-
- // using Storage.privateSet instead of State to avoid re-rendering everything
- // using daoId as key so that the storage doesn't grow indefinitely
- Storage.set(STORAGE_KEY, {
- [daoId]: {
- ...STORAGE[daoId],
- [proposalId]: vote
- }
- });
+ const [proposalId, vote] = e.target.value.split(",");
+
+ // using Storage.privateSet instead of State to avoid re-rendering everything
+ // using daoId as key so that the storage doesn't grow indefinitely
+ Storage.set(STORAGE_KEY, {
+ [daoId]: {
+ ...STORAGE[daoId],
+ [proposalId]: vote
+ }
+ });
};
const Wrapper = styled.div`
- .form-check {
- padding: 6px 14px;
- border-radius: 16px;
- color: #000;
- display: flex;
- align-items: center;
- gap: 6px;
- margin-bottom: 6px;
- cursor: pointer;
-
- &.disabled {
- cursor: not-allowed !important;
- opacity: 0.7;
-
- span {
- cursor: not-allowed !important;
- }
- }
+ .form-check {
+ padding: 6px 14px;
+ border-radius: 16px;
+ color: #000;
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin-bottom: 6px;
+ cursor: pointer;
+
+ &.disabled {
+ cursor: not-allowed !important;
+ opacity: 0.7;
+
+ span {
+ cursor: not-allowed !important;
+ }
+ }
- input {
- margin: 0 !important;
- }
+ input {
+ margin: 0 !important;
+ }
- span {
- flex: 1;
- font-weight: 600;
- cursor: pointer;
- }
+ span {
+ flex: 1;
+ font-weight: 600;
+ cursor: pointer;
+ }
- &:first-child {
- background-color: #82e29930;
+ &:first-child {
+ background-color: #82e29930;
- &.active {
- background-color: #82e299;
- }
- }
- &:nth-child(2) {
- background-color: #ff646430;
+ &.active {
+ background-color: #82e299;
+ }
+ }
+ &:nth-child(2) {
+ background-color: #ff646430;
- &.active {
- background-color: #ff6464;
- }
- }
- &:nth-child(3) {
- background-color: #ffd50d30;
+ &.active {
+ background-color: #ff6464;
+ }
+ }
+ &:nth-child(3) {
+ background-color: #ffd50d30;
- &.active {
- background-color: #ffd50d;
- }
- }
- &:nth-child(4) {
- background-color: #edeef5;
+ &.active {
+ background-color: #ffd50d;
+ }
+ }
+ &:nth-child(4) {
+ background-color: #edeef5;
- &.active {
- background-color: #c5c6d0;
- }
- }
+ &.active {
+ background-color: #c5c6d0;
+ }
}
+ }
`;
const allowedMethods = isVotingBodyDao
- ? ["Yes", "No", "Abstain", "Spam"]
- : isCongressDaoID
- ? ["Yes", "No", "Abstain"]
- : ["Yes", "No", "Spam"];
+ ? ["Yes", "No", "Abstain", "Spam"]
+ : isCongressDaoID
+ ? ["Yes", "No", "Abstain"]
+ : ["Yes", "No", "Spam"];
return (
-