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 />

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -7,8 +7,8 @@
<meta name="summer-admin-base" content="__SUMMER_ADMIN_BASE__" />
<link rel="icon" href="./favicon.ico" sizes="48x48" />
<title>SummerCMS</title>
<script type="module" crossorigin src="./assets/index-CuK_LdRk.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-DgNySjE5.css">
<script type="module" crossorigin src="./assets/index-Bqh6wnN4.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-DhIJo93I.css">
</head>
<body>
<div id="app"></div>

View File

@@ -18,6 +18,7 @@ nav:
collapse: Collapse menu
expand: Expand menu
user_menu: User menu
view_site: View site
page:
not_found: Page not found.
list:

View File

@@ -20,6 +20,7 @@ nav:
collapse: Zwiń menu
expand: Rozwiń menu
user_menu: Menu użytkownika
view_site: Zobacz stronę
page:
not_found: Nie znaleziono strony.
list: