Skip to content

Commit 70b722c

Browse files
committed
Add button label
1 parent 0b00817 commit 70b722c

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/reactComponents/ModuleNameComponent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type ModuleNameComponentProps = {
3939
availableItems: Module[];
4040
handleSelectItem: (item: Module) => void;
4141
storage: commonStorage.Storage | null;
42+
buttonLabel : string;
4243
};
4344

4445
export default function ModuleNameComponent(props: ModuleNameComponentProps) {
@@ -104,7 +105,7 @@ export default function ModuleNameComponent(props: ModuleNameComponentProps) {
104105
type="primary"
105106
onClick={handleAddNewItem}
106107
>
107-
{t("Add")}
108+
{props.buttonLabel}
108109
</Antd.Button>
109110
</Antd.Space.Compact>
110111
{alertErrorVisible && (

src/reactComponents/Tabs.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
import React from 'react';
2222
import * as Antd from 'antd';
2323
import * as commonStorage from '../storage/common_storage';
24-
import type { MessageInstance } from 'antd/es/message/interface';
2524
import * as I18Next from "react-i18next";
26-
import { Dropdown, Menu } from 'antd';
25+
import { Dropdown } from 'antd';
2726

2827
import {
2928
RobotOutlined,
@@ -77,6 +76,7 @@ export interface TabsProps {
7776
setTabList: (items: TabItem[]) => void;
7877
activeTab: string;
7978
project: commonStorage.Project | null;
79+
setProject: (project: commonStorage.Project | null) => void;
8080
setAlertErrorMessage: (message: string) => void;
8181
currentModule: commonStorage.Module | null;
8282
setCurrentModule: (module: commonStorage.Module | null) => void;
@@ -196,7 +196,7 @@ export function Component(props: TabsProps) {
196196
items: [
197197
{
198198
key: 'close',
199-
label: 'Close Tab',
199+
label: t("Close Tab"),
200200
onClick: () => {
201201
onEdit(tab.key, 'remove');
202202
},
@@ -205,7 +205,7 @@ export function Component(props: TabsProps) {
205205
},
206206
{
207207
key: 'close-others',
208-
label: 'Close Other tabs',
208+
label: t("Close Other tabs"),
209209
onClick: () => {
210210
const newTabs = props.tabList.filter(t => (t.key === tab.key) || (t.type === TabType.ROBOT));
211211
props.setTabList(newTabs);
@@ -216,7 +216,7 @@ export function Component(props: TabsProps) {
216216
},
217217
{
218218
key: 'rename',
219-
label: 'Rename...',
219+
label: t("Rename..."),
220220
disabled: tab.type === TabType.ROBOT,
221221
onClick: () => {
222222
modal.confirm({
@@ -236,28 +236,30 @@ export function Component(props: TabsProps) {
236236
},
237237
{
238238
key: 'delete',
239-
label: 'Delete...',
239+
label: t("Delete..."),
240240
disabled: tab.type === TabType.ROBOT,
241241
icon: <DeleteOutlined />,
242242
onClick: () => {
243243
modal.confirm({
244-
title: `Delete ${TabTypeUtils.toString(tab.type)}: ${tab.title}`,
245-
content: `Are you sure you want to delete this? This action cannot be undone.`,
246-
okText: 'Delete',
244+
title: `${t("Delete")} ${TabTypeUtils.toString(tab.type)}: ${tab.title}`,
245+
content: t("Are you sure you want to delete this? This action cannot be undone."),
246+
okText: t("Delete"),
247247
okType: 'danger',
248-
cancelText: 'Cancel',
249-
onOk: () => {
248+
cancelText: t("Cancel"),
249+
onOk: async () => {
250250
const newTabs = props.tabList.filter(t => t.key !== tab.key);
251251
props.setTabList(newTabs);
252-
// Delete for real here....
252+
if(props.storage && props.project) {
253+
commonStorage.removeModuleFromProject(props.storage, props.project, tab.key);
254+
}
253255
setActiveKey(props.tabList[0].key);
254256
},
255257
});
256258
}
257259
},
258260
{
259261
key: 'copy',
260-
label: 'Copy...',
262+
label: t('Copy...'),
261263
disabled: tab.type === TabType.ROBOT,
262264
icon: <CopyOutlined />
263265
},

0 commit comments

Comments
 (0)