diff --git a/src/store/bountyReviewStore.ts b/src/store/bountyReviewStore.ts new file mode 100644 index 00000000..e5e007a0 --- /dev/null +++ b/src/store/bountyReviewStore.ts @@ -0,0 +1,39 @@ +import { makeAutoObservable } from 'mobx'; +import { ProofOfWork, BountyTiming } from './interface'; + +export class BountyReviewStore { + proofs: Record = {}; + timings: Record = {}; + loading = false; + error: string | null = null; + + constructor() { + makeAutoObservable(this); + } + + setProofs(bountyId: string, proofs: ProofOfWork[]) { + this.proofs[bountyId] = proofs; + } + + setTiming(bountyId: string, timing: BountyTiming) { + this.timings[bountyId] = timing; + } + + setLoading(loading: boolean) { + this.loading = loading; + } + + setError(error: string | null) { + this.error = error; + } + + getProofs(bountyId: string): ProofOfWork[] { + return this.proofs[bountyId] || []; + } + + getTiming(bountyId: string): BountyTiming | undefined { + return this.timings[bountyId]; + } +} + +export const bountyReviewStore = new BountyReviewStore(); diff --git a/src/store/interface.ts b/src/store/interface.ts index 6f037772..24c2f1a8 100644 --- a/src/store/interface.ts +++ b/src/store/interface.ts @@ -528,3 +528,21 @@ export interface BountyCard { payment_pending?: boolean; assignee?: string; } + +export type BountyReviewStatus = 'New' | 'Accepted' | 'Rejected' | 'Change Requested'; + +export interface ProofOfWork { + id: string; + bountyId: string; + description: string; + status: BountyReviewStatus; + submittedAt: string; +} + +export interface BountyTiming { + totalWorkTimeSeconds: number; + totalAttempts: number; + firstAssignedAt: string | null; + lastPoWAt: string | null; + closedAt: string | null; +}