diff --git a/src/assets/images/close.svg b/src/assets/images/close.svg new file mode 100644 index 0000000..af26022 --- /dev/null +++ b/src/assets/images/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/styles/buttons.css b/src/assets/styles/buttons.css index f0ae8ef..9afc81b 100644 --- a/src/assets/styles/buttons.css +++ b/src/assets/styles/buttons.css @@ -28,5 +28,9 @@ button.primary:disabled { color: var(--color-text-light-2); text-shadow: none; cursor: default; -} +} + +button.primary:focus { + outline: none; +} diff --git a/src/assets/styles/variables.css b/src/assets/styles/variables.css index 0af0ed1..be44f85 100644 --- a/src/assets/styles/variables.css +++ b/src/assets/styles/variables.css @@ -22,7 +22,6 @@ --color-text-light: var(--color-white); --color-text-light-2: var(--color-gray-medium); --color-text-base: var(--color-gray-dark); - --color-text-medium: var(--color-gray-medium); --color-text-active: var(--color-blue-dark-2); --shadow: 0 1px 2px rgba(42, 63, 95, 0.7); diff --git a/src/components/MainMenu.vue b/src/components/MainMenu.vue index f2e1d0e..c71c8fd 100644 --- a/src/components/MainMenu.vue +++ b/src/components/MainMenu.vue @@ -5,15 +5,68 @@ My queries
- - + +
diff --git a/src/store/index.js b/src/store/index.js index 1e83c3f..3f33c6d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -8,7 +8,11 @@ export default new Vuex.Store({ schema: null, dbFile: null, dbName: null, - worker: new Worker('/js/worker.sql-wasm.js') + worker: new Worker('/js/worker.sql-wasm.js'), + tabs: [], + currentTab: null, + currentTabId: null, + untitledLastIndex: 0 }, mutations: { saveSchema (state, schema) { @@ -19,6 +23,41 @@ export default new Vuex.Store({ }, saveDbName (state, name) { state.dbName = name + }, + addTab (state, tab) { + state.tabs.push(tab) + }, + updateTabName (state, { index, newName }) { + const tab = state.tabs[index] + tab.name = newName + Vue.set(state.tabs, index, tab) + }, + updateTabState (state, { index, newValue }) { + console.log(index, newValue) + const tab = state.tabs[index] + tab.isUnsaved = newValue + Vue.set(state.tabs, index, tab) + }, + deleteTab (state, index) { + if (state.tabs[index].id !== state.currentTabId) { + } else if (index < state.tabs.length - 1) { + state.currentTabId = state.tabs[index + 1].id + } else if (index > 0) { + state.currentTabId = state.tabs[index - 1].id + } else { + state.currentTabId = null + state.untitledLastIndex = 0 + } + state.tabs.splice(index, 1) + }, + setCurrentTabId (state, id) { + state.currentTabId = id + }, + setCurrentTab (state, tab) { + state.currentTab = tab + }, + updateUntitledLastIndex (state) { + state.untitledLastIndex += 1 } }, actions: {