fix(ui): repair settings editing and workflow diagnostics
This commit is contained in:
1 parent
3229de9b3b
commit
41cd938748
46 files changed
+708
-240
No files matched your search
@@ -1,11 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { computed } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import { hiddenPaths, settingsNav } from "@/lib/nav";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useSessionStore } from "@/stores/session";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
import RestartPendingBanner from "./RestartPendingBanner.vue";
|
||||
import SettingsSaveBar from "./SettingsSaveBar.vue";
|
||||
|
||||
@@ -13,22 +12,6 @@ const route = useRoute();
|
||||
const session = useSessionStore();
|
||||
const items = computed(() => settingsNav(hiddenPaths(session.sections)));
|
||||
|
||||
// Drafts live in the store, so moving between Settings pages keeps them;
|
||||
// leaving Settings, or the page, with edits unsaved asks first.
|
||||
const store = useSettingsStore();
|
||||
const dirty = () => store.dirtyKinds.length > 0;
|
||||
const removeGuard = useRouter().beforeEach((to) => {
|
||||
if (to.meta.settings || !dirty()) return true;
|
||||
return window.confirm("Leave Settings with unsaved changes?");
|
||||
});
|
||||
const warnUnload = (event: BeforeUnloadEvent) => {
|
||||
if (dirty()) event.preventDefault();
|
||||
};
|
||||
onMounted(() => window.addEventListener("beforeunload", warnUnload));
|
||||
onBeforeUnmount(() => {
|
||||
removeGuard();
|
||||
window.removeEventListener("beforeunload", warnUnload);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -65,7 +48,7 @@ onBeforeUnmount(() => {
|
||||
</nav>
|
||||
<!-- At least a screen tall, so the sticky save bar always rests at the
|
||||
viewport's bottom edge rather than under the last setting. -->
|
||||
<div class="flex min-h-screen min-w-0 flex-1 flex-col">
|
||||
<div class="mx-auto flex min-h-screen w-full min-w-0 max-w-[80ch] flex-1 flex-col">
|
||||
<RestartPendingBanner />
|
||||
<!-- Room below the last setting, so it can be scrolled up to eye level. -->
|
||||
<div class="pb-[40vh]">
|
||||
|
||||
Reference in new issue
Block a user