forked from SmartDropLabs/smartdrop-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfarmStore.ts
More file actions
47 lines (43 loc) · 1.17 KB
/
Copy pathfarmStore.ts
File metadata and controls
47 lines (43 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { create } from "zustand";
import type { FarmPosition } from "@/types/farm";
type FarmModal = "none" | "unlock" | "deposit" | "boost";
type FarmStore = {
selectedPosition: FarmPosition | null;
activeModal: FarmModal;
pendingTxHash: string | null;
openUnlock: (position: FarmPosition) => void;
openDeposit: (position: FarmPosition) => void;
openBoost: (position: FarmPosition) => void;
setPendingTx: (hash: string | null) => void;
close: () => void;
};
export const useFarmStore = create<FarmStore>((set) => ({
selectedPosition: null,
activeModal: "none",
pendingTxHash: null,
openUnlock: (position) =>
set({
selectedPosition: position,
activeModal: "unlock",
pendingTxHash: null,
}),
openDeposit: (position) =>
set({
selectedPosition: position,
activeModal: "deposit",
pendingTxHash: null,
}),
openBoost: (position) =>
set({
selectedPosition: position,
activeModal: "boost",
pendingTxHash: null,
}),
setPendingTx: (hash) => set({ pendingTxHash: hash }),
close: () =>
set({
selectedPosition: null,
activeModal: "none",
pendingTxHash: null,
}),
}));