Skip to content

Commit

Permalink
tweak the copy title
Browse files Browse the repository at this point in the history
  • Loading branch information
kurund committed Nov 19, 2024
1 parent 1728c3b commit a20d272
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/containers/Flow/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const Flow = () => {
const [roles, setRoles] = useState<Array<any>>([]);
const [isBackground, setIsBackground] = useState(false);
const [ignoreKeywords, setIgnoreKeywords] = useState(false);
const [copyFlowTitle, setCopyFlowTitle] = useState('');

const { t } = useTranslation();

let isTemplate = false;
Expand Down Expand Up @@ -104,11 +106,13 @@ export const Flow = () => {
if (location.state === 'copy') {
fieldName = `Copy of ${nameValue}`;
fieldKeywords = '';
setCopyFlowTitle(nameValue);
} else if (location.state === 'copyTemplate') {
fieldName = '';
description = '';
tags = null;
fieldKeywords = '';
setCopyFlowTitle(nameValue);
}
const {
organization: {
Expand Down Expand Up @@ -277,12 +281,12 @@ export const Flow = () => {

if (location.state === 'copy') {
queries.updateItemQuery = CREATE_FLOW_COPY;
title = t('Copy flow');
title = t('Copy of');
type = 'copy';
copyNotification = t('Copy of the flow has been created!');
} else if (location.state === 'copyTemplate') {
queries.updateItemQuery = CREATE_FLOW_COPY;
title = t('Template flow copy');
title = t('Copy of');
type = 'copy';
copyNotification = t('Flow created successfully from template!');
} else if (location.state === 'template') {
Expand All @@ -291,6 +295,10 @@ export const Flow = () => {
queries.updateItemQuery = UPDATE_FLOW;
}

if (copyFlowTitle) {
title = `${title} ${copyFlowTitle}`;
}

const customHandler = (data: any) => {
let dataCopy = data;
if (data[0].key === 'keywords') {
Expand Down
3 changes: 1 addition & 2 deletions src/i18n/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"If activated, users will not be able to change this flow by entering keyword for any other flow.": "If activated, users will not be able to change this flow by entering keyword for any other flow.",
"Is pinned?": "Is pinned?",
"Run this flow in the background": "Run this flow in the background",
"Copy flow": "Copy flow",
"Copy of": "Copy of",
"Sorry! An error occurred!": "Sorry! An error occurred!",
"Copy of the flow has been created!": "Copy of the flow has been created!",
"Import flow": "Import flow",
Expand Down Expand Up @@ -511,7 +511,6 @@
"Import the csv with translations for interactive message.": "Import the csv with translations for interactive message.",
"Template Flows": "Template Flows",
"Template Flow": "Template Flow",
"Template flow copy": "Template flow copy",
"Flow created successfully from template!": "Flow created successfully from template!",
"Select/Create an assistant": "Select/Create an assistant",
"Create Assistant": "Create Assistant",
Expand Down

0 comments on commit a20d272

Please sign in to comment.