fix(qa): ISSUE-002 — confirm saves and make Cancel work on the admin forms

Admin.vue rendered the create forms without listening for their "done"
and "cancel" events, so a successful save gave no feedback and every
Cancel button did nothing. Show a "Saved." notice on done, and remount
the form on cancel to clear it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-19 19:53:19 +01:00
co-authored by Claude Opus 5.5
parent 48e18ba67d
commit 3d504da94c
+35 -2
View File
@@ -42,6 +42,27 @@ const activeSection = computed(() =>
sections.find((s) => s.id === active.value), sections.find((s) => s.id === active.value),
); );
// The create forms emit "done"/"cancel" and leave it to the host to react
// (the Feed widget's modal closes on them). Here the form stays open, so
// "done" needs a visible confirmation, and "cancel" remounts the form via
// formKey, which is the only way to clear fields the form keeps to itself.
const notice = ref("");
const formKey = ref(0);
function selectSection(id) {
active.value = id;
notice.value = "";
}
function onDone() {
notice.value = "Saved.";
}
function onCancel() {
notice.value = "";
formKey.value++;
}
// The requiresAdmin guard only runs on navigation, so logging out in place // The requiresAdmin guard only runs on navigation, so logging out in place
// would leave the panel on screen for a signed-out visitor; leave it instead. // would leave the panel on screen for a signed-out visitor; leave it instead.
async function handleLogout() { async function handleLogout() {
@@ -70,7 +91,7 @@ async function handleLogout() {
:key="section.id" :key="section.id"
class="admin-nav-link" class="admin-nav-link"
:class="{ 'is-active': active === section.id }" :class="{ 'is-active': active === section.id }"
@click="active = section.id" @click="selectSection(section.id)"
> >
{{ section.label }} {{ section.label }}
</button> </button>
@@ -87,7 +108,13 @@ async function handleLogout() {
</nav> </nav>
<section class="admin-panel bdr-2 bg-surface"> <section class="admin-panel bdr-2 bg-surface">
<component :is="activeSection.component" /> <component
:is="activeSection.component"
:key="formKey"
@done="onDone"
@cancel="onCancel"
/>
<small v-if="notice" class="admin-notice">{{ notice }}</small>
</section> </section>
</div> </div>
</div> </div>
@@ -162,6 +189,12 @@ async function handleLogout() {
margin-top: 0; margin-top: 0;
} }
.admin-notice {
display: block;
margin-top: 8px;
color: var(--color-secondary);
}
@media (max-width: 700px) { @media (max-width: 700px) {
.admin-body { .admin-body {
grid-template-columns: 1fr; grid-template-columns: 1fr;