From 6ce1e6f43bb1e17533acab52aab858ce7c4afd5f Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 3 Oct 2024 21:12:06 +0000 Subject: [PATCH] refactor: explicitly define acceptable values for `projectConfigMode` --- web/src/components/MainDrawerContents.vue | 2 +- web/src/components/ProjectConfig.vue | 10 +++++----- web/src/store.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/web/src/components/MainDrawerContents.vue b/web/src/components/MainDrawerContents.vue index e3cccc87..88e8cbc8 100644 --- a/web/src/components/MainDrawerContents.vue +++ b/web/src/components/MainDrawerContents.vue @@ -21,7 +21,7 @@ export default { }); function openProjectConfig(create = false) { - projectConfigMode.value = create ? "new" : true; + projectConfigMode.value = create ? "new" : "existing"; } function saveProjectMapLocation(project: Project) { diff --git a/web/src/components/ProjectConfig.vue b/web/src/components/ProjectConfig.vue index db822e46..3492bd16 100644 --- a/web/src/components/ProjectConfig.vue +++ b/web/src/components/ProjectConfig.vue @@ -74,7 +74,7 @@ export default { const { center, zoom } = getCurrentMapPosition(); createProject(newProjectName.value, center, zoom).then(() => { newProjectName.value = undefined; - projectConfigMode.value = true; + projectConfigMode.value = "existing"; loadProjects(); }); } @@ -122,7 +122,7 @@ export default { function loadSelectedProject() { currentProject.value = selectedProject.value; - projectConfigMode.value = false; + projectConfigMode.value = undefined; } function toggleOtherDatasetSelection({ @@ -205,7 +205,7 @@ export default { } watch(selectedProject, () => { - projectConfigMode.value = true; + projectConfigMode.value = "existing"; newProjectName.value = undefined; projectToDelete.value = undefined; projectToEdit.value = undefined; @@ -255,7 +255,7 @@ export default { class="close-button transparent" variant="flat" icon - @click="projectConfigMode = false" + @click="projectConfigMode = undefined" > mdi-close @@ -339,7 +339,7 @@ export default { density="compact" autofocus @keydown.enter="create" - @keydown.esc="projectConfigMode = true" + @keydown.esc="projectConfigMode = 'existing'" /> ([]); export const currentProject = ref(); -export const projectConfigMode = ref(false); +export const projectConfigMode = ref<"new" | "existing">(); // Datasets export const availableDatasets = ref();