From 7be93653c3700ee77fa507f792dc305c8494c92f Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Fri, 30 Jun 2023 10:52:23 -0300 Subject: [PATCH 1/9] =?UTF-8?q?=F0=9F=94=A7=20fix(inputListComponent):=20r?= =?UTF-8?q?emove=20unnecessary=20padding=20from=20input=20list=20component?= =?UTF-8?q?=20to=20improve=20layout=20=F0=9F=94=A7=20fix(tabsContext):=20a?= =?UTF-8?q?dd=20optional=20fileName=20parameter=20to=20downloadFlow=20func?= =?UTF-8?q?tion=20to=20allow=20customizing=20the=20downloaded=20file=20nam?= =?UTF-8?q?e=20=F0=9F=94=A7=20fix(exportModal):=20add=20optional=20fileNam?= =?UTF-8?q?e=20parameter=20to=20downloadFlow=20function=20calls=20to=20all?= =?UTF-8?q?ow=20customizing=20the=20downloaded=20file=20name=20?= =?UTF-8?q?=F0=9F=94=A7=20fix(tabsContext):=20update=20downloadFlow=20func?= =?UTF-8?q?tion=20signature=20to=20include=20optional=20fileName=20paramet?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/components/inputListComponent/index.tsx | 2 +- src/frontend/src/contexts/tabsContext.tsx | 4 ++-- src/frontend/src/modals/exportModal/index.tsx | 4 ++-- src/frontend/src/types/tabs/index.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index d81da6183..5c9c0e78b 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -23,7 +23,7 @@ export default function InputListComponent({
{inputList.map((i, idx) => ( diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index cf4303a4d..75d4dd73b 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -268,7 +268,7 @@ export function TabsProvider({ children }: { children: ReactNode }) { /** * Downloads the current flow as a JSON file */ - function downloadFlow(flow: FlowType) { + function downloadFlow(flow: FlowType, fileName?: string) { // create a data URI with the current flow data const jsonString = `data:text/json;chatset=utf-8,${encodeURIComponent( JSON.stringify(flow) @@ -277,7 +277,7 @@ export function TabsProvider({ children }: { children: ReactNode }) { // create a link element and set its properties const link = document.createElement("a"); link.href = jsonString; - link.download = `${flows.find((f) => f.id === tabId).name}.json`; + link.download = `${fileName && fileName != "" ? fileName : flows.find((f) => f.id === tabId).name}.json`; // simulate a click on the link element to trigger the download link.click(); diff --git a/src/frontend/src/modals/exportModal/index.tsx b/src/frontend/src/modals/exportModal/index.tsx index 236c27366..3febacf9f 100644 --- a/src/frontend/src/modals/exportModal/index.tsx +++ b/src/frontend/src/modals/exportModal/index.tsx @@ -80,9 +80,9 @@ export default function ExportModal() {
diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index 1c998a20d..204550be4 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -69,7 +69,7 @@ export default function CodeAreaComponent({ }} > {!editNode && ( - + )} diff --git a/src/frontend/src/components/headerComponent/index.tsx b/src/frontend/src/components/headerComponent/index.tsx index add19c0bf..2be2ecb47 100644 --- a/src/frontend/src/components/headerComponent/index.tsx +++ b/src/frontend/src/components/headerComponent/index.tsx @@ -89,7 +89,7 @@ export default function Header() { rel="noreferrer" className="text-muted-foreground" > - + - + diff --git a/src/frontend/src/components/inputFileComponent/index.tsx b/src/frontend/src/components/inputFileComponent/index.tsx index ce851ec60..74aad75f1 100644 --- a/src/frontend/src/components/inputFileComponent/index.tsx +++ b/src/frontend/src/components/inputFileComponent/index.tsx @@ -114,7 +114,7 @@ export default function InputFileComponent({ diff --git a/src/frontend/src/components/textAreaComponent/index.tsx b/src/frontend/src/components/textAreaComponent/index.tsx index 9f934ce2c..ae21ad7eb 100644 --- a/src/frontend/src/components/textAreaComponent/index.tsx +++ b/src/frontend/src/components/textAreaComponent/index.tsx @@ -76,7 +76,7 @@ export default function TextAreaComponent({ ); }} > - {!editNode && } + {!editNode && } diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index c6bd94762..e5be70201 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -87,7 +87,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) { Code - {EXPORT_CODE_DIALOG} diff --git a/src/frontend/src/modals/codeAreaModal/index.tsx b/src/frontend/src/modals/codeAreaModal/index.tsx index da7eeb2d0..bf1aee248 100644 --- a/src/frontend/src/modals/codeAreaModal/index.tsx +++ b/src/frontend/src/modals/codeAreaModal/index.tsx @@ -52,6 +52,7 @@ export default function CodeAreaModal({ Edit Code