Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 React from "react"; import InfoRender from "./InfoRender.tsx"; import handleStepInformation from "../../../utils/playbook/stepInformation/handleStepInformation.ts"; import getNestedValue from "../../../utils/common/getNestedValue.ts"; import DeleteTaskButton from "../../Buttons/DeleteTaskButton/index.tsx"; import useIsPrefetched from "../../../hooks/playbooks/useIsPrefetched.ts"; import useCurrentTask from "../../../hooks/playbooks/task/useCurrentTask.ts"; type TaskInformationPropTypes = { taskId: string | undefined; }; function TaskInformation({ taskId }: TaskInformationPropTypes) { const [task, , taskType] = useCurrentTask(taskId); const isPrefetched = useIsPrefetched(); Iif (!task?.id) return; const taskData = task[task.source.toLowerCase() ?? ""][taskType?.toLowerCase()]; return ( <div className={`px-4 py-2 bg-white border-2 border-stone-400 w-full h-auto cursor-pointer transition-all hover:shadow-violet-500 flex justify-between`}> <div className="flex flex-col gap-2 flex-1 text-ellipsis overflow-hidden"> {handleStepInformation(task.id).map((info, i) => ( <div className="flex flex-col flex-1 text-ellipsis" key={i}> {getNestedValue(taskData, info.key) && ( <> <p className="text-xs font-semibold">{info.label}</p> <InfoRender info={info} taskId={task?.id ?? ""} /> </> )} </div> ))} </div> {!isPrefetched && ( <div className="flex-[0.1] self-end"> <DeleteTaskButton taskId={task.id} /> </div> )} </div> ); } export default TaskInformation; |