Skip to content

Commit

Permalink
fix daoID
Browse files Browse the repository at this point in the history
  • Loading branch information
Megha-Dev-19 committed Feb 9, 2024
1 parent 12b9387 commit 0497d71
Showing 1 changed file with 50 additions and 52 deletions.
102 changes: 50 additions & 52 deletions apps/astraplusplus/widget/DAO/Proposals/CardsList.jsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,56 @@
const {
proposals,
resPerPage,
state,
update,
isCongressDaoID,
daoConfig,
isVotingBodyDao
proposals,
resPerPage,
state,
update,
isCongressDaoID,
daoConfig,
isVotingBodyDao
} = props;

return (
<div>
{proposals === null && state.multiSelectMode && (
<>
{new Array(resPerPage).fill(0).map((_, i) => (
<Widget src="astraplusplus.ndctools.near/widget/DAO.Proposals.Card.skeleton" />
))}
</>
)}
{proposals !== null &&
proposals.map(({ proposal, proposal_type, proposal_id }, i) => {
if (!isCongressDaoID && !isVotingBodyDao) {
proposal.kind = {
[proposal_type]: {
...proposal.kind
}
};
}
<div>
{proposals === null && state.multiSelectMode && (
<>
{new Array(resPerPage).fill(0).map((_, i) => (
<Widget src="astraplusplus.ndctools.near/widget/DAO.Proposals.Card.skeleton" />
))}
</>
)}
{proposals !== null &&
proposals.map(({ proposal, proposal_type, proposal_id, dao_id }, i) => {
if (!isCongressDaoID && !isVotingBodyDao) {
proposal.kind = {
[proposal_type]: {
...proposal.kind
}
};
}

proposal.id = proposal_id;
if (proposal.status === "Removed") return <></>;
Object.keys(proposal.vote_counts).forEach((k) => {
if (typeof proposal.vote_counts[k] == "string") {
proposal.vote_counts[k] = proposal.vote_counts[k]
.match(/.{1,2}/g)
.map((x) => parseInt(x));
}
});
return (
<Widget
key={i}
src={
"astraplusplus.ndctools.near/widget/DAO.Proposals.Card.index"
}
props={{
daoId: state.daoId,
proposalString: JSON.stringify(proposal),
multiSelectMode: state.multiSelectMode,
isCongressDaoID,
isVotingBodyDao,
daoConfig,
dev: props.dev
}}
/>
);
})}
</div>
proposal.id = proposal_id;
if (proposal.status === "Removed") return <></>;
Object.keys(proposal.vote_counts).forEach((k) => {
if (typeof proposal.vote_counts[k] == "string") {
proposal.vote_counts[k] = proposal.vote_counts[k]
.match(/.{1,2}/g)
.map((x) => parseInt(x));
}
});
return (
<Widget
key={i}
src={"astraplusplus.ndctools.near/widget/DAO.Proposals.Card.index"}
props={{
daoId: state.daoId ?? dao_id,
proposalString: JSON.stringify(proposal),
multiSelectMode: state.multiSelectMode,
isCongressDaoID,
isVotingBodyDao,
daoConfig,
dev: props.dev
}}
/>
);
})}
</div>
);

0 comments on commit 0497d71

Please sign in to comment.