From ef1a6a8a7e0cd47138e4cca7d41479bce84f08a5 Mon Sep 17 00:00:00 2001 From: chaojun Date: Wed, 4 Sep 2024 17:33:15 +0800 Subject: [PATCH] Show society member check info, #1034 --- next/components/listInfo/details.js | 11 ++-- next/components/postDetail/postInfo.js | 19 +++--- next/components/postDetail/postResults.js | 15 +++-- next/components/postDetail/postVote.js | 70 +++++++++++---------- next/components/postDetail/postVotesItem.js | 23 ++++--- 5 files changed, 78 insertions(+), 60 deletions(-) diff --git a/next/components/listInfo/details.js b/next/components/listInfo/details.js index 56132de6..2ff7c44c 100644 --- a/next/components/listInfo/details.js +++ b/next/components/listInfo/details.js @@ -12,6 +12,7 @@ import { Flex, FlexBetween } from "@osn/common-ui"; import uniq from "lodash.uniq"; import { getSpaceAssets } from "frontedUtils/getSpaceAssets"; import AssetList from "../assetList"; +import { isOnePersonOnVoteOnly } from "frontedUtils/strategy"; const Wrapper = styled.div``; @@ -116,10 +117,12 @@ export default function Details({ space }) { - - Assets({assets.length}) - - + {!isOnePersonOnVoteOnly(space?.weightStrategy) && ( + + Assets({assets.length}) + + + )} ); diff --git a/next/components/postDetail/postInfo.js b/next/components/postDetail/postInfo.js index 25cbf320..ce7522a3 100644 --- a/next/components/postDetail/postInfo.js +++ b/next/components/postDetail/postInfo.js @@ -9,6 +9,7 @@ import Panel from "@/components/postDetail/panel"; import SideSectionTitle from "@/components/sideBar/sideSectionTitle"; import AssetList from "../assetList"; import { getSpaceAssets } from "frontedUtils/getSpaceAssets"; +import { isOnePersonOnVoteOnly } from "frontedUtils/strategy"; const Wrapper = styled(Panel)` > :not(:first-child) { @@ -115,14 +116,16 @@ export default function PostInfo({ data, space }) { )} -
- - - -
+ {!isOnePersonOnVoteOnly(space?.weightStrategy) && ( +
+ + + +
+ )}
diff --git a/next/components/postDetail/postResults.js b/next/components/postDetail/postResults.js index 9aaaa51a..0c7902d7 100644 --- a/next/components/postDetail/postResults.js +++ b/next/components/postDetail/postResults.js @@ -9,6 +9,7 @@ import { VoteItem } from "./strategyResult/common/styled"; import QuorumBalanceOfResult from "./strategyResult/quorumBalanceOfResult"; import QuorumQuadraticBalanceOfResult from "./strategyResult/quorumQuadraticBalanceOfResult"; import OnePersonOneVoteResult from "./strategyResult/onePersonOneVoteResult"; +import { isOnePersonOnVoteOnly } from "frontedUtils/strategy"; export default function PostResult({ data, voteStatus, space }) { const votedAmount = data?.votedWeights?.balanceOf || 0; @@ -81,12 +82,14 @@ export default function PostResult({ data, voteStatus, space }) {
- -
Voted
-
- -
-
+ {!isOnePersonOnVoteOnly(data?.weightStrategy) && ( + +
Voted
+
+ +
+
+ )}
Voters
{data?.votesCount}
diff --git a/next/components/postDetail/postVote.js b/next/components/postDetail/postVote.js index d8b36673..5255650d 100644 --- a/next/components/postDetail/postVote.js +++ b/next/components/postDetail/postVote.js @@ -40,6 +40,8 @@ import { useTerminate } from "./terminate"; import { Tooltip } from "@osn/common-ui"; import VoteBalanceDetail from "./VoteBalanceDetail"; import DelegationInfo from "./delegationInfo"; +import { isOnePersonOnVoteOnly } from "frontedUtils/strategy"; +import SocietyMemberHit from "../postCreate/societyMemberHit"; const Wrapper = styled.div` > :not(:first-child) { @@ -258,39 +260,43 @@ export default function PostVote({ proposal }) { if (!proposalClosed) { let balanceInfo = null; - if (voteDelegation) { - balanceInfo = ( - - ); - } else { - balanceInfo = ( - <> - {!isNil(voteBalance) && ( -
- - ) : null - } - > - {`Available ${toApproximatelyFixed( - bigNumber2Locale( - fromAssetUnit( - voteBalance, - proposal?.networksConfig?.decimals, + if (!isOnePersonOnVoteOnly(proposal?.weightStrategy)) { + if (voteDelegation) { + balanceInfo = ( + + ); + } else { + balanceInfo = ( + <> + {!isNil(voteBalance) && ( +
+ + ) : null + } + > + {`Available ${toApproximatelyFixed( + bigNumber2Locale( + fromAssetUnit( + voteBalance, + proposal?.networksConfig?.decimals, + ), ), - ), - )} ${proposal.networksConfig?.symbol}`} - -
- )} - {belowThreshold && Insufficient} - - ); + )} ${proposal.networksConfig?.symbol}`} +
+
+ )} + {belowThreshold && Insufficient} + + ); + } + } else if (proposal.networksConfig?.accessibility === "society") { + balanceInfo = ; } voteButton = ( diff --git a/next/components/postDetail/postVotesItem.js b/next/components/postDetail/postVotesItem.js index ec5b980a..8d846d4b 100644 --- a/next/components/postDetail/postVotesItem.js +++ b/next/components/postDetail/postVotesItem.js @@ -7,6 +7,7 @@ import Voter from "@/components/role/voter"; import { Tooltip } from "@osn/common-ui"; import VoteBalanceDetail from "./VoteBalanceDetail"; import { isZero } from "frontedUtils"; +import { isOnePersonOnVoteOnly } from "frontedUtils/strategy"; const Item = styled.div` padding: 20px 0; @@ -190,16 +191,18 @@ export default function PostVotesItem({ - - ) : null - } - /> + {!isOnePersonOnVoteOnly(space.strategies) && ( + + ) : null + } + /> + )}