Skip to content

Commit

Permalink
refactor: explicitly define acceptable values for projectConfigMode
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Oct 3, 2024
1 parent ccb3e39 commit 6ce1e6f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion web/src/components/MainDrawerContents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
});
function openProjectConfig(create = false) {
projectConfigMode.value = create ? "new" : true;
projectConfigMode.value = create ? "new" : "existing";
}
function saveProjectMapLocation(project: Project) {
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/ProjectConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
Expand Down Expand Up @@ -122,7 +122,7 @@ export default {
function loadSelectedProject() {
currentProject.value = selectedProject.value;
projectConfigMode.value = false;
projectConfigMode.value = undefined;
}
function toggleOtherDatasetSelection({
Expand Down Expand Up @@ -205,7 +205,7 @@ export default {
}
watch(selectedProject, () => {
projectConfigMode.value = true;
projectConfigMode.value = "existing";
newProjectName.value = undefined;
projectToDelete.value = undefined;
projectToEdit.value = undefined;
Expand Down Expand Up @@ -255,7 +255,7 @@ export default {
class="close-button transparent"
variant="flat"
icon
@click="projectConfigMode = false"
@click="projectConfigMode = undefined"
>
<v-icon>mdi-close</v-icon>
</v-btn>
Expand Down Expand Up @@ -339,7 +339,7 @@ export default {
density="compact"
autofocus
@keydown.enter="create"
@keydown.esc="projectConfigMode = true"
@keydown.esc="projectConfigMode = 'existing'"
/>
<v-btn
color="primary"
Expand Down
2 changes: 1 addition & 1 deletion web/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Map, Popup } from "maplibre-gl";
// Project
export const availableProjects = ref<Project[]>([]);
export const currentProject = ref<Project>();
export const projectConfigMode = ref<boolean | string>(false);
export const projectConfigMode = ref<"new" | "existing">();

// Datasets
export const availableDatasets = ref<Dataset[]>();
Expand Down

0 comments on commit 6ce1e6f

Please sign in to comment.