File tree Expand file tree Collapse file tree 3 files changed +10
-58
lines changed
app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/[bountyId] Expand file tree Collapse file tree 3 files changed +10
-58
lines changed Original file line number Diff line number Diff line change 55 getSubmissionPeriods ,
66} from "@/lib/bounty/periods" ;
77import { BOUNTY_SUBMISSION_STATUS_BADGES } from "@/lib/bounty/submission-status" ;
8+ import { resolveBountyDetails } from "@/lib/bounty/utils" ;
89import { PartnerBountyProps , PartnerBountySubmission } from "@/lib/types" ;
910import { useBountySubmissionDetailsSheet } from "@/ui/partners/bounties/bounty-submission-details-sheet" ;
1011import { useClaimBountySheet } from "@/ui/partners/bounties/claim-bounty-sheet" ;
@@ -140,15 +141,18 @@ export function BountySubmissionsTable({
140141 size : 98 ,
141142 cell : ( { row : { original } } ) => {
142143 const { status } = original ;
144+ const bountyInfo = resolveBountyDetails ( bounty ) ;
143145 const isExpired =
144146 bounty . endsAt !== null && new Date ( bounty . endsAt ) < new Date ( ) ;
145- const isActionable = status === "notSubmitted" || status === "draft" ;
147+ const isActionable = bountyInfo ?. hasSocialMetrics
148+ ? status === "notSubmitted"
149+ : status === "notSubmitted" || status === "draft" ;
146150
147151 let buttonText = "Submit" ;
148152
149- if ( status === "draft" ) {
153+ if ( status === "draft" && ! bountyInfo ?. hasSocialMetrics ) {
150154 buttonText = "Continue" ;
151- } else if ( [ "submitted" , "approved" , "rejected" ] . includes ( status ) ) {
155+ } else if ( status !== "notSubmitted" ) {
152156 buttonText = "View" ;
153157 }
154158
Original file line number Diff line number Diff line change @@ -231,19 +231,8 @@ export class BountySubmissionHandler {
231231
232232 if ( existingSubmission ) {
233233 if (
234- existingSubmission . reviewedAt ||
235- existingSubmission . status === "approved" ||
236- existingSubmission . status === "rejected"
237- ) {
238- throw new DubApiError ( {
239- code : "conflict" ,
240- message : `You already have a ${ existingSubmission . status } submission for this period.` ,
241- } ) ;
242- }
243-
244- if (
245- existingSubmission . status !== "draft" &&
246- ! bountyInfo ?. hasSocialMetrics
234+ existingSubmission . status !== "draft" ||
235+ bountyInfo ?. hasSocialMetrics
247236 ) {
248237 throw new DubApiError ( {
249238 code : "conflict" ,
@@ -519,10 +508,9 @@ export class BountySubmissionHandler {
519508 } ) ;
520509 }
521510
522- // Note: We don't allow draft submission for social metrics bounties.
523511 this . submissionData = {
524512 ...this . submissionData ,
525- status : "submitted " ,
513+ status : "draft " ,
526514 completedAt : null ,
527515 } ;
528516
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments