diff --git a/instances/treasury-devdao.near/widget/components/DropDown.jsx b/instances/treasury-devdao.near/widget/components/DropDown.jsx index 48fafee6..7ea4b27f 100644 --- a/instances/treasury-devdao.near/widget/components/DropDown.jsx +++ b/instances/treasury-devdao.near/widget/components/DropDown.jsx @@ -49,6 +49,7 @@ return ( type="button" data-bs-toggle="dropdown" aria-expanded="false" + data-testid="dropdown-btn" > {selected.label} diff --git a/instances/treasury-devdao.near/widget/pages/settings/Thresholds.jsx b/instances/treasury-devdao.near/widget/pages/settings/Thresholds.jsx index 521a1553..a6ed9009 100644 --- a/instances/treasury-devdao.near/widget/pages/settings/Thresholds.jsx +++ b/instances/treasury-devdao.near/widget/pages/settings/Thresholds.jsx @@ -10,6 +10,9 @@ const { href } = VM.require("${REPL_DEVHUB}/widget/core.lib.url") || { href: () => {}, }; +if (typeof getRoleWiseData !== "function") { + return <>>; +} const [selectedGroup, setSelectedGroup] = useState(null); const [selectedVoteOption, setSelectedVoteOption] = useState(null); const [selectedVoteValue, setSelectedVoteValue] = useState(null); @@ -31,7 +34,7 @@ const hasCreatePermission = hasPermission( ); useEffect(() => { - if (Array.isArray(rolesData) && rolesData.length && !selectedGroup) { + if (Array.isArray(rolesData) && rolesData.length) { setSelectedGroup(rolesData[0]); } }, [rolesData]); @@ -57,9 +60,10 @@ function getLastProposalId() { } useEffect(() => { - if (typeof getRoleWiseData === "function") { - getRoleWiseData(treasuryDaoID).then((resp) => setRolesData(resp)); - } + setRolesData([]); + getRoleWiseData(treasuryDaoID).then((resp) => { + setRolesData(resp); + }); }, [refreshData]); useEffect(() => { @@ -73,11 +77,16 @@ function checkProposalStatus(proposalId) { Near.asyncView(treasuryDaoID, "get_proposal", { id: proposalId, }).then((result) => { - if (result.status === "Approved") { - setRefreshData(!refreshData); + if (Object.keys(result.votes).length === 1) { + if (result.status === "Approved") { + setRefreshData(!refreshData); + } + setToastStatus(result.status); + setVoteProposalId(proposalId); + setTxnCreated(false); + } else { + setTimeout(() => checkProposalStatus(proposalId), 1000); } - setToastStatus(result.status); - setVoteProposalId(proposalId); }); } @@ -230,7 +239,7 @@ function updateDaoPolicy() { weight_kind: "RoleWeight", quorum: "0", threshold: isPercentageSelected - ? [selectedVoteValue, 100] + ? [parseInt(selectedVoteValue), 100] : selectedVoteValue, }; return policy; @@ -350,7 +359,7 @@ return ( instance, heading: "Are you sure?", content: ( -