({ item, buttonsDisabled }: TaskActionsProps)
| 17 | } |
| 18 | |
| 19 | export const TaskActions = ({ item, buttonsDisabled }: TaskActionsProps) => { |
| 20 | const [deleteTaskId, setDeleteTaskId] = useState<string | null>(null) |
| 21 | const { t } = useTranslation() |
| 22 | const { copyWithFeedback, showCopyFeedback } = useCopyToClipboard() |
| 23 | const { debug } = useExtensionState() |
| 24 | |
| 25 | return ( |
| 26 | <div className="flex flex-row items-center -ml-0.5 mt-1 gap-1"> |
| 27 | <LucideIconButton |
| 28 | icon={DownloadIcon} |
| 29 | title={t("chat:task.export")} |
| 30 | onClick={() => vscode.postMessage({ type: "exportCurrentTask" })} |
| 31 | /> |
| 32 | |
| 33 | {item?.task && ( |
| 34 | <LucideIconButton |
| 35 | icon={showCopyFeedback ? CheckIcon : CopyIcon} |
| 36 | title={t("history:copyPrompt")} |
| 37 | onClick={(e) => copyWithFeedback(item.task, e)} |
| 38 | /> |
| 39 | )} |
| 40 | {!!item?.size && item.size > 0 && ( |
| 41 | <> |
| 42 | <LucideIconButton |
| 43 | icon={Trash2Icon} |
| 44 | title={t("chat:task.delete")} |
| 45 | disabled={buttonsDisabled} |
| 46 | onClick={(e) => { |
| 47 | e.stopPropagation() |
| 48 | if (e.shiftKey) { |
| 49 | vscode.postMessage({ type: "deleteTaskWithId", text: item.id }) |
| 50 | } else { |
| 51 | setDeleteTaskId(item.id) |
| 52 | } |
| 53 | }} |
| 54 | /> |
| 55 | {deleteTaskId && ( |
| 56 | <DeleteTaskDialog |
| 57 | taskId={deleteTaskId} |
| 58 | onOpenChange={(open) => !open && setDeleteTaskId(null)} |
| 59 | open |
| 60 | /> |
| 61 | )} |
| 62 | </> |
| 63 | )} |
| 64 | {debug && item?.id && ( |
| 65 | <> |
| 66 | <LucideIconButton |
| 67 | icon={FileJsonIcon} |
| 68 | title={t("chat:task.openApiHistory")} |
| 69 | onClick={() => vscode.postMessage({ type: "openDebugApiHistory" })} |
| 70 | /> |
| 71 | <LucideIconButton |
| 72 | icon={MessageSquareCodeIcon} |
| 73 | title={t("chat:task.openUiHistory")} |
| 74 | onClick={() => vscode.postMessage({ type: "openDebugUiHistory" })} |
| 75 | /> |
| 76 | </> |
nothing calls this directly
no test coverage detected