diff --git a/web/src/App.js b/web/src/App.js index 88ba266a..535ee02e 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -1,7 +1,7 @@ import React from 'react'; import './index.css'; import Screen from './Screen'; -import { CurrentWidgetProvider, CurrentDatabaseProvider, OpenedFilesProvider } from './utility/globalState'; +import { CurrentWidgetProvider, CurrentDatabaseProvider, OpenedTabsProvider } from './utility/globalState'; import { SocketProvider } from './utility/SocketProvider'; function App() { @@ -9,9 +9,9 @@ function App() { - + - + diff --git a/web/src/FilesTabsPanel.js b/web/src/FilesTabsPanel.js index c0a67894..238500d1 100644 --- a/web/src/FilesTabsPanel.js +++ b/web/src/FilesTabsPanel.js @@ -3,7 +3,7 @@ import styled from 'styled-components'; import theme from './theme'; import { TableIcon } from './icons'; -import { useOpenedFiles, useSetOpenedFiles } from './utility/globalState'; +import { useOpenedTabs, useSetOpenedTabs } from './utility/globalState'; // const files = [ // { name: 'app.js' }, @@ -31,11 +31,11 @@ const FileNameWrapper = styled.span` `; export default function FilesTabsPanel() { - const files = useOpenedFiles(); - const setOpenedFiles = useSetOpenedFiles(); + const files = useOpenedTabs(); + const setOpenedTabs = useSetOpenedTabs(); const handleTabClick = id => { - setOpenedFiles(files => + setOpenedTabs(files => files.map(x => ({ ...x, selected: x.id == id, @@ -44,7 +44,7 @@ export default function FilesTabsPanel() { }; const handleMouseUp = (e, id) => { if (e.button == 1) { - setOpenedFiles(files => files.filter(x => x.id != id)); + setOpenedTabs(files => files.filter(x => x.id != id)); } }; return ( diff --git a/web/src/appobj/AppObjectList.js b/web/src/appobj/AppObjectList.js index 45fc88e5..f13bb942 100644 --- a/web/src/appobj/AppObjectList.js +++ b/web/src/appobj/AppObjectList.js @@ -2,12 +2,12 @@ import React from 'react'; import styled from 'styled-components'; import { showMenu } from '../modals/DropDownMenu'; import { AppObjectCore } from './AppObjects'; -import { useSetOpenedFiles } from '../utility/globalState'; +import { useSetOpenedTabs } from '../utility/globalState'; export function AppObjectList({ list, makeAppObj, SubItems = undefined, onObjectClick = undefined }) { - const setOpenedFiles = useSetOpenedFiles(); + const setOpenedTabs = useSetOpenedTabs(); return (list || []).map(x => { - const appobj = makeAppObj(x, { setOpenedFiles }); + const appobj = makeAppObj(x, { setOpenedTabs }); if (onObjectClick) appobj.onClick = onObjectClick; let res = ; if (SubItems) { diff --git a/web/src/appobj/AppObjects.js b/web/src/appobj/AppObjects.js index 08906e89..33ed14a3 100644 --- a/web/src/appobj/AppObjects.js +++ b/web/src/appobj/AppObjects.js @@ -1,7 +1,7 @@ import React from 'react'; import styled from 'styled-components'; import { showMenu } from '../modals/DropDownMenu'; -import { useSetOpenedFiles } from '../utility/globalState'; +import { useSetOpenedTabs } from '../utility/globalState'; const AppObjectDiv = styled.div` padding: 5px; @@ -35,7 +35,7 @@ export function AppObjectCore({ title, Icon, Menu, data, makeAppObj, onClick }) } export function AppObjectControl({ data, makeAppObj }) { - const setOpenedFiles = useSetOpenedFiles(); - const appobj = makeAppObj(data, { setOpenedFiles }); + const setOpenedTabs = useSetOpenedTabs(); + const appobj = makeAppObj(data, { setOpenedTabs }); return ; } diff --git a/web/src/appobj/tableAppObject.js b/web/src/appobj/tableAppObject.js index 35118994..f584e66a 100644 --- a/web/src/appobj/tableAppObject.js +++ b/web/src/appobj/tableAppObject.js @@ -21,13 +21,13 @@ function Menu({ data, makeAppObj }) { ); } -export default function tableAppObject({ pureName, schemaName }, { setOpenedFiles }) { +export default function tableAppObject({ pureName, schemaName }, { setOpenedTabs }) { const title = schemaName ? `${schemaName}.${pureName}` : pureName; const key = title; const Icon = TableIcon; const onClick = ({ schemaName, pureName }) => { const id = uuidv1(); - setOpenedFiles(files => [...files, { id, name: pureName }]); + setOpenedTabs(files => [...files, { id, name: pureName }]); }; return { title, key, Icon, Menu, onClick }; diff --git a/web/src/utility/globalState.js b/web/src/utility/globalState.js index 06ce73f9..f93752f0 100644 --- a/web/src/utility/globalState.js +++ b/web/src/utility/globalState.js @@ -45,5 +45,5 @@ export { CurrentWidgetProvider, useCurrentWidget, useSetCurrentWidget }; const [CurrentDatabaseProvider, useCurrentDatabase, useSetCurrentDatabase] = createGlobalState(null); export { CurrentDatabaseProvider, useCurrentDatabase, useSetCurrentDatabase }; -const [OpenedFilesProvider, useOpenedFiles, useSetOpenedFiles] = createStorageState('openedFiles', []); -export { OpenedFilesProvider, useOpenedFiles, useSetOpenedFiles }; +const [OpenedTabsProvider, useOpenedTabs, useSetOpenedTabs] = createStorageState('openedTabs', []); +export { OpenedTabsProvider, useOpenedTabs, useSetOpenedTabs };