Skip to content

Commit

Permalink
voting terminal taking in pluginType
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricevladimir committed Oct 25, 2023
1 parent e08e60a commit 74e6779
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 38 deletions.
27 changes: 15 additions & 12 deletions src/containers/reviewProposal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,21 @@ const ReviewProposal: React.FC<ReviewProposalProps> = ({
)}
/>

<VotingTerminal
breakdownTabDisabled
votersTabDisabled
voteNowDisabled
selectedTab="info"
statusLabel={t('votingTerminal.status.draft')}
startDate={formattedStartDate}
endDate={formattedEndDate}
preciseEndDate={formattedPreciseEndDate}
daoToken={daoToken}
{...terminalProps}
/>
{votingSettings && (
<VotingTerminal
pluginType={pluginType}
breakdownTabDisabled
votersTabDisabled
voteNowDisabled
selectedTab="info"
statusLabel={t('votingTerminal.status.draft')}
startDate={formattedStartDate}
endDate={formattedEndDate}
preciseEndDate={formattedPreciseEndDate}
daoToken={daoToken}
{...terminalProps}
/>
)}

<ExecutionWidget
actions={getNonEmptyActions(
Expand Down
6 changes: 5 additions & 1 deletion src/containers/votingTerminal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {CHAIN_METADATA} from 'utils/constants';
import {Web3Address, shortenAddress} from 'utils/library';
import BreakdownTab from './breakdownTab';
import InfoTab from './infoTab';
import {PluginTypes} from 'hooks/usePluginClient';

export type ProposalVoteResults = {
yes: {value: string | number; percentage: number};
Expand Down Expand Up @@ -70,6 +71,7 @@ export type VotingTerminalProps = {
alertMessage?: string;
selectedTab?: TerminalTabs;
onTabSelected?: React.Dispatch<React.SetStateAction<TerminalTabs>>;
pluginType: PluginTypes;
executableWithNextApproval?: boolean;
};

Expand Down Expand Up @@ -103,6 +105,7 @@ export const VotingTerminal: React.FC<VotingTerminalProps> = ({
alertMessage,
selectedTab = 'info',
onTabSelected,
pluginType,
executableWithNextApproval = false,
}) => {
const [page, setPage] = useState(1);
Expand All @@ -114,7 +117,8 @@ export const VotingTerminal: React.FC<VotingTerminalProps> = ({
const {network} = useNetwork();
const fetchPastVotingPower = usePastVotingPowerAsync();

const isMultisigProposal = !!approvals && !!minApproval;
const isMultisigProposal =
pluginType === 'multisig.plugin.dao.eth' && !!approvals && !!minApproval;

useEffect(() => {
// fetch avatar fpr each voter
Expand Down
53 changes: 28 additions & 25 deletions src/pages/proposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -693,31 +693,34 @@ export const Proposal: React.FC = () => {
/>
)}

<VotingTerminal
status={proposalStatus}
daoToken={daoToken}
blockNumber={proposal.creationBlockNumber}
statusLabel={voteStatus}
selectedTab={terminalTab}
alertMessage={alertMessage}
onTabSelected={setTerminalTab}
onVoteClicked={handleVoteClick}
onApprovalClicked={handleApprovalClick}
onCancelClicked={() => setVotingInProcess(false)}
voteButtonLabel={voteButtonLabel}
voteNowDisabled={votingDisabled}
votingInProcess={votingInProcess}
executableWithNextApproval={executableWithNextApproval}
onVoteSubmitClicked={vote =>
handlePrepareVote({
vote,
replacement: voted || voteOrApprovalSubmitted,
voteTokenAddress: (proposal as TokenVotingProposal).token
?.address,
})
}
{...mappedProps}
/>
{votingSettings && (
<VotingTerminal
status={proposalStatus}
pluginType={pluginType}
daoToken={daoToken}
blockNumber={proposal.creationBlockNumber}
statusLabel={voteStatus}
selectedTab={terminalTab}
alertMessage={alertMessage}
onTabSelected={setTerminalTab}
onVoteClicked={handleVoteClick}
onApprovalClicked={handleApprovalClick}
onCancelClicked={() => setVotingInProcess(false)}
voteButtonLabel={voteButtonLabel}
voteNowDisabled={votingDisabled}
votingInProcess={votingInProcess}
executableWithNextApproval={executableWithNextApproval}
onVoteSubmitClicked={vote =>
handlePrepareVote({
vote,
replacement: voted || voteOrApprovalSubmitted,
voteTokenAddress: (proposal as TokenVotingProposal).token
?.address,
})
}
{...mappedProps}
/>
)}

<ExecutionWidget
pluginType={pluginType}
Expand Down

0 comments on commit 74e6779

Please sign in to comment.