forked from stakwork/sphinx-tribes-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request stakwork#827 from MuhammadUmer44/feature/bounty-re…
…view-store Add Bounty Review Store and Types
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { makeAutoObservable } from 'mobx'; | ||
import { ProofOfWork, BountyTiming } from './interface'; | ||
|
||
export class BountyReviewStore { | ||
proofs: Record<string, ProofOfWork[]> = {}; | ||
timings: Record<string, BountyTiming> = {}; | ||
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters