diff --git a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx index 53305de37a..a6ea0edd09 100644 --- a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx +++ b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx @@ -27,17 +27,20 @@ interface ITabsState { selectedIndex: number, fileDecorations: fileDecoration[], currentExt: string + fileName: string } interface ITabsAction { type: string, payload: any, ext?: string, + fileName?: string } const initialTabsState: ITabsState = { selectedIndex: -1, fileDecorations: [], - currentExt: '' + currentExt: '', + fileName: '' } const tabsReducer = (state: ITabsState, action: ITabsAction) => { @@ -46,6 +49,7 @@ const tabsReducer = (state: ITabsState, action: ITabsAction) => { return { ...state, currentExt: action.ext, + fileName: action.fileName, selectedIndex: action.payload, } case 'SET_FILE_DECORATIONS': @@ -120,7 +124,7 @@ export const TabsUI = (props: TabsUIProps) => { const activateTab = (name: string) => { const index = tabs.current.findIndex((tab) => tab.name === name) currentIndexRef.current = index - dispatch({ type: 'SELECT_INDEX', payload: index, ext: getExt(name)}) + dispatch({ type: 'SELECT_INDEX', payload: index, ext: getExt(name), fileName: name}) } const setFileDecorations = (fileStates: fileDecoration[]) => { @@ -152,7 +156,6 @@ export const TabsUI = (props: TabsUIProps) => { if (ext) return ext[0].toLowerCase() else return '' } - const path = active().substr(active().indexOf('/') + 1, active().length) return (