2121import React from 'react' ;
2222import * as Antd from 'antd' ;
2323import * as commonStorage from '../storage/common_storage' ;
24- import type { MessageInstance } from 'antd/es/message/interface' ;
2524import * as I18Next from "react-i18next" ;
26- import { Dropdown , Menu } from 'antd' ;
25+ import { Dropdown } from 'antd' ;
2726
2827import {
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