import { Tooltip, ActionIcon, CopyButton, Flex } from "@mantine/core"; import { IconCheck, IconGitCommit, IconFileDiff, IconEdit, IconColumnInsertRight, IconReplace, IconCopy,IconFile } from "@tabler/icons-react"; import React, { useState } from "react"; import { useMst } from "@/views/stores/RootStore"; import messageUtil from '@/util/MessageUtil'; import APIUtil from "@/util/APIUtil"; import IDEServiceUtil from "@/util/IDEServiceUtil"; const IconButton = ({ label, color = 'gray', onClick, children }) => ( {children} ); const CodeCopyButton = ({ code, language, platform }) => { return ( {({ copied, copy }) => ( { copy(); APIUtil.createEvent({name: 'copy', value: 'copy', language: language, ide: platform}) }}> {copied ? : } )} ); }; const DiffButton = ({ code, language, platform }) => { const handleClick = () => { const e = 'show_diff'; messageUtil.sendMessage({ command: e, content: code }); APIUtil.createEvent({name: e, value: e, language: language, ide: platform}); }; return ( ); }; const EditApplyButton = ({ code, language, platform }) => { const handleClick = () => { IDEServiceUtil.callService("diff_apply", { filepath: "", content: code, autoedit: true }); APIUtil.createEvent({name: "edit_apply", value: "edit_apply", language: language, ide: platform}); }; return ( ); }; const CodeApplyButton = ({ code, language, platform }) => { const handleClick = () => { const e = 'code_apply'; messageUtil.sendMessage({ command: e, content: code }); APIUtil.createEvent({name: e, value: e, language: language, ide: platform}); }; return ( ); }; const FileApplyButton = ({ code, language, platform }) => { const handleClick = () => { const e = 'code_file_apply'; messageUtil.sendMessage({ command: e, content: code }); APIUtil.createEvent({name: e, value: e, language: language, ide: platform}); }; return ( ); }; // Add a new button to create new file const NewFileButton = ({ code, language, platform }) => { const handleClick = () => { const e = 'code_new_file'; messageUtil.sendMessage({ command: e, language: language, content: code }); APIUtil.createEvent({name: e, value: e, language: language, ide: platform}); }; return ( ); }; // Similar changes can be made to DiffButton, CodeApplyButton, FileApplyButton, and CodeCopyButton const CodeButtons = ({ platform, language, code }) => ( <> {language === 'edits' && ( )} ); export default CodeButtons;