@trustless-work/blocks 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +719 -17
- package/package.json +1 -1
- package/templates/escrows/details/Actions.tsx +144 -149
- package/templates/escrows/details/Entities.tsx +1 -1
- package/templates/escrows/details/EntityCard.tsx +1 -3
- package/templates/escrows/details/EscrowDetailDialog.tsx +16 -16
- package/templates/escrows/details/GeneralInformation.tsx +19 -22
- package/templates/escrows/details/MilestoneCard.tsx +46 -47
- package/templates/escrows/details/MilestoneDetailDialog.tsx +1 -2
- package/templates/escrows/details/Milestones.tsx +0 -5
- package/templates/escrows/details/SuccessReleaseDialog.tsx +4 -6
- package/templates/escrows/escrows-by-role/cards/EscrowsCards.tsx +84 -49
- package/templates/escrows/escrows-by-role/cards/Filters.tsx +3 -5
- package/templates/escrows/escrows-by-role/table/EscrowsTable.tsx +8 -26
- package/templates/escrows/escrows-by-role/table/Filters.tsx +3 -5
- package/templates/escrows/escrows-by-signer/cards/EscrowsCards.tsx +89 -55
- package/templates/escrows/escrows-by-signer/cards/Filters.tsx +3 -5
- package/templates/escrows/escrows-by-signer/table/EscrowsTable.tsx +8 -24
- package/templates/escrows/escrows-by-signer/table/Filters.tsx +3 -5
- package/templates/escrows/multi-release/dispute-milestone/button/DisputeEscrow.tsx +98 -0
- package/templates/escrows/multi-release/initialize-escrow/dialog/InitializeEscrow.tsx +528 -0
- package/templates/escrows/multi-release/initialize-escrow/form/InitializeEscrow.tsx +506 -0
- package/templates/escrows/multi-release/initialize-escrow/shared/schema.ts +179 -0
- package/templates/escrows/multi-release/initialize-escrow/shared/useInitializeEscrow.ts +175 -0
- package/templates/escrows/multi-release/release-milestone/button/ReleaseEscrow.tsx +116 -0
- package/templates/escrows/multi-release/resolve-dispute/button/ResolveDispute.tsx +122 -0
- package/templates/escrows/multi-release/resolve-dispute/dialog/ResolveDispute.tsx +178 -0
- package/templates/escrows/multi-release/resolve-dispute/form/ResolveDispute.tsx +156 -0
- package/templates/escrows/multi-release/resolve-dispute/shared/schema.ts +85 -0
- package/templates/escrows/multi-release/resolve-dispute/shared/useResolveDispute.ts +105 -0
- package/templates/escrows/multi-release/update-escrow/dialog/UpdateEscrow.tsx +471 -0
- package/templates/escrows/multi-release/update-escrow/form/UpdateEscrow.tsx +449 -0
- package/templates/escrows/multi-release/update-escrow/shared/schema.ts +152 -0
- package/templates/escrows/multi-release/update-escrow/shared/useUpdateEscrow.ts +254 -0
- package/templates/escrows/{single-release → single-multi-release}/approve-milestone/button/ApproveMilestone.tsx +20 -7
- package/templates/escrows/{single-release → single-multi-release}/approve-milestone/dialog/ApproveMilestone.tsx +2 -2
- package/templates/escrows/{single-release → single-multi-release}/approve-milestone/form/ApproveMilestone.tsx +2 -2
- package/templates/escrows/{single-release → single-multi-release}/approve-milestone/shared/useApproveMilestone.ts +16 -16
- package/templates/escrows/{single-release → single-multi-release}/change-milestone-status/button/ChangeMilestoneStatus.tsx +4 -4
- package/templates/escrows/{single-release → single-multi-release}/change-milestone-status/dialog/ChangeMilestoneStatus.tsx +3 -3
- package/templates/escrows/{single-release → single-multi-release}/change-milestone-status/form/ChangeMilestoneStatus.tsx +2 -2
- package/templates/escrows/{single-release → single-multi-release}/change-milestone-status/shared/useChangeMilestoneStatus.ts +1 -1
- package/templates/escrows/{single-release → single-multi-release}/fund-escrow/button/FundEscrow.tsx +3 -3
- package/templates/escrows/{single-release → single-multi-release}/fund-escrow/dialog/FundEscrow.tsx +2 -2
- package/templates/escrows/{single-release → single-multi-release}/fund-escrow/form/FundEscrow.tsx +2 -2
- package/templates/escrows/{single-release → single-multi-release}/fund-escrow/shared/useFundEscrow.ts +1 -1
- package/templates/escrows/single-release/dispute-escrow/button/DisputeEscrow.tsx +2 -2
- package/templates/escrows/single-release/initialize-escrow/dialog/InitializeEscrow.tsx +14 -6
- package/templates/escrows/single-release/initialize-escrow/form/InitializeEscrow.tsx +14 -6
- package/templates/escrows/single-release/initialize-escrow/shared/schema.ts +0 -57
- package/templates/escrows/single-release/initialize-escrow/shared/useInitializeEscrow.ts +42 -1
- package/templates/escrows/single-release/release-escrow/button/ReleaseEscrow.tsx +2 -2
- package/templates/escrows/single-release/resolve-dispute/button/ResolveDispute.tsx +3 -3
- package/templates/escrows/single-release/resolve-dispute/dialog/ResolveDispute.tsx +3 -6
- package/templates/escrows/single-release/resolve-dispute/form/ResolveDispute.tsx +2 -2
- package/templates/escrows/single-release/resolve-dispute/shared/useResolveDispute.ts +14 -1
- package/templates/escrows/single-release/update-escrow/dialog/UpdateEscrow.tsx +2 -2
- package/templates/escrows/single-release/update-escrow/form/UpdateEscrow.tsx +2 -2
- package/templates/escrows/single-release/update-escrow/shared/useUpdateEscrow.ts +12 -7
- package/templates/providers/EscrowDialogsProvider.tsx +1 -3
- package/templates/providers/EscrowProvider.tsx +27 -4
- package/templates/providers/TrustlessWork.tsx +1 -1
- package/templates/escrows/details/ProgressEscrow.tsx +0 -191
- /package/templates/escrows/{single-release → single-multi-release}/approve-milestone/shared/schema.ts +0 -0
- /package/templates/escrows/{single-release → single-multi-release}/change-milestone-status/shared/schema.ts +0 -0
- /package/templates/escrows/{single-release → single-multi-release}/fund-escrow/shared/schema.ts +0 -0
package/package.json
CHANGED
|
@@ -1,149 +1,144 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DollarSign,
|
|
3
|
-
CheckCircle,
|
|
4
|
-
CheckSquare,
|
|
5
|
-
AlertTriangle,
|
|
6
|
-
Edit,
|
|
7
|
-
Scale,
|
|
8
|
-
Unlock,
|
|
9
|
-
Wallet,
|
|
10
|
-
Settings,
|
|
11
|
-
Briefcase,
|
|
12
|
-
} from "lucide-react";
|
|
13
|
-
import {
|
|
14
|
-
GetEscrowsFromIndexerResponse as Escrow,
|
|
15
|
-
Role,
|
|
16
|
-
} from "@trustless-work/escrow/types";
|
|
17
|
-
import
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<FundEscrowDialog />
|
|
147
|
-
</div>
|
|
148
|
-
);
|
|
149
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
DollarSign,
|
|
3
|
+
CheckCircle,
|
|
4
|
+
CheckSquare,
|
|
5
|
+
AlertTriangle,
|
|
6
|
+
Edit,
|
|
7
|
+
Scale,
|
|
8
|
+
Unlock,
|
|
9
|
+
Wallet,
|
|
10
|
+
Settings,
|
|
11
|
+
Briefcase,
|
|
12
|
+
} from "lucide-react";
|
|
13
|
+
import {
|
|
14
|
+
GetEscrowsFromIndexerResponse as Escrow,
|
|
15
|
+
Role,
|
|
16
|
+
} from "@trustless-work/escrow/types";
|
|
17
|
+
import { FundEscrowDialog } from "../../single-multi-release/fund-escrow/dialog/FundEscrow";
|
|
18
|
+
|
|
19
|
+
interface ActionsProps {
|
|
20
|
+
selectedEscrow: Escrow;
|
|
21
|
+
userRolesInEscrow: string[];
|
|
22
|
+
areAllMilestonesApproved: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const roleActions: {
|
|
26
|
+
role: Role;
|
|
27
|
+
actions: string[];
|
|
28
|
+
icon: React.ReactNode;
|
|
29
|
+
color: string;
|
|
30
|
+
}[] = [
|
|
31
|
+
{
|
|
32
|
+
role: "signer",
|
|
33
|
+
actions: ["fundEscrow"],
|
|
34
|
+
icon: <Wallet className="h-6 w-6 text-primary" />,
|
|
35
|
+
color: "",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
role: "approver",
|
|
39
|
+
actions: ["fundEscrow", "approveMilestone", "startDispute"],
|
|
40
|
+
icon: <CheckCircle className="h-6 w-6 text-primary" />,
|
|
41
|
+
color: "0",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
role: "serviceProvider",
|
|
45
|
+
actions: ["fundEscrow", "completeMilestone", "startDispute"],
|
|
46
|
+
icon: <Briefcase className="h-6 w-6 text-primary" />,
|
|
47
|
+
color: "0",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
role: "disputeResolver",
|
|
51
|
+
actions: ["fundEscrow", "resolveDispute"],
|
|
52
|
+
icon: <Scale className="h-6 w-6 text-primary" />,
|
|
53
|
+
color: "00",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
role: "releaseSigner",
|
|
57
|
+
actions: ["fundEscrow", "releasePayment"],
|
|
58
|
+
icon: <Unlock className="h-6 w-6 text-primary" />,
|
|
59
|
+
color: "",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
role: "platformAddress",
|
|
63
|
+
actions: ["fundEscrow", "editEscrow"],
|
|
64
|
+
icon: <Settings className="h-6 w-6 text-primary" />,
|
|
65
|
+
color: "0",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
role: "receiver",
|
|
69
|
+
actions: ["fundEscrow"],
|
|
70
|
+
icon: <DollarSign className="h-6 w-6 text-primary" />,
|
|
71
|
+
color: "",
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
export const actionIcons: Record<string, React.ReactNode> = {
|
|
76
|
+
fundEscrow: <DollarSign className="h-6 w-6 text-primary/60" />,
|
|
77
|
+
approveMilestone: <CheckCircle className="h-6 w-6 text-primary/60" />,
|
|
78
|
+
completeMilestone: <CheckSquare className="h-6 w-6 text-primary/60" />,
|
|
79
|
+
startDispute: <AlertTriangle className="h-6 w-6 text-primary/60" />,
|
|
80
|
+
resolveDispute: <Scale className="h-6 w-6 text-primary/60" />,
|
|
81
|
+
releasePayment: <Unlock className="h-6 w-6 text-primary/60" />,
|
|
82
|
+
editEscrow: <Edit className="h-6 w-6 text-primary/60" />,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const Actions = ({
|
|
86
|
+
selectedEscrow,
|
|
87
|
+
userRolesInEscrow,
|
|
88
|
+
areAllMilestonesApproved,
|
|
89
|
+
}: ActionsProps) => {
|
|
90
|
+
const shouldShowEditButton =
|
|
91
|
+
userRolesInEscrow.includes("platformAddress") &&
|
|
92
|
+
!selectedEscrow?.flags?.disputed &&
|
|
93
|
+
!selectedEscrow?.flags?.resolved &&
|
|
94
|
+
!selectedEscrow?.flags?.released &&
|
|
95
|
+
selectedEscrow?.balance === 0;
|
|
96
|
+
|
|
97
|
+
const shouldShowDisputeButton =
|
|
98
|
+
selectedEscrow.type === "single-release" &&
|
|
99
|
+
(userRolesInEscrow.includes("approver") ||
|
|
100
|
+
userRolesInEscrow.includes("serviceProvider")) &&
|
|
101
|
+
!selectedEscrow?.flags?.disputed &&
|
|
102
|
+
!selectedEscrow?.flags?.resolved;
|
|
103
|
+
|
|
104
|
+
const shouldShowResolveButton =
|
|
105
|
+
selectedEscrow.type === "single-release" &&
|
|
106
|
+
userRolesInEscrow.includes("disputeResolver") &&
|
|
107
|
+
!selectedEscrow?.flags?.resolved &&
|
|
108
|
+
selectedEscrow?.flags?.disputed;
|
|
109
|
+
|
|
110
|
+
const shouldShowReleaseFundsButton =
|
|
111
|
+
selectedEscrow.type === "single-release" &&
|
|
112
|
+
areAllMilestonesApproved &&
|
|
113
|
+
userRolesInEscrow.includes("releaseSigner") &&
|
|
114
|
+
!selectedEscrow.flags?.released;
|
|
115
|
+
|
|
116
|
+
const hasConditionalButtons =
|
|
117
|
+
shouldShowEditButton ||
|
|
118
|
+
shouldShowDisputeButton ||
|
|
119
|
+
shouldShowResolveButton ||
|
|
120
|
+
shouldShowReleaseFundsButton;
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<div className="flex items-start justify-start flex-col gap-2 w-full">
|
|
124
|
+
{/* You can add the buttons here, using the buttons from the blocks. These actions are conditional based on the escrow flags and the user roles. */}
|
|
125
|
+
{hasConditionalButtons && (
|
|
126
|
+
<div className="flex flex-col gap-2 w-full">
|
|
127
|
+
{/* UpdateEscrowDialog component should be rendered based on the escrow type. It means that if the selectedEscrow.type is "single-release", then the UpdateEscrowDialog (from the single-release block) component should be rendered. If the selectedEscrow.type is "multi-release", then the UpdateEscrowDialog (from the multi-release block) component should be rendered. */}
|
|
128
|
+
{/* {shouldShowEditButton && <UpdateEscrowDialog />} */}
|
|
129
|
+
|
|
130
|
+
{/* Works only with single-release escrows */}
|
|
131
|
+
{/* {shouldShowDisputeButton && <DisputeEscrowButton />} */}
|
|
132
|
+
|
|
133
|
+
{/* Works only with single-release escrows */}
|
|
134
|
+
{/* {shouldShowResolveButton && <ResolveDisputeDialog />} */}
|
|
135
|
+
|
|
136
|
+
{/* Works only with single-release escrows */}
|
|
137
|
+
{/* {shouldShowReleaseFundsButton && <ReleaseEscrowButton />} */}
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
140
|
+
|
|
141
|
+
<FundEscrowDialog />
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
@@ -22,7 +22,7 @@ interface EntityCardProps {
|
|
|
22
22
|
inDispute?: boolean;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const EntityCard = ({
|
|
25
|
+
export const EntityCard = ({
|
|
26
26
|
entity,
|
|
27
27
|
type,
|
|
28
28
|
hasPercentage,
|
|
@@ -94,5 +94,3 @@ const EntityCard = ({
|
|
|
94
94
|
</Card>
|
|
95
95
|
);
|
|
96
96
|
};
|
|
97
|
-
|
|
98
|
-
export default EntityCard;
|
|
@@ -13,29 +13,31 @@ import Link from "next/link";
|
|
|
13
13
|
import { Card } from "__UI_BASE__/card";
|
|
14
14
|
import { Info, Users, ListChecks } from "lucide-react";
|
|
15
15
|
import { useEscrowDialogs } from "@/components/tw-blocks/providers/EscrowDialogsProvider";
|
|
16
|
-
import type {
|
|
17
|
-
GetEscrowsFromIndexerResponse as Escrow,
|
|
18
|
-
Role,
|
|
19
|
-
} from "@trustless-work/escrow/types";
|
|
16
|
+
import type { GetEscrowsFromIndexerResponse as Escrow } from "@trustless-work/escrow/types";
|
|
20
17
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "__UI_BASE__/tabs";
|
|
21
18
|
import { Milestones } from "./Milestones";
|
|
22
19
|
import { Entities } from "./Entities";
|
|
23
20
|
import { GeneralInformation } from "./GeneralInformation";
|
|
24
21
|
import { useEscrowContext } from "@/components/tw-blocks/providers/EscrowProvider";
|
|
25
|
-
import SuccessReleaseDialog from "./SuccessReleaseDialog";
|
|
22
|
+
import { SuccessReleaseDialog } from "./SuccessReleaseDialog";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Based on the provided roles -> https://docs.trustlesswork.com/trustless-work/technology-overview/roles-in-trustless-work
|
|
26
|
+
*
|
|
27
|
+
* The roles that the user assigns in the escrow initialization are in the userRolesInEscrow state. Based on these roles, you'll have different actions buttons.
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
26
30
|
|
|
27
31
|
interface EscrowDetailDialogProps {
|
|
28
32
|
isDialogOpen: boolean;
|
|
29
|
-
activeRole: Role[];
|
|
30
33
|
setIsDialogOpen: (value: boolean) => void;
|
|
31
34
|
setSelectedEscrow: (selectedEscrow?: Escrow) => void;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
const EscrowDetailDialog = ({
|
|
37
|
+
export const EscrowDetailDialog = ({
|
|
35
38
|
isDialogOpen,
|
|
36
39
|
setIsDialogOpen,
|
|
37
40
|
setSelectedEscrow,
|
|
38
|
-
activeRole,
|
|
39
41
|
}: EscrowDetailDialogProps) => {
|
|
40
42
|
const { selectedEscrow } = useEscrowContext();
|
|
41
43
|
const dialogStates = useEscrowDialogs();
|
|
@@ -115,7 +117,6 @@ const EscrowDetailDialog = ({
|
|
|
115
117
|
<div className="flex-1 min-h-0">
|
|
116
118
|
<TabsContent value="general" className="mt-4 h-full">
|
|
117
119
|
<GeneralInformation
|
|
118
|
-
activeRole={activeRole}
|
|
119
120
|
selectedEscrow={selectedEscrow}
|
|
120
121
|
userRolesInEscrow={userRolesInEscrow}
|
|
121
122
|
dialogStates={dialogStates}
|
|
@@ -130,7 +131,6 @@ const EscrowDetailDialog = ({
|
|
|
130
131
|
<TabsContent value="milestones" className="mt-4 h-full">
|
|
131
132
|
<Card className="p-4 h-full">
|
|
132
133
|
<Milestones
|
|
133
|
-
activeRole={activeRole}
|
|
134
134
|
selectedEscrow={selectedEscrow}
|
|
135
135
|
userRolesInEscrow={userRolesInEscrow}
|
|
136
136
|
setEvidenceVisibleMap={setEvidenceVisibleMap}
|
|
@@ -143,12 +143,12 @@ const EscrowDetailDialog = ({
|
|
|
143
143
|
</DialogContent>
|
|
144
144
|
</Dialog>
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
{dialogStates.successRelease.isOpen && (
|
|
147
|
+
<SuccessReleaseDialog
|
|
148
|
+
isOpen={dialogStates.successRelease.isOpen}
|
|
149
|
+
onOpenChange={dialogStates.successRelease.setIsOpen}
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
150
152
|
</>
|
|
151
153
|
);
|
|
152
154
|
};
|
|
153
|
-
|
|
154
|
-
export default React.memo(EscrowDetailDialog);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useMemo } from "react";
|
|
4
4
|
import { Card } from "__UI_BASE__/card";
|
|
5
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from "__UI_BASE__/tooltip";
|
|
5
6
|
import { cn } from "@/lib/utils";
|
|
6
7
|
import { MultiReleaseMilestone } from "@trustless-work/escrow";
|
|
7
8
|
import {
|
|
@@ -14,30 +15,26 @@ import {
|
|
|
14
15
|
Users,
|
|
15
16
|
Check,
|
|
16
17
|
Copy,
|
|
18
|
+
BriefcaseBusiness,
|
|
19
|
+
BookOpen,
|
|
17
20
|
} from "lucide-react";
|
|
18
21
|
import { Actions, roleActions } from "./Actions";
|
|
19
|
-
import type {
|
|
20
|
-
|
|
21
|
-
StatusStates,
|
|
22
|
-
} from "@/components/tw-blocks/providers/EscrowDialogsProvider";
|
|
23
|
-
import {
|
|
24
|
-
GetEscrowsFromIndexerResponse,
|
|
25
|
-
Role,
|
|
26
|
-
} from "@trustless-work/escrow/types";
|
|
22
|
+
import type { DialogStates } from "@/components/tw-blocks/providers/EscrowDialogsProvider";
|
|
23
|
+
import { GetEscrowsFromIndexerResponse } from "@trustless-work/escrow/types";
|
|
27
24
|
import { useEscrowAmountContext } from "@/components/tw-blocks/providers/EscrowAmountProvider";
|
|
28
25
|
import { StatisticsCard } from "./StatisticsCard";
|
|
29
26
|
import {
|
|
30
27
|
formatAddress,
|
|
31
28
|
formatCurrency,
|
|
29
|
+
formatRole,
|
|
32
30
|
} from "@/components/tw-blocks/helpers/format.helper";
|
|
33
31
|
import { useCopy } from "@/components/tw-blocks/helpers/useCopy";
|
|
34
32
|
|
|
35
33
|
interface GeneralInformationProps {
|
|
36
34
|
selectedEscrow: GetEscrowsFromIndexerResponse;
|
|
37
35
|
userRolesInEscrow: string[];
|
|
38
|
-
dialogStates: DialogStates
|
|
36
|
+
dialogStates: DialogStates;
|
|
39
37
|
areAllMilestonesApproved: boolean;
|
|
40
|
-
activeRole: Role[];
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
export const GeneralInformation = ({
|
|
@@ -45,7 +42,6 @@ export const GeneralInformation = ({
|
|
|
45
42
|
userRolesInEscrow,
|
|
46
43
|
dialogStates,
|
|
47
44
|
areAllMilestonesApproved,
|
|
48
|
-
activeRole,
|
|
49
45
|
}: GeneralInformationProps) => {
|
|
50
46
|
const { trustlessWorkAmount, receiverAmount, platformFeeAmount } =
|
|
51
47
|
useEscrowAmountContext();
|
|
@@ -117,7 +113,6 @@ export const GeneralInformation = ({
|
|
|
117
113
|
selectedEscrow={selectedEscrow}
|
|
118
114
|
userRolesInEscrow={userRolesInEscrow}
|
|
119
115
|
areAllMilestonesApproved={areAllMilestonesApproved}
|
|
120
|
-
activeRole={activeRole}
|
|
121
116
|
/>
|
|
122
117
|
</div>
|
|
123
118
|
</div>
|
|
@@ -176,14 +171,16 @@ export const GeneralInformation = ({
|
|
|
176
171
|
{userRolesInEscrow.map((role) => {
|
|
177
172
|
const roleData = roleActions.find((r) => r.role === role);
|
|
178
173
|
return (
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
174
|
+
<Tooltip key={role}>
|
|
175
|
+
<TooltipTrigger>
|
|
176
|
+
<div className="p-2 bg-primary/10 rounded-md hover:bg-primary/20 transition-colors cursor-pointer">
|
|
177
|
+
{roleData?.icon || (
|
|
178
|
+
<Users className="h-4 w-4 text-primary" />
|
|
179
|
+
)}
|
|
180
|
+
</div>
|
|
181
|
+
</TooltipTrigger>
|
|
182
|
+
<TooltipContent>{formatRole(role)}</TooltipContent>
|
|
183
|
+
</Tooltip>
|
|
187
184
|
);
|
|
188
185
|
})}
|
|
189
186
|
</div>
|
|
@@ -205,7 +202,7 @@ export const GeneralInformation = ({
|
|
|
205
202
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
206
203
|
<div className="p-4 bg-muted/50 rounded-lg border">
|
|
207
204
|
<div className="flex items-center gap-3 mb-2">
|
|
208
|
-
<
|
|
205
|
+
<BriefcaseBusiness className="h-5 w-5 text-primary flex-shrink-0" />
|
|
209
206
|
<span className="text-sm font-medium text-muted-foreground">
|
|
210
207
|
Engagement ID
|
|
211
208
|
</span>
|
|
@@ -217,7 +214,7 @@ export const GeneralInformation = ({
|
|
|
217
214
|
|
|
218
215
|
<div className="p-4 bg-muted/50 rounded-lg border">
|
|
219
216
|
<div className="flex items-center gap-3 mb-2">
|
|
220
|
-
<
|
|
217
|
+
<BookOpen className="h-5 w-5 text-primary flex-shrink-0" />
|
|
221
218
|
<span className="text-sm font-medium text-muted-foreground">
|
|
222
219
|
Type
|
|
223
220
|
</span>
|