feat(admin): View site link next to the user menu

Opens the admin origin's root in a new tab, like the WinterCMS backend.
This commit is contained in:
2026-10-10 14:01:44 +02:00
parent ea42f04ae0
commit 85fe541b03
7 changed files with 29 additions and 8 deletions

View File

@@ -6,8 +6,10 @@ import SectionPanel from './SectionPanel.vue'
import Breadcrumbs from './Breadcrumbs.vue'
import UserMenu from './UserMenu.vue'
import Toast from '../ui/Toast.vue'
import { ExternalLink } from '@lucide/vue'
import { activeEntry } from '../../state/useNavigation'
import { useSidebar } from '../../state/useSidebar'
import { t } from '../../app/i18n'
// Navigation shell (design: Navigation shell and Top header; D-06, D-10):
// the plugin rail, the active plugin's section panel (hidden when the
@@ -20,6 +22,10 @@ const { collapsed, watchViewport } = useSidebar()
const stopViewport = watchViewport()
onBeforeUnmount(stopViewport)
// "View site" (WinterCMS parity) opens the public site in a new tab: the
// admin page's own origin, without the admin path prefix.
const siteURL = `${window.location.origin}/`
const active = computed(() => activeEntry(String(route.params.vendor ?? ''), String(route.params.plugin ?? '')))
</script>
@@ -30,7 +36,20 @@ const active = computed(() => activeEntry(String(route.params.vendor ?? ''), Str
<div class="flex min-w-0 flex-1 flex-col">
<header class="flex h-header shrink-0 items-center justify-between gap-4 border-b border-border bg-surface pr-6 pl-8">
<Breadcrumbs />
<UserMenu />
<div class="flex shrink-0 items-center gap-1">
<a
data-view-site
:href="siteURL"
target="_blank"
rel="noopener noreferrer"
:title="t('backend::lang.nav.view_site')"
:aria-label="t('backend::lang.nav.view_site')"
class="flex size-input items-center justify-center rounded-inner text-muted transition-colors duration-150 ease-out hover:bg-hover hover:text-text"
>
<ExternalLink class="size-[18px]" aria-hidden="true" />
</a>
<UserMenu />
</div>
</header>
<main class="min-w-0 flex-1 px-8 py-7">
<slot />