AI-native design editor. Open-source Figma alternative.
feat(app): add a Back to workspace button to the editor header
Rob Coenend85e2ec5e192
diff --git a/packages/vue/src/i18n/messages/dialogs.ts b/packages/vue/src/i18n/messages/dialogs.tsindex 58ba6b6a7..de0761902 100644--- a/packages/vue/src/i18n/messages/dialogs.ts+++ b/packages/vue/src/i18n/messages/dialogs.ts@@ -165,6 +165,7 @@ export const dialogMessageDefaults = {settingsStorage: 'Cloud storage',storageWorkspace: 'Storage workspace',openStorageWorkspace: 'Open workspace',+ backToStorageWorkspace: 'Back to workspace',newStoredDocument: 'New document',emptyStorageWorkspace: 'No stored documents yet.',loadingDocuments: 'Loading documents…',diff --git a/src/components/Shell/AppMenu.vue b/src/components/Shell/AppMenu.vueindex b7ceacd1f..af4b1a6dc 100644--- a/src/components/Shell/AppMenu.vue+++ b/src/components/Shell/AppMenu.vue@@ -1,5 +1,6 @@<script setup lang="ts">import { watch } from 'vue'+import { useRouter } from 'vue-router'import { templateRef } from '@vueuse/core'import {@@ -17,6 +18,7 @@ import {MenubarTrigger} from 'reka-ui'+import IconArrowLeft from '~icons/lucide/arrow-left'import IconChevronRight from '~icons/lucide/chevron-right'import { vTestId, useI18n } from '@open-pencil/vue'@@ -42,6 +44,15 @@ import { useEditorStore } from '@/app/editor/active-store'import { openSettingsDialog } from '@/app/settings/dialog'const store = useEditorStore()+const router = useRouter()++// The workspace is the app's top level. Browser back is history-dependent (and+// absent in the desktop shell), so the way back has to be an explicit+// destination, present on both platforms. Shown unconditionally: StorageView+// prompts for setup itself when storage isn't configured yet.+async function backToWorkspace(): Promise<void> {+ await router.push('/storage')+}const { rename, editingName, startRename, commitRename } = useDocumentNameRename(store)const nameInput = templateRef<HTMLInputElement>('nameInput')@@ -60,6 +71,15 @@ const subMenuCls = useMenuUI({ content: 'min-w-44' })<template><div class="shrink-0 border-b border-border">+ <button+ type="button"+ data-test-id="app-back-to-workspace"+ class="flex w-full cursor-pointer items-center gap-1.5 border-b border-border px-2 py-1.5 text-xs text-muted transition-colors hover:bg-hover hover:text-surface"+ @click="backToWorkspace"+ >+ <IconArrowLeft class="size-3.5 shrink-0" />+ <span class="truncate">{{ dialogs.backToStorageWorkspace }}</span>+ </button><div class="flex items-center gap-2 px-2 py-1.5"><img data-test-id="app-logo" src="/favicon-32.png" class="size-4" alt="OpenPencil" /><input