@confidencesystemsinc/sdk 1.2.3 → 1.2.5
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/README.md +100 -51
- package/dist/components/playbook/confidence-playbook.d.ts +11 -9
- package/dist/components/playbook/playbook-header.d.ts +2 -2
- package/dist/hooks/usePlaybookExpandedTasks.d.ts +3 -1
- package/dist/index.cjs +15 -15
- package/dist/index.js +1542 -1508
- package/package.json +2 -3
- package/src/components/badge.tsx +0 -116
- package/src/components/initiate-playbook-modal/InitiatePlaybookModal.tsx +0 -53
- package/src/components/playbook/confidence-playbook.tsx +0 -351
- package/src/components/playbook/playbook-header.tsx +0 -32
- package/src/components/playbook-button/ConfidencePlaybookButton.tsx +0 -79
- package/src/components/task/confidence-task.tsx +0 -297
- package/src/components/task/task-buttons.tsx +0 -35
- package/src/components/task/task-dropdown-badge.tsx +0 -118
- package/src/components/task/task-expanded-content.tsx +0 -46
- package/src/components/task/task-left-panel.tsx +0 -60
- package/src/components/task/task-status-badge.tsx +0 -23
- package/src/components/ui/button.tsx +0 -272
- package/src/components/ui/input.tsx +0 -39
- package/src/components/ui/modal.tsx +0 -88
- package/src/components/ui/ui-wrapper.tsx +0 -7
- package/src/constants/settings.constants.ts +0 -4
- package/src/context/confidence-context.tsx +0 -25
- package/src/hooks/task/useCompleteTask.ts +0 -32
- package/src/hooks/task/useStartTask.ts +0 -35
- package/src/hooks/task/useTaskDetails.ts +0 -42
- package/src/hooks/usePlaybook.ts +0 -54
- package/src/hooks/usePlaybookActions.ts +0 -69
- package/src/hooks/usePlaybookExpandedTasks.ts +0 -35
- package/src/hooks/useTaskButtons.ts +0 -47
- package/src/index.ts +0 -7
- package/src/services/complete-task.service.ts +0 -25
- package/src/services/initiate-playbook.service.ts +0 -26
- package/src/services/start-task.services.ts +0 -27
- package/src/services/task-details.service.ts +0 -17
- package/src/stories/confidence-playbook.stories.tsx +0 -125
- package/src/stories/confidence-task.stories.tsx +0 -63
- package/src/stories/initiate-playbook-modal.stories.tsx +0 -31
- package/src/stories/modal.stories.tsx +0 -50
- package/src/task-description.css +0 -629
- package/src/theme.css +0 -11
- package/src/types/playbook.types.ts +0 -22
- package/src/types/task.types.ts +0 -20
- package/src/utils/cn.ts +0 -6
- package/src/vite-env.d.ts +0 -1
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
faCheckSquare,
|
|
3
|
-
faChevronDown,
|
|
4
|
-
} from "@fortawesome/free-solid-svg-icons";
|
|
5
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
|
-
import clsx from "clsx";
|
|
7
|
-
import { useMemo, useState } from "react";
|
|
8
|
-
import { useTaskDetails } from "../../hooks/task/useTaskDetails";
|
|
9
|
-
import { TaskButton, useTaskButtons } from "../../hooks/useTaskButtons";
|
|
10
|
-
import { PlaybookType } from "../../types/playbook.types";
|
|
11
|
-
import { Task, TASK_STATUS, TaskStatus } from "../../types/task.types";
|
|
12
|
-
import { cn } from "../../utils/cn";
|
|
13
|
-
import Button from "../ui/button";
|
|
14
|
-
import { TaskButtons } from "./task-buttons";
|
|
15
|
-
import { TaskDropdownBadge } from "./task-dropdown-badge";
|
|
16
|
-
import { TaskExpandedContent } from "./task-expanded-content";
|
|
17
|
-
import { TaskLeftPanel } from "./task-left-panel";
|
|
18
|
-
import { TaskStatusBadge } from "./task-status-badge";
|
|
19
|
-
|
|
20
|
-
const TASK_CARD_COLOR: {
|
|
21
|
-
[key in TaskStatus]?: string;
|
|
22
|
-
} = {
|
|
23
|
-
[TASK_STATUS.OPEN]: "border-[#C1C5C8] bg-[#F0F1F2]",
|
|
24
|
-
[TASK_STATUS.IN_PROGRESS]: "bg-[#E6F2FF] border-[#94C8FF]",
|
|
25
|
-
[TASK_STATUS.IN_REVIEW]: "bg-[#EAF6EC] border-[#A5DAB1]",
|
|
26
|
-
[TASK_STATUS.COMPLETED]: "bg-[#EAF6EC] border-[#A5DAB1]",
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const TASK_VERIFICATION_TYPE = {
|
|
30
|
-
PHOTO: "photo",
|
|
31
|
-
SCREENSHOT: "screenshot",
|
|
32
|
-
} as const;
|
|
33
|
-
|
|
34
|
-
export type TaskVerificationType =
|
|
35
|
-
(typeof TASK_VERIFICATION_TYPE)[keyof typeof TASK_VERIFICATION_TYPE];
|
|
36
|
-
|
|
37
|
-
export const ConfidenceTask = ({
|
|
38
|
-
task,
|
|
39
|
-
step,
|
|
40
|
-
playbookType,
|
|
41
|
-
onButtonClick,
|
|
42
|
-
viewMode = "card",
|
|
43
|
-
canStart = false,
|
|
44
|
-
isExpanded = false,
|
|
45
|
-
toggleExpanded,
|
|
46
|
-
playbookId,
|
|
47
|
-
taskStyle,
|
|
48
|
-
listStickyTopBase,
|
|
49
|
-
}: {
|
|
50
|
-
task: Task;
|
|
51
|
-
playbookType: PlaybookType;
|
|
52
|
-
step: number;
|
|
53
|
-
onButtonClick: (buttonType: TaskButton) => Promise<void>;
|
|
54
|
-
viewMode?: "card" | "list";
|
|
55
|
-
canStart?: boolean;
|
|
56
|
-
isExpanded?: boolean;
|
|
57
|
-
toggleExpanded?: (expand?: boolean) => void;
|
|
58
|
-
playbookId: number;
|
|
59
|
-
taskStyle?: {
|
|
60
|
-
titleColor?: string;
|
|
61
|
-
};
|
|
62
|
-
listStickyTopBase?: number;
|
|
63
|
-
}) => {
|
|
64
|
-
const [isPerformingAction, setIsPerformingAction] = useState(false);
|
|
65
|
-
const { taskDetails, prefetchQuery: prefetchTaskDetails } = useTaskDetails({
|
|
66
|
-
taskId: task.taskId,
|
|
67
|
-
playbookId,
|
|
68
|
-
enabled: isExpanded,
|
|
69
|
-
});
|
|
70
|
-
const { buttons } = useTaskButtons({
|
|
71
|
-
taskStatus: task.workflowStatus,
|
|
72
|
-
canStart,
|
|
73
|
-
});
|
|
74
|
-
const verificationType = useMemo(() => {
|
|
75
|
-
if (task.imageRequired === 0) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
if (task.imageRequired === 1) {
|
|
79
|
-
return TASK_VERIFICATION_TYPE.SCREENSHOT;
|
|
80
|
-
}
|
|
81
|
-
if (task.imageRequired === 2) {
|
|
82
|
-
return TASK_VERIFICATION_TYPE.PHOTO;
|
|
83
|
-
}
|
|
84
|
-
return null;
|
|
85
|
-
}, [task.imageRequired]);
|
|
86
|
-
|
|
87
|
-
const handleButtonClick = async (btn: TaskButton) => {
|
|
88
|
-
try {
|
|
89
|
-
setIsPerformingAction(true);
|
|
90
|
-
await onButtonClick(btn);
|
|
91
|
-
} finally {
|
|
92
|
-
setIsPerformingAction(false);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
if (viewMode === "list") {
|
|
97
|
-
const BADGE_VARIANT = useMemo(() => {
|
|
98
|
-
if (task.workflowStatus === TASK_STATUS.COMPLETED) {
|
|
99
|
-
return "success";
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (task.workflowStatus === TASK_STATUS.IN_PROGRESS) {
|
|
103
|
-
return "primary";
|
|
104
|
-
}
|
|
105
|
-
return "default";
|
|
106
|
-
}, [task.workflowStatus]);
|
|
107
|
-
|
|
108
|
-
const BADGE_TRANSICTIONS = useMemo(() => {
|
|
109
|
-
const transitions: {
|
|
110
|
-
color: "primary" | "success";
|
|
111
|
-
id: TaskButton;
|
|
112
|
-
action: string;
|
|
113
|
-
to: TaskStatus;
|
|
114
|
-
}[] = [];
|
|
115
|
-
buttons.forEach((button) => {
|
|
116
|
-
if (button === "START") {
|
|
117
|
-
transitions.push({
|
|
118
|
-
id: "START",
|
|
119
|
-
color: "primary",
|
|
120
|
-
action: "Start",
|
|
121
|
-
to: TASK_STATUS.IN_PROGRESS,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (button === "COMPLETE") {
|
|
126
|
-
transitions.push({
|
|
127
|
-
id: "COMPLETE",
|
|
128
|
-
color: "success",
|
|
129
|
-
action: "Complete",
|
|
130
|
-
to: TASK_STATUS.COMPLETED,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
return transitions;
|
|
136
|
-
}, [buttons]);
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<div className={cn("flex flex-col")}>
|
|
140
|
-
<div
|
|
141
|
-
className={cn(
|
|
142
|
-
"flex gap-3 p-2 border-gray-200",
|
|
143
|
-
task.sequenceOrder > 0 && "border-t",
|
|
144
|
-
isExpanded &&
|
|
145
|
-
"bg-white rounded-md border border-t-none shadow-sm sticky",
|
|
146
|
-
)}
|
|
147
|
-
style={{
|
|
148
|
-
top: isExpanded ? listStickyTopBase : 0,
|
|
149
|
-
}}
|
|
150
|
-
>
|
|
151
|
-
<div className="text-gray-200 text-base">
|
|
152
|
-
{task.sequenceOrder + 1}
|
|
153
|
-
</div>
|
|
154
|
-
<div
|
|
155
|
-
onClick={() => {
|
|
156
|
-
toggleExpanded?.(!isExpanded);
|
|
157
|
-
}}
|
|
158
|
-
onMouseOver={prefetchTaskDetails}
|
|
159
|
-
className={cn(
|
|
160
|
-
"flex-1 truncate cursor-pointer",
|
|
161
|
-
isExpanded && "font-medium",
|
|
162
|
-
task.workflowStatus === TASK_STATUS.COMPLETED &&
|
|
163
|
-
"text-secondary-400 line-through",
|
|
164
|
-
)}
|
|
165
|
-
style={{
|
|
166
|
-
color:
|
|
167
|
-
(task.workflowStatus === TASK_STATUS.IN_PROGRESS &&
|
|
168
|
-
taskStyle?.titleColor) ||
|
|
169
|
-
"#1C232D",
|
|
170
|
-
}}
|
|
171
|
-
>
|
|
172
|
-
{task.taskInstanceName}
|
|
173
|
-
</div>
|
|
174
|
-
<TaskDropdownBadge
|
|
175
|
-
title={task.workflowStatus}
|
|
176
|
-
variant={BADGE_VARIANT}
|
|
177
|
-
transitions={BADGE_TRANSICTIONS}
|
|
178
|
-
onClick={(action) => {
|
|
179
|
-
onButtonClick(action as TaskButton);
|
|
180
|
-
}}
|
|
181
|
-
/>
|
|
182
|
-
</div>
|
|
183
|
-
{taskDetails?.description && (
|
|
184
|
-
<div
|
|
185
|
-
className={cn(
|
|
186
|
-
!isExpanded && "hidden",
|
|
187
|
-
"border-gray-200 border p-2 mx-4 mb-4 border-t-none -mt-[1px] bg-gray-100 rounded-b-md",
|
|
188
|
-
)}
|
|
189
|
-
>
|
|
190
|
-
<TaskExpandedContent description={taskDetails?.description || ""} />
|
|
191
|
-
</div>
|
|
192
|
-
)}
|
|
193
|
-
</div>
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return (
|
|
198
|
-
<div
|
|
199
|
-
className={clsx(
|
|
200
|
-
"flex items-stretch rounded-sm overflow-hidden border",
|
|
201
|
-
TASK_CARD_COLOR[task.workflowStatus],
|
|
202
|
-
)}
|
|
203
|
-
>
|
|
204
|
-
<TaskLeftPanel
|
|
205
|
-
playbookType={playbookType}
|
|
206
|
-
status={task.workflowStatus}
|
|
207
|
-
step={step}
|
|
208
|
-
/>
|
|
209
|
-
{/* <input
|
|
210
|
-
type="file"
|
|
211
|
-
ref={photoInputRef}
|
|
212
|
-
hidden
|
|
213
|
-
onChange={(e) => {
|
|
214
|
-
if (e.target.files?.length) {
|
|
215
|
-
void onUploadAsset(e.target.files[0]);
|
|
216
|
-
handleExpand(true);
|
|
217
|
-
}
|
|
218
|
-
}}
|
|
219
|
-
/> */}
|
|
220
|
-
<div className="flex w-full flex-col overflow-x-hidden flex-1 p-2">
|
|
221
|
-
{playbookType === "Sequential" && (
|
|
222
|
-
<div className="-mb-3 self-end pr-2 pt-2">
|
|
223
|
-
<TaskStatusBadge status={task.workflowStatus} />
|
|
224
|
-
</div>
|
|
225
|
-
)}
|
|
226
|
-
|
|
227
|
-
<div className="space-y-2 divide-y divide-black/10 flex flex-col flex-1">
|
|
228
|
-
<div
|
|
229
|
-
className={cn("text-lg font-medium flex-1 pb-1")}
|
|
230
|
-
style={{
|
|
231
|
-
color:
|
|
232
|
-
task.workflowStatus === "Completed"
|
|
233
|
-
? "#1C232D"
|
|
234
|
-
: taskStyle?.titleColor || "#1C232D",
|
|
235
|
-
}}
|
|
236
|
-
>
|
|
237
|
-
{task.taskInstanceName}
|
|
238
|
-
</div>
|
|
239
|
-
|
|
240
|
-
{verificationType ? (
|
|
241
|
-
<div className="flex items-center gap-2 text-sm pb-2">
|
|
242
|
-
<FontAwesomeIcon icon={faCheckSquare} className="size-4" />
|
|
243
|
-
<div>
|
|
244
|
-
<span className="font-medium">
|
|
245
|
-
{verificationType === TASK_VERIFICATION_TYPE.PHOTO
|
|
246
|
-
? "Photo"
|
|
247
|
-
: "Screenshot"}
|
|
248
|
-
</span>{" "}
|
|
249
|
-
required
|
|
250
|
-
</div>
|
|
251
|
-
</div>
|
|
252
|
-
) : (
|
|
253
|
-
<></>
|
|
254
|
-
)}
|
|
255
|
-
</div>
|
|
256
|
-
|
|
257
|
-
{taskDetails?.description && (
|
|
258
|
-
<div className={cn(!isExpanded && "hidden")}>
|
|
259
|
-
<TaskExpandedContent description={taskDetails?.description || ""} />
|
|
260
|
-
</div>
|
|
261
|
-
)}
|
|
262
|
-
{(buttons.length > 0 || task.hasDescription) && (
|
|
263
|
-
<div className="flex items-center justify-end gap-4 border-t border-black/10 pt-2">
|
|
264
|
-
<div className="flex-1">
|
|
265
|
-
<TaskButtons
|
|
266
|
-
buttons={buttons}
|
|
267
|
-
onButtonClick={handleButtonClick}
|
|
268
|
-
disabled={isPerformingAction}
|
|
269
|
-
/>
|
|
270
|
-
</div>
|
|
271
|
-
{toggleExpanded && (
|
|
272
|
-
<Button
|
|
273
|
-
size="smallCollapse"
|
|
274
|
-
onMouseOver={prefetchTaskDetails}
|
|
275
|
-
category="link"
|
|
276
|
-
onClick={() => {
|
|
277
|
-
toggleExpanded();
|
|
278
|
-
}}
|
|
279
|
-
title={
|
|
280
|
-
isExpanded ? "Hide task description" : "Show task description"
|
|
281
|
-
}
|
|
282
|
-
>
|
|
283
|
-
<FontAwesomeIcon
|
|
284
|
-
icon={faChevronDown}
|
|
285
|
-
className={clsx(
|
|
286
|
-
"cursor-pointer text-[#0069D9]",
|
|
287
|
-
isExpanded ? "rotate-180" : "",
|
|
288
|
-
)}
|
|
289
|
-
/>
|
|
290
|
-
</Button>
|
|
291
|
-
)}
|
|
292
|
-
</div>
|
|
293
|
-
)}
|
|
294
|
-
</div>
|
|
295
|
-
</div>
|
|
296
|
-
);
|
|
297
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TASK_BUTTONS_DISPLAY_TEXT,
|
|
3
|
-
TaskButton,
|
|
4
|
-
} from "../../hooks/useTaskButtons";
|
|
5
|
-
import Button from "../ui/button";
|
|
6
|
-
|
|
7
|
-
export const TaskButtons = ({
|
|
8
|
-
buttons,
|
|
9
|
-
onButtonClick,
|
|
10
|
-
disabled,
|
|
11
|
-
}: {
|
|
12
|
-
buttons: TaskButton[];
|
|
13
|
-
onButtonClick: (buttonType: TaskButton) => void;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
}) => {
|
|
16
|
-
return (
|
|
17
|
-
<div className="flex items-center justify-end">
|
|
18
|
-
{buttons.map((button) => {
|
|
19
|
-
return (
|
|
20
|
-
<Button
|
|
21
|
-
key={button}
|
|
22
|
-
size="smallCollapse"
|
|
23
|
-
className="ml-2"
|
|
24
|
-
disabled={disabled}
|
|
25
|
-
onClick={() => {
|
|
26
|
-
onButtonClick(button);
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
{TASK_BUTTONS_DISPLAY_TEXT[button]}
|
|
30
|
-
</Button>
|
|
31
|
-
);
|
|
32
|
-
})}
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { useDismiss, useFloating, useInteractions } from "@floating-ui/react";
|
|
2
|
-
import { faArrowRight, faChevronDown } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
-
import { useState } from "react";
|
|
5
|
-
import { cn } from "../../utils/cn";
|
|
6
|
-
import { Badge } from "../badge";
|
|
7
|
-
const TASK_DROPDOWN_BADGE_VARIANTS = {
|
|
8
|
-
default: "text-secondary-600 border-secondary-600",
|
|
9
|
-
primary: "text-primary-600 border-primary-600",
|
|
10
|
-
success: "text-success-600 border-success-600",
|
|
11
|
-
} as const;
|
|
12
|
-
|
|
13
|
-
interface TaskDropdownBadgeProps {
|
|
14
|
-
title: string;
|
|
15
|
-
variant?: keyof typeof TASK_DROPDOWN_BADGE_VARIANTS;
|
|
16
|
-
transitions: {
|
|
17
|
-
id: string;
|
|
18
|
-
color: "primary" | "success";
|
|
19
|
-
action: string;
|
|
20
|
-
to: string;
|
|
21
|
-
}[];
|
|
22
|
-
onClick?: (action: string) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const MenuItem = ({
|
|
26
|
-
transition,
|
|
27
|
-
onClick,
|
|
28
|
-
}: {
|
|
29
|
-
transition: {
|
|
30
|
-
id: string;
|
|
31
|
-
color: "primary" | "success";
|
|
32
|
-
action: string;
|
|
33
|
-
to: string;
|
|
34
|
-
};
|
|
35
|
-
onClick: () => void;
|
|
36
|
-
}) => {
|
|
37
|
-
return (
|
|
38
|
-
<div
|
|
39
|
-
className="py-1 px-3 space-x-2 flex items-center hover:bg-gray-100 cursor-pointer"
|
|
40
|
-
onClick={(e) => {
|
|
41
|
-
e.stopPropagation();
|
|
42
|
-
onClick();
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
<span className="text-base text-dark flex-1">{transition.action}</span>
|
|
46
|
-
<FontAwesomeIcon icon={faArrowRight} className="text-gray-400 size-4" />
|
|
47
|
-
<Badge category="outline" color={transition.color}>
|
|
48
|
-
{transition.to}
|
|
49
|
-
</Badge>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const TaskDropdownBadge = ({
|
|
55
|
-
title,
|
|
56
|
-
variant = "default",
|
|
57
|
-
transitions,
|
|
58
|
-
onClick,
|
|
59
|
-
}: TaskDropdownBadgeProps) => {
|
|
60
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
61
|
-
|
|
62
|
-
const { refs, floatingStyles, context } = useFloating({
|
|
63
|
-
strategy: "fixed",
|
|
64
|
-
placement: "bottom-end",
|
|
65
|
-
open: isOpen,
|
|
66
|
-
onOpenChange: setIsOpen,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const dismiss = useDismiss(context, {
|
|
70
|
-
outsidePress: true,
|
|
71
|
-
});
|
|
72
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([dismiss]);
|
|
73
|
-
return (
|
|
74
|
-
<>
|
|
75
|
-
<div
|
|
76
|
-
onClick={
|
|
77
|
-
transitions?.length ? () => setIsOpen((prev) => !prev) : undefined
|
|
78
|
-
}
|
|
79
|
-
ref={refs.setReference}
|
|
80
|
-
className={cn(
|
|
81
|
-
"px-1 uppercase border rounded-sm flex items-center space-x-1",
|
|
82
|
-
transitions.length ? "cursor-pointer" : "pointer-events-none",
|
|
83
|
-
TASK_DROPDOWN_BADGE_VARIANTS[variant],
|
|
84
|
-
)}
|
|
85
|
-
{...getReferenceProps()}
|
|
86
|
-
>
|
|
87
|
-
<span className="text-sm font-bold">{title}</span>
|
|
88
|
-
{transitions.length > 0 ? (
|
|
89
|
-
<FontAwesomeIcon icon={faChevronDown} className="size-4" />
|
|
90
|
-
) : (
|
|
91
|
-
<></>
|
|
92
|
-
)}
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
{isOpen && transitions.length && (
|
|
96
|
-
<div
|
|
97
|
-
ref={refs.setFloating}
|
|
98
|
-
style={floatingStyles}
|
|
99
|
-
className={cn(
|
|
100
|
-
"border border-gray-200 py-1.5 rounded-sm min-w-[172px] bg-white shadow-dark/50",
|
|
101
|
-
)}
|
|
102
|
-
{...getFloatingProps()}
|
|
103
|
-
>
|
|
104
|
-
{transitions.map((transition, index) => (
|
|
105
|
-
<MenuItem
|
|
106
|
-
key={index}
|
|
107
|
-
transition={transition}
|
|
108
|
-
onClick={() => {
|
|
109
|
-
onClick?.(transition.id as string);
|
|
110
|
-
setIsOpen(false);
|
|
111
|
-
}}
|
|
112
|
-
/>
|
|
113
|
-
))}
|
|
114
|
-
</div>
|
|
115
|
-
)}
|
|
116
|
-
</>
|
|
117
|
-
);
|
|
118
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo } from "react";
|
|
2
|
-
import { DROPBOX_API_ENDPOINT } from "../../constants/settings.constants";
|
|
3
|
-
|
|
4
|
-
export const TaskExpandedContent = ({
|
|
5
|
-
description,
|
|
6
|
-
}: {
|
|
7
|
-
description: string;
|
|
8
|
-
}) => {
|
|
9
|
-
const imageReplacedDescription = useMemo(() => {
|
|
10
|
-
const regex = /https:\/\/[^/]+\/api\/files/g;
|
|
11
|
-
|
|
12
|
-
const stripped = description?.replaceAll(regex, `${DROPBOX_API_ENDPOINT}`);
|
|
13
|
-
|
|
14
|
-
const replaced = stripped?.replaceAll(
|
|
15
|
-
'src="/api/files',
|
|
16
|
-
`src="${DROPBOX_API_ENDPOINT}`,
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const parser = new DOMParser();
|
|
20
|
-
const doc = parser.parseFromString(replaced, "text/html");
|
|
21
|
-
const images = doc.querySelectorAll("img");
|
|
22
|
-
const slides = [] as { src: string }[];
|
|
23
|
-
images?.forEach((img) => {
|
|
24
|
-
const src = img.getAttribute("src");
|
|
25
|
-
if (src) {
|
|
26
|
-
slides.push({ src });
|
|
27
|
-
/** Prefetch image to show immediately */
|
|
28
|
-
new Image().src = src;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return replaced;
|
|
33
|
-
}, [description]);
|
|
34
|
-
|
|
35
|
-
useEffect(() => {}, [imageReplacedDescription]);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div className="flex flex-col gap-4">
|
|
39
|
-
<div
|
|
40
|
-
className="lexical-view-mode"
|
|
41
|
-
// onClick={handleDescriptionClick}
|
|
42
|
-
dangerouslySetInnerHTML={{ __html: imageReplacedDescription }}
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import { TaskStatus, TASK_STATUS } from "../../types/task.types";
|
|
3
|
-
import { PLAYBOOK_TYPES, PlaybookType } from "../../types/playbook.types";
|
|
4
|
-
|
|
5
|
-
export interface TaskCardV2LeftPanelProps {
|
|
6
|
-
playbookType: PlaybookType;
|
|
7
|
-
status: TaskStatus;
|
|
8
|
-
step: number;
|
|
9
|
-
isSelected?: boolean;
|
|
10
|
-
onSelect?: (withShiftKey?: boolean) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const LEFT_PANEL_FORMATTED_LABELS: {
|
|
14
|
-
[key in TaskStatus]?: string;
|
|
15
|
-
} = {
|
|
16
|
-
[TASK_STATUS.IN_REVIEW]: "In Review",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const LEFT_PANEL_COLOR: {
|
|
20
|
-
[key in TaskStatus]?: string;
|
|
21
|
-
} = {
|
|
22
|
-
[TASK_STATUS.OPEN]: "bg-secondary-500",
|
|
23
|
-
[TASK_STATUS.IN_PROGRESS]: "bg-primary-600",
|
|
24
|
-
[TASK_STATUS.IN_REVIEW]: "bg-success-600",
|
|
25
|
-
[TASK_STATUS.COMPLETED]: "bg-success-600",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const TaskLeftPanel = ({
|
|
29
|
-
playbookType,
|
|
30
|
-
status,
|
|
31
|
-
step,
|
|
32
|
-
isSelected,
|
|
33
|
-
onSelect,
|
|
34
|
-
}: TaskCardV2LeftPanelProps) => {
|
|
35
|
-
return (
|
|
36
|
-
<div
|
|
37
|
-
className={clsx(
|
|
38
|
-
"flex flex-col items-center justify-center",
|
|
39
|
-
isSelected ? "bg-[#FFE600]" : LEFT_PANEL_COLOR[status],
|
|
40
|
-
onSelect && "cursor-pointer",
|
|
41
|
-
)}
|
|
42
|
-
onClick={(e) => {
|
|
43
|
-
e.stopPropagation();
|
|
44
|
-
onSelect?.(e.shiftKey);
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
47
|
-
<span
|
|
48
|
-
className={clsx(
|
|
49
|
-
`text-orientation-mixed w-[27px] flex items-center whitespace-nowrap px-2 text-sm font-bold [writing-mode:vertical-lr]`,
|
|
50
|
-
isSelected ? "text-black" : "text-white",
|
|
51
|
-
)}
|
|
52
|
-
>
|
|
53
|
-
{/** TODO: check "status" wording */}
|
|
54
|
-
{playbookType === PLAYBOOK_TYPES.SEQUENTIAL
|
|
55
|
-
? `STEP ${step}`
|
|
56
|
-
: (LEFT_PANEL_FORMATTED_LABELS[status] || status).toUpperCase()}
|
|
57
|
-
</span>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { TASK_STATUS, TaskStatus } from "../../types/task.types";
|
|
2
|
-
import { Badge, BadgeSolid } from "../badge";
|
|
3
|
-
|
|
4
|
-
export interface TaskCardV2StatusBadgeProps {
|
|
5
|
-
status: TaskStatus;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const STATUS_BADGE_COLOR: {
|
|
9
|
-
[key in TaskStatus]?: keyof typeof BadgeSolid;
|
|
10
|
-
} = {
|
|
11
|
-
[TASK_STATUS.OPEN]: "secondary",
|
|
12
|
-
[TASK_STATUS.IN_PROGRESS]: "primary",
|
|
13
|
-
[TASK_STATUS.IN_REVIEW]: "success",
|
|
14
|
-
[TASK_STATUS.COMPLETED]: "success",
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
export const TaskStatusBadge = ({ status }: TaskCardV2StatusBadgeProps) => {
|
|
18
|
-
return (
|
|
19
|
-
<Badge category="outline" color={STATUS_BADGE_COLOR[status]}>
|
|
20
|
-
{status}
|
|
21
|
-
</Badge>
|
|
22
|
-
);
|
|
23
|
-
};
|