Skip to content

Commit

Permalink
clean up, typos, and bug fix for empty proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
Jovonni committed May 19, 2024
1 parent c2262e8 commit 1dfb76f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions contract/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ vote:
instance-q:
agd query vstorage data published.agoricNames.instance -o json

start-contract: start-contract-mint start-contract-swap start-contract-pay
start-contract: start-contract-dao

start-contract-mint:
start-contract-dao:
yarn node scripts/deploy-contract.js \
--install src/dao.contract.js \
--eval src/platform-goals/board-aux.core.js \
Expand Down
3 changes: 2 additions & 1 deletion contract/src/dao.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export const start = async (zcf , privateArgs, baggage) => {
createProposalInvitation
});

return { publicFacet };
return harden({ publicFacet });
}

harden(start)
14 changes: 11 additions & 3 deletions ui/src/components/Proposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ const Proposals = () => {
},
};

const voteDetails = {
voteFor: voteFor ? 10n : undefined,
voteAgainst: !voteFor ? 10n : undefined,
};

walletConnection.makeOffer(
{
source: 'contract',
Expand All @@ -140,13 +145,14 @@ const Proposals = () => {
voteFor,
},
voteOffer,
{proposalId: 1n, voteFor: true},
{proposalId: proposalId, ...voteDetails},
(update: any) => {
console.log('Vote update:', update);
}
);
};


return (
<div className="flex justify-center items-start space-x-4 p-4">
{/* Wallet Section */}
Expand Down Expand Up @@ -194,7 +200,8 @@ const Proposals = () => {
<div className="daisyui-card-body text-center">
<h2 className="daisyui-card-title">Proposals</h2>

{proposals?.map((proposal: any) => (
{
proposals?.map((proposal: any) => (

<div key={proposal.id} className="mb-4 p-2 border-b">
<h3>{proposal.title.title}</h3>
Expand All @@ -207,7 +214,8 @@ const Proposals = () => {
</button>
</div>

))}
))
}


<h3 className="daisyui-card-title">Create Proposal</h3>
Expand Down
4 changes: 1 addition & 3 deletions ui/src/providers/Contract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ const watchContract = (watcher: ChainStorageWatcher) => {
watcher.watchLatest<Array<[unknown]>>(
[Kind.Data, 'published.dao-proposals.proposal'],
proposals => {
console.log("proposals")
console.log(proposals)
if (proposals != undefined) {
if ((proposals != undefined) && (String(proposals) != "")){
useContractStore.setState({
proposals: proposals,
});
Expand Down

0 comments on commit 1dfb76f

Please sign in to comment.