diff --git a/vue/src/views/admin/Admin.vue b/vue/src/views/admin/Admin.vue index 33851f5..82d5843 100644 --- a/vue/src/views/admin/Admin.vue +++ b/vue/src/views/admin/Admin.vue @@ -42,6 +42,27 @@ const activeSection = computed(() => 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 // would leave the panel on screen for a signed-out visitor; leave it instead. async function handleLogout() { @@ -70,7 +91,7 @@ async function handleLogout() { :key="section.id" class="admin-nav-link" :class="{ 'is-active': active === section.id }" - @click="active = section.id" + @click="selectSection(section.id)" > {{ section.label }} @@ -87,7 +108,13 @@ async function handleLogout() {
- + + {{ notice }}
@@ -162,6 +189,12 @@ async function handleLogout() { margin-top: 0; } +.admin-notice { + display: block; + margin-top: 8px; + color: var(--color-secondary); +} + @media (max-width: 700px) { .admin-body { grid-template-columns: 1fr;