Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: open bounties #377

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 15 additions & 33 deletions src/components/bounty/ClaimItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default function ClaimItem({
issuer,
bountyId,
accepted,
isMultiplayer,
url,
}: {
id: string;
Expand All @@ -32,7 +31,6 @@ export default function ClaimItem({
issuer: string;
bountyId: string;
accepted: boolean;
isMultiplayer: boolean;
url: string;
}) {
const account = useAccount();
Expand Down Expand Up @@ -189,43 +187,27 @@ export default function ClaimItem({
/>
<div className='p-[2px] text-white relative bg-[#F15E5F] border-[#F15E5F] border-2 rounded-xl '>
<div className='left-5 top-5 absolute flex flex-col text-white'>
{isMultiplayer && account.address === issuer && (
<button
className='submitForVote cursor-pointer text-[#F15E5F] hover:text-white hover:bg-[#F15E5F] border border-[#F15E5F] rounded-[8px] py-2 px-5 '
onClick={() => {
if (account.isConnected) {
submitForVoteMutation.mutate({
bountyId: BigInt(bountyId),
claimId: BigInt(id),
});
} else {
toast.error('Please connect wallet to continue');
}
}}
>
submit for vote
</button>
)}

{bounty.data &&
bounty.data.inProgress &&
!isMultiplayer &&
account.address === bounty.data.issuer && (
<div
<button
className='cursor-pointer mt-5 text-white hover:bg-[#F15E5F] border border-[#F15E5F] rounded-[8px] py-2 px-5'
onClick={() => {
if (account.isConnected) {
acceptClaimMutation.mutate({
bountyId: BigInt(bountyId),
claimId: BigInt(id),
});
} else {
toast.error('Please connect wallet to continue');
}
bounty.data.participants.length > 1
? submitForVoteMutation.mutate({
bountyId: BigInt(bountyId),
claimId: BigInt(id),
})
: acceptClaimMutation.mutate({
bountyId: BigInt(bountyId),
claimId: BigInt(id),
});
}}
className='acceptButton cursor-pointer mt-5 text-white hover:bg-[#F15E5F] border border-[#F15E5F] rounded-[8px] py-2 px-5'
>
accept
</div>
{bounty.data.participants.length > 1
? 'submit for vote'
: 'accept'}
</button>
)}
</div>

Expand Down
2 changes: 0 additions & 2 deletions src/components/bounty/ClaimList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default function ClaimList({
{votingClaim && (
<div className='lg:col-span-4'>
<ClaimItem
isMultiplayer={isMultiplayer}
bountyId={bountyId}
id={votingClaim.id}
title={votingClaim.title}
Expand All @@ -60,7 +59,6 @@ export default function ClaimList({
.map((claim) => (
<div key={claim.id} className='lg:col-span-4 otherClaims'>
<ClaimItem
isMultiplayer={isMultiplayer}
bountyId={bountyId}
id={claim.id}
title={claim.title}
Expand Down
5 changes: 5 additions & 0 deletions src/trpc/routers/_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export const appRouter = createTRPCRouter({
claims: {
take: 1,
},
participants: {
select: {
user: true,
},
},
},
});

Expand Down
Loading