From 88c67efc7d0f760bd159b3163e209c7f351a5859 Mon Sep 17 00:00:00 2001 From: Keivan Vosoughi Date: Fri, 13 Jun 2025 10:44:23 -0700 Subject: [PATCH] DSE-44371: Swap the Examples step with Prompt step This PR concludes the changes for the prompt tab improements with moving the restore button to the top of the prompt textarea and make it as icon button. --- app/client/src/pages/DataGenerator/Prompt.tsx | 54 ++++++++++--------- .../src/pages/DataGenerator/ResetIcon.tsx | 21 ++++++++ .../Evaluator/FreeFromEvaluationTable.tsx | 2 +- 3 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 app/client/src/pages/DataGenerator/ResetIcon.tsx diff --git a/app/client/src/pages/DataGenerator/Prompt.tsx b/app/client/src/pages/DataGenerator/Prompt.tsx index 4638806..e27788d 100644 --- a/app/client/src/pages/DataGenerator/Prompt.tsx +++ b/app/client/src/pages/DataGenerator/Prompt.tsx @@ -19,6 +19,7 @@ import TextArea from 'antd/es/input/TextArea'; import FileSelectorButton from './FileSelectorButton'; import { useMutation } from '@tanstack/react-query'; import first from 'lodash/first'; +import ResetIcon from './ResetIcon'; const { Title } = Typography; @@ -254,6 +255,33 @@ const Prompt = () => { setPrompt={setPrompt} /> } + } + type="link" + onClick={() => { + return Modal.warning({ + title: 'Restore Default Prompt', + closable: true, + content: <>{'Are you sure you want to restore to the default prompt? Your current prompt will be lost.'}, + footer: ( + + + + + ), + maskClosable: true, + }) + }}> + {'Restore'} + } @@ -263,31 +291,7 @@ const Prompt = () => { > - { - return Modal.warning({ - title: 'Restore Default Prompt', - closable: true, - content: <>{'Are you sure you want to restore to the default prompt? Your current prompt will be lost.'}, - footer: ( - - - - - ), - maskClosable: true, - }) - }}> - {'Restore'} - + {((workflow_type === WorkflowType.CUSTOM_DATA_GENERATION && !isEmpty(doc_paths)) || diff --git a/app/client/src/pages/DataGenerator/ResetIcon.tsx b/app/client/src/pages/DataGenerator/ResetIcon.tsx new file mode 100644 index 0000000..053384b --- /dev/null +++ b/app/client/src/pages/DataGenerator/ResetIcon.tsx @@ -0,0 +1,21 @@ +import React from 'react'; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const ResetIcon = (props: any) => + /*#__PURE__*/ React.createElement( + "svg", + { + viewBox: "0 0 24 24", + fill: "none", + width: "1em", + height: "1em", + className: "cdp-icon-ai-assistant", + ...props, + }, + /*#__PURE__*/ React.createElement("path", { + d: "M11.013 10.99h-7.99V3h1.998v3.39c1.646-2.048 4.163-3.367 6.991-3.367 4.956 0 8.988 4.032 8.988 8.988 0 4.957-4.032 8.99-8.988 8.99-3.905 0-7.227-2.508-8.464-5.993h2.157c1.124 2.357 3.525 3.995 6.307 3.995 3.855 0 6.99-3.137 6.99-6.992 0-3.854-3.135-6.99-6.99-6.99-2.772 0-5.164 1.626-6.294 3.971h5.295v1.997z", + fill: "currentColor", + }), + ); + +export default ResetIcon; \ No newline at end of file diff --git a/app/client/src/pages/Evaluator/FreeFromEvaluationTable.tsx b/app/client/src/pages/Evaluator/FreeFromEvaluationTable.tsx index 6e905a8..c443921 100644 --- a/app/client/src/pages/Evaluator/FreeFromEvaluationTable.tsx +++ b/app/client/src/pages/Evaluator/FreeFromEvaluationTable.tsx @@ -18,7 +18,7 @@ import { import { themeMaterial } from "ag-grid-community"; import get from 'lodash/get'; import { getColorCode } from './util'; -import { Badge, Popover, Tooltip } from 'antd'; +import { Badge, Popover } from 'antd'; import styled from 'styled-components'; interface Props {