Skip to content

armgit / posta

Public Imported from GitHub
0

Self-hosted email delivery platform that enables applications to send emails via HTTP APIs while handling SMTP delivery, templates, storage, security, and analytics. Fully self-hostable alternative to services like SendGrid or Mailgun.

feat(web): redesign sidebar information architecture (#103)

Philipp Ballhausen68c310cefc5c
diff --git a/web/src/components/SectionHeader.vue b/web/src/components/SectionHeader.vue
new file mode 100644
index 0000000..f789806
--- /dev/null
+++ b/web/src/components/SectionHeader.vue
@@ -0,0 +1,33 @@
+<script setup lang="ts">
+import { useRoute } from 'vue-router'
+
+defineProps<{
+ title: string
+ tabs: { label: string; to: string }[]
+}>()
+
+const route = useRoute()
+
+function isActive(to: string): boolean {
+ return route.path === to || route.path.startsWith(to + '/')
+}
+</script>
+
+<template>
+ <div>
+ <div class="page-header">
+ <h1>{{ title }}</h1>
+ </div>
+ <div class="tabs">
+ <router-link v-for="t in tabs" :key="t.to" :to="t.to" class="tab" :class="{ active: isActive(t.to) }">
+ {{ t.label }}
+ </router-link>
+ </div>
+ </div>
+</template>
+
+<style scoped>
+.tab {
+ text-decoration: none;
+}
+</style>
diff --git a/web/src/layouts/DashboardLayout.vue b/web/src/layouts/DashboardLayout.vue
index b1cd7e5..874948a 100644
--- a/web/src/layouts/DashboardLayout.vue
+++ b/web/src/layouts/DashboardLayout.vue
@@ -24,6 +24,10 @@ function closeUserMenu(e: MouseEvent) {
if (el && !el.contains(e.target as Node)) {
userMenuOpen.value = false
}
+ if (wsSwitcherOpen.value) {
+ const inSwitcher = (e.target as Element)?.closest?.('.ws-switcher')
+ if (!inSwitcher) wsSwitcherOpen.value = false
+ }
}
const toggleSidebar = () => {
@@ -48,48 +52,181 @@ onBeforeUnmount(() => {
const user = computed(() => auth.user)
-const navItems = [
- { name: 'Dashboard', path: '/', icon: 'grid' },
- { name: 'Analytics', path: '/analytics', icon: 'bar-chart' },
- { name: 'Emails', path: '/emails', icon: 'mail' },
- { name: 'Inbound', path: '/inbound-emails', icon: 'inbox' },
- { name: 'Templates', path: '/templates', icon: 'file-text' },
- { name: 'Languages', path: '/languages', icon: 'type' },
- { name: 'Stylesheets', path: '/stylesheets', icon: 'edit-3' },
-
- { name: 'Webhooks', path: '/webhooks', icon: 'link' },
- { name: 'Deliveries', path: '/webhook-deliveries', icon: 'activity' },
- { name: 'Contacts', path: '/contacts', icon: 'users' },
- { name: 'Subscribers', path: '/subscribers', icon: 'users' },
- { name: 'Subscriber Lists', path: '/subscriber-lists', icon: 'list' },
- { name: 'Campaigns', path: '/campaigns', icon: 'send' },
- { name: 'Unsubscribe Lists', path: '/unsubscribe-lists', icon: 'mail-x' },
- { name: 'Bounces', path: '/bounces', icon: 'alert-triangle' },
- { name: 'API Keys', path: '/api-keys', icon: 'key' },
- { name: 'Audit Log', path: '/audit-log', icon: 'activity' },
- { name: 'Workspaces', path: '/workspaces', icon: 'briefcase' },
- { name: 'Domains', path: '/domains', icon: 'globe' },
- { name: 'SMTP Servers', path: '/smtp-servers', icon: 'server' },
- { name: 'Settings', path: '/settings', icon: 'settings' },
+interface NavItem {
+ name: string
+ path: string
+ icon: string
+ /** Render as a plain external link instead of a router-link. */
+ external?: boolean
+ /** Only show when a real workspace (not Personal) is selected. */
+ requiresWorkspace?: boolean
+ /** Only show when the backend exposes the OpenAPI docs. */
+ requiresOpenapiDocs?: boolean
+ /** Deep-link into a WorkspaceSettings tab of the current workspace. */
+ workspaceTab?: 'members' | 'plan'
+ /** Additional route path prefixes that should keep this item highlighted (grouped tab pages). */
+ matchPaths?: string[]
+ /** Nested items shown indented under this entry. */
+ children?: NavItem[]
+}
+
+interface NavSection {
+ id: string
+ title: string
+ items: NavItem[]
+ /** Only rendered for platform admins. */
+ admin?: boolean
+ /** Whether the section starts expanded. Defaults to true. */
+ defaultOpen?: boolean
+}
+
+const navSections: NavSection[] = [
+ {
+ id: 'overview',
+ title: 'Overview',
+ items: [
+ { name: 'Dashboard', path: '/', icon: 'grid' },
+ { name: 'Analytics', path: '/analytics', icon: 'bar-chart' },
+ ],
+ },
+ {
+ id: 'sending',
+ title: 'Sending',
+ items: [
+ { name: 'Emails', path: '/emails', icon: 'mail' },
+ { name: 'Campaigns', path: '/campaigns', icon: 'send' },
+ { name: 'Templates', path: '/templates', icon: 'file-text', matchPaths: ['/stylesheets', '/languages'] },
+ ],
+ },
+ {
+ id: 'inbound',
+ title: 'Inbound',
+ items: [
+ { name: 'Inbound Emails', path: '/inbound-emails', icon: 'inbox' },
+ ],
+ },
+ {
+ id: 'audience',
+ title: 'Audience',
+ items: [
+ { name: 'Contacts', path: '/contacts', icon: 'users' },
+ { name: 'Subscribers', path: '/subscribers', icon: 'user-check', matchPaths: ['/subscriber-lists', '/unsubscribe-lists'] },
+ ],
+ },
+ {
+ id: 'deliverability',
+ title: 'Deliverability',
+ items: [
+ { name: 'Bounces & Suppressions', path: '/bounces', icon: 'alert-triangle' },
+ ],
+ },
+ {
+ id: 'developers',
+ title: 'Developers',
+ defaultOpen: false,
+ items: [
+ { name: 'API Keys & Docs', path: '/api-keys', icon: 'key' },
+ { name: 'Webhooks', path: '/webhooks', icon: 'link', matchPaths: ['/webhook-deliveries'] },
+ ],
+ },
+ {
+ id: 'infrastructure',
+ title: 'Infrastructure',
+ defaultOpen: false,
+ items: [
+ { name: 'Domains', path: '/domains', icon: 'globe' },
+ { name: 'SMTP Servers', path: '/smtp-servers', icon: 'server' },
+ ],
+ },
+ {
+ id: 'workspace',
+ title: 'Workspace',
+ defaultOpen: false,
+ items: [
+ { name: 'Settings', path: '/settings', icon: 'settings' },
+ { name: 'Audit Log', path: '/audit-log', icon: 'history' },
+ ],
+ },
+ {
+ id: 'admin',
+ title: 'Admin',
+ admin: true,
+ defaultOpen: false,
+ items: [
+ { name: 'Users', path: '/admin/users', icon: 'users' },
+ { name: 'Plans', path: '/admin/plans', icon: 'layers' },
+ { name: 'Shared Servers', path: '/admin/servers', icon: 'server' },
+ { name: 'OAuth', path: '/admin/oauth', icon: 'shield' },
+ { name: 'Jobs', path: '/admin/jobs', icon: 'clock' },
+ { name: 'Metrics', path: '/admin/metrics', icon: 'pie-chart' },
+ { name: 'Events', path: '/admin/events', icon: 'zap' },
+ { name: 'Platform Settings', path: '/admin/settings', icon: 'settings' },
+ { name: 'About', path: '/about', icon: 'info' },
+ ],
+ },
]
-const adminItems = [
- { name: 'Users', path: '/admin/users', icon: 'users' },
- { name: 'Plans', path: '/admin/plans', icon: 'layers' },
- { name: 'Shared Servers', path: '/admin/servers', icon: 'server' },
- { name: 'Jobs', path: '/admin/jobs', icon: 'clock' },
- { name: 'Metrics', path: '/admin/metrics', icon: 'bar-chart' },
- { name: 'Events', path: '/admin/events', icon: 'activity' },
- { name: 'OAuth', path: '/admin/oauth', icon: 'key' },
- { name: 'Settings', path: '/admin/settings', icon: 'settings' },
- { name: 'About', path: '/about', icon: 'info' },
-]
+const SECTION_STATE_KEY = 'posta_nav_sections'
+
+function loadSectionState(): Record<string, boolean> {
+ const defaults: Record<string, boolean> = {}
+ navSections.forEach((s) => {
+ defaults[s.id] = s.defaultOpen !== false
+ })
+ try {
+ const saved = JSON.parse(localStorage.getItem(SECTION_STATE_KEY) || '{}')
+ return { ...defaults, ...saved }
+ } catch {
+ return defaults
+ }
+}
+
+const sectionOpen = ref<Record<string, boolean>>(loadSectionState())
+
+function toggleSection(id: string) {
+ sectionOpen.value[id] = !sectionOpen.value[id]
+ localStorage.setItem(SECTION_STATE_KEY, JSON.stringify(sectionOpen.value))
+}
+
+const visibleSections = computed(() =>
+ navSections.filter((s) => !s.admin || auth.isAdmin)
+)
+
+function sectionItems(section: NavSection): NavItem[] {
+ return section.items.filter((item) => {
+ if (item.requiresWorkspace && !wsStore.isWorkspaceContext) return false
+ if (item.requiresOpenapiDocs && !appInfo.value?.openapi_docs) return false
+ return true
+ })
+}
+
+/** Resolve the effective target of an item (handles workspace tab deep-links). */
+function itemTo(item: NavItem): string {
+ if (item.workspaceTab) {
+ return `/workspaces/${wsStore.currentWorkspaceId}?tab=${item.workspaceTab}`
+ }
+ return item.path
+}
function isActive(path: string): boolean {
if (path === '/') return route.path === '/'
return route.path === path || route.path.startsWith(path + '/')
}
+function isItemActive(item: NavItem): boolean {
+ if (item.workspaceTab) {
+ return (
+ route.path === `/workspaces/${wsStore.currentWorkspaceId}` &&
+ (route.query.tab || 'members') === item.workspaceTab
+ )
+ }
+ // "Manage Workspaces…" should only highlight on the list page itself,
+ // not on a workspace detail/tab page.
+ if (item.path === '/workspaces') return route.path === '/workspaces'
+ if (item.matchPaths?.some((p) => route.path === p || route.path.startsWith(p + '/'))) return true
+ return isActive(item.path)
+}
+
function navigate(path: string) {
router.push(path)
}
@@ -100,6 +237,18 @@ function switchContext(wsId: number | null) {
router.push('/')
}
+function manageWorkspaces() {
+ wsSwitcherOpen.value = false
+ mobileOpen.value = false
+ router.push('/workspaces')
+}
+
+function createWorkspace() {
+ wsSwitcherOpen.value = false
+ mobileOpen.value = false
+ router.push('/workspaces?create=1')
+}
+
function logout() {
auth.logout()
router.push('/login')
@@ -130,6 +279,13 @@ function getIcon(name: string): string {
'layers': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><path d="M9 1.5L1.5 6 9 10.5 16.5 6 9 1.5z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M1.5 12L9 16.5 16.5 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M1.5 9L9 13.5 16.5 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
'info': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><circle cx="9" cy="9" r="7" stroke="currentColor" stroke-width="1.5"/><path d="M9 12.75V9M9 5.25h.007" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',
'mail-x': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><path d="M16 8.5V4a2 2 0 00-2-2H4a2 2 0 00-2 2v8a2 2 0 002 2h6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M2 4.5l7 5 7-5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.5 12.5l3.5 3.5M16 12.5l-3.5 3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',
+ 'user-check': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><path d="M11.25 15.75v-1.5a3 3 0 00-3-3h-4.5a3 3 0 00-3 3v1.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><circle cx="6" cy="5.25" r="3" stroke="currentColor" stroke-width="1.5"/><path d="M12.75 9l1.5 1.5 3-3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
+ 'credit-card': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><rect x="1.5" y="3.75" width="15" height="10.5" rx="1.5" stroke="currentColor" stroke-width="1.5"/><path d="M1.5 7.5h15" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/><path d="M4.5 11.25h3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',
+ 'history': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><path d="M2.25 9a6.75 6.75 0 113.02 5.62" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M2.25 13.5V9.75H6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M9 5.25V9l2.25 1.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
+ 'shield': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><path d="M9 1.5l6 2.25v4.5c0 3.6-2.55 6.6-6 7.5-3.45-.9-6-3.9-6-7.5v-4.5L9 1.5z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M6.75 9l1.5 1.5 3-3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
+ 'pie-chart': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><path d="M16.5 11.4A7.5 7.5 0 116.6 1.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M16.5 9A7.5 7.5 0 009 1.5V9h7.5z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
+ 'zap': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><path d="M9.75 1.5L3 10.5h5.25L8.25 16.5 15 7.5H9.75l0-6z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
+ 'code': '<svg width="18" height="18" viewBox="0 0 18 18" fill="none"><path d="M12 4.5L16.5 9 12 13.5M6 4.5L1.5 9 6 13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
}
return icons[name] || ''
}
@@ -152,7 +308,7 @@ function getIcon(name: string): string {
</div>
<!-- Workspace Switcher -->
- <div v-if="wsStore.workspaces.length > 0" class="ws-switcher">
+ <div class="ws-switcher">
<div class="ws-switcher-toggle" @click="wsSwitcherOpen = !wsSwitcherOpen">
<div class="ws-switcher-current">
<div class="ws-avatar">{{ wsStore.currentWorkspace?.name?.charAt(0)?.toUpperCase() || 'P' }}</div>
@@ -174,49 +330,50 @@ function getIcon(name: string): string {
<span>{{ ws.name }}</span>
<span class="ws-role-badge">{{ ws.role }}</span>
</div>
+ <div class="ws-switcher-divider"></div>
+ <div class="ws-switcher-action" @click="createWorkspace">
+ <span class="ws-switcher-action-icon">+</span>
+ <span>Create workspace</span>
+ </div>
+ <div class="ws-switcher-action" @click="manageWorkspaces">
+ <span class="nav-icon" v-html="getIcon('briefcase')"></span>
+ <span>Manage workspaces…</span>
+ </div>
</div>
</div>
<nav class="sidebar-nav">
- <div class="nav-section">
- <router-link v-for="item in navItems" :key="item.path" class="nav-item"
- :class="{ active: isActive(item.path) }" :title="sidebarCollapsed ? item.name : ''" :to="item.path">
- <span class="nav-icon" v-html="getIcon(item.icon)"></span>
- <span v-if="!sidebarCollapsed" class="nav-label">{{ item.name }}</span>
- </router-link>
-
- </div>
- <div v-if="auth.isAdmin" class="nav-section">
- <div class="nav-section-title">Admin</div>
- <router-link v-for="item in adminItems" :key="item.path" class="nav-item"
- :class="{ active: isActive(item.path) }" :title="sidebarCollapsed ? item.name : ''" :to="item.path">
- <span class="nav-icon" v-html="getIcon(item.icon)"></span>
- <span v-if="!sidebarCollapsed" class="nav-label">{{ item.name }}</span>
- </router-link>
+ <div v-for="section in visibleSections" :key="section.id" class="nav-section">
+ <button v-if="!sidebarCollapsed" class="nav-section-title nav-section-toggle"
+ :aria-expanded="sectionOpen[section.id]" @click="toggleSection(section.id)">
+ <span>{{ section.title }}</span>
+ <svg class="nav-section-chevron" :class="{ collapsed: !sectionOpen[section.id] }" width="12" height="12"
+ viewBox="0 0 16 16" fill="none">
+ <path d="M4 6l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
+ stroke-linejoin="round" />
+ </svg>
+ </button>
+ <div v-show="sidebarCollapsed || sectionOpen[section.id]" class="nav-section-items">
+ <template v-for="item in sectionItems(section)" :key="item.name">
+ <a v-if="item.external" class="nav-item" :href="item.path" target="_blank" rel="noopener noreferrer"
+ :title="sidebarCollapsed ? item.name : ''">
+ <span class="nav-icon" v-html="getIcon(item.icon)"></span>
+ <span v-if="!sidebarCollapsed" class="nav-label">{{ item.name }}</span>
+ </a>
+ <router-link v-else class="nav-item" :class="{ active: isItemActive(item) }"
+ :title="sidebarCollapsed ? item.name : ''" :to="itemTo(item)">
+ <span class="nav-icon" v-html="getIcon(item.icon)"></span>
+ <span v-if="!sidebarCollapsed" class="nav-label">{{ item.name }}</span>
+ </router-link>
+ <router-link v-for="child in item.children" :key="child.path" class="nav-item nav-subitem"
+ :class="{ active: isItemActive(child) }" :title="sidebarCollapsed ? child.name : ''" :to="child.path">
+ <span class="nav-icon" v-html="getIcon(child.icon)"></span>
+ <span v-if="!sidebarCollapsed" class="nav-label">{{ child.name }}</span>
+ </router-link>
+ </template>
+ </div>
</div>
</nav>
-
- <div class="sidebar-footer">
- <div class="nav-section">
- <template v-if="appInfo?.openapi_docs">
- <div class="nav-section-title">Docs</div>
- <a class="nav-item" href="/docs" target="_blank" rel="noopener noreferrer"
- :title="sidebarCollapsed ? 'Scalar UI' : ''">
- <span class="nav-icon" v-html="getIcon('book-open')"></span>
- <span class="nav-label">Scalar UI</span>
- </a>
- <a class="nav-item" href="/swagger" target="_blank" rel="noopener noreferrer"
- :title="sidebarCollapsed ? 'Swagger UI' : ''">
- <span class="nav-icon" v-html="getIcon('file-text')"></span>
- <span class="nav-label">Swagger UI</span>
- </a>
- </template>
-
- <div v-if="appInfo && !sidebarCollapsed" class="sidebar-version">
- <span class="nav-label">v{{ appInfo.version }}</span>
- </div>
- </div>
- </div>
</aside>
<div class="main-wrapper">
@@ -350,7 +507,7 @@ function getIcon(name: string): string {
</div>
<!-- ws Switcher (mobile) -->
- <div v-if="wsStore.workspaces.length > 0" class="ws-switcher">
+ <div class="ws-switcher">
<div class="ws-switcher-toggle" @click="wsSwitcherOpen = !wsSwitcherOpen">
<div style="display: flex; align-items: center; gap: 8px; overflow: hidden;">
<span class="ws-avatar">
@@ -381,29 +538,51 @@ function getIcon(name: string): string {
<small v-if="ws.role" style="font-size: 0.75rem; opacity: 0.7;">{{ ws.role }}</small>
</div>
</div>
+
+ <div class="ws-switcher-divider"></div>
+ <div class="ws-option" @click="createWorkspace">
+ <span class="ws-switcher-action-icon">+</span>
+ <span>Create workspace</span>
+ </div>
+ <div class="ws-option" @click="manageWorkspaces">
+ <span class="nav-icon" v-html="getIcon('briefcase')"></span>
+ <span>Manage workspaces…</span>
+ </div>
</div>
</Transition>
</div>
<nav class="sidebar-nav">
- <div class="nav-section">
- <router-link v-for="item in navItems" :key="item.path" class="nav-item"
- :class="{ active: isActive(item.path) }" @click="mobileOpen = false" :to="item.path">
- <span class="nav-icon" v-html="getIcon(item.icon)"></span>
- <span v-if="!sidebarCollapsed" class="nav-label">{{ item.name }}</span>
- </router-link>
- </div>
-
- <!-- Admin section -->
- <div v-if="auth.isAdmin" class="nav-section">
- <div class="nav-section-title">Admin</div>
- <router-link v-for="item in adminItems" :key="item.path" class="nav-item"
- :class="{ active: isActive(item.path) }" @click="mobileOpen = false" :to="item.path">
- <span class="nav-icon" v-html="getIcon(item.icon)"></span>
- <span v-if="!sidebarCollapsed" class="nav-label">{{ item.name }}</span>
- </router-link>
+ <div v-for="section in visibleSections" :key="section.id" class="nav-section">
+ <button class="nav-section-title nav-section-toggle" :aria-expanded="sectionOpen[section.id]"
+ @click="toggleSection(section.id)">
+ <span>{{ section.title }}</span>
+ <svg class="nav-section-chevron" :class="{ collapsed: !sectionOpen[section.id] }" width="12" height="12"
+ viewBox="0 0 16 16" fill="none">
+ <path d="M4 6l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
+ stroke-linejoin="round" />
+ </svg>
+ </button>
+ <div v-show="sectionOpen[section.id]" class="nav-section-items">
+ <template v-for="item in sectionItems(section)" :key="item.name">
+ <a v-if="item.external" class="nav-item" :href="item.path" target="_blank" rel="noopener noreferrer"
+ @click="mobileOpen = false">
+ <span class="nav-icon" v-html="getIcon(item.icon)"></span>
+ <span class="nav-label">{{ item.name }}</span>
+ </a>
+ <router-link v-else class="nav-item" :class="{ active: isItemActive(item) }"
+ @click="mobileOpen = false" :to="itemTo(item)">
+ <span class="nav-icon" v-html="getIcon(item.icon)"></span>
+ <span class="nav-label">{{ item.name }}</span>
+ </router-link>
+ <router-link v-for="child in item.children" :key="child.path" class="nav-item nav-subitem"
+ :class="{ active: isItemActive(child) }" @click="mobileOpen = false" :to="child.path">
+ <span class="nav-icon" v-html="getIcon(child.icon)"></span>
+ <span class="nav-label">{{ child.name }}</span>
+ </router-link>
+ </template>
+ </div>
</div>
-
</nav>
</aside>
</Transition>
@@ -512,19 +691,23 @@ function getIcon(name: string): string {
}
.nav-section {
- margin-bottom: 8px;
+ margin-bottom: 2px;
+}
+
+.nav-section + .nav-section {
+ margin-top: 18px;
}
.nav-section-title {
- font-size: 11px;
+ font-size: 10.5px;
font-weight: 600;
color: var(--sidebar-text);
text-transform: uppercase;
- letter-spacing: 0.06em;
- padding: 12px 12px 6px;
+ letter-spacing: 0.08em;
+ padding: 4px 12px 6px;
white-space: nowrap;
overflow: hidden;
- opacity: 1;
+ opacity: 0.55;
transition: opacity var(--transition-slow);
}
@@ -535,15 +718,50 @@ function getIcon(name: string): string {
margin: 0;
}
+.nav-section-toggle {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ width: 100%;
+ background: none;
+ border: none;
+ cursor: pointer;
+ font-family: inherit;
+ border-radius: var(--radius-sm);
+}
+
+.nav-section-toggle:hover {
+ color: var(--sidebar-text-active);
+}
+
+.nav-section-chevron {
+ flex-shrink: 0;
+ opacity: 0.7;
+ transition: transform var(--transition);
+}
+
+.nav-section-chevron.collapsed {
+ transform: rotate(-90deg);
+}
+
+.nav-subitem {
+ padding-left: 34px;
+ font-size: 13px;
+}
+
+.sidebar-collapsed .sidebar:not(.sidebar-mobile) .nav-subitem {
+ padding-left: 9px;
+}
+
.nav-item {
display: flex;
align-items: center;
gap: 10px;
- padding: 9px 12px;
+ padding: 6px 12px;
border-radius: var(--radius);
color: var(--sidebar-text);
- font-size: 14px;
- font-weight: 500;
+ font-size: 13px;
+ font-weight: 400;
cursor: pointer;
transition: background var(--transition), color var(--transition);
text-decoration: none;
@@ -559,6 +777,7 @@ function getIcon(name: string): string {
.nav-item.active {
background: var(--sidebar-hover);
color: var(--sidebar-text-active);
+ font-weight: 500;
}
.nav-item.active::before {
@@ -575,8 +794,13 @@ function getIcon(name: string): string {
.nav-icon {
flex-shrink: 0;
- width: 18px;
- height: 18px;
+ width: 17px;
+ height: 17px;
+ opacity: 0.7;
+}
+
+.nav-item.active .nav-icon {
+ opacity: 1;
}
.nav-label {
@@ -595,31 +819,6 @@ function getIcon(name: string): string {
padding: 9px;
}
-/* ─── Sidebar footer ─── */
-.sidebar-footer {
- border-top: 1px solid var(--sidebar-border);
- padding: 8px;
- flex-shrink: 0;
-}
-
-.sidebar-version {
- padding: 8px 12px;
- font-size: 12px;
- color: var(--sidebar-text);
- opacity: 0.6;
- white-space: nowrap;
- overflow: hidden;
-}
-
-.sidebar-collapsed .sidebar:not(.sidebar-mobile) .sidebar-version {
- opacity: 0;
-}
-
-.sidebar-collapsed .sidebar:not(.sidebar-mobile) .sidebar-footer .nav-item {
- justify-content: center;
- padding: 9px;
-}
-
/* ─── Main wrapper ─── */
.main-wrapper {
flex: 1;
@@ -797,6 +996,41 @@ function getIcon(name: string): string {
letter-spacing: 0.05em;
}
+.ws-switcher-divider {
+ height: 1px;
+ background: var(--border-primary, #e5e7eb);
+ margin: 4px 6px;
+}
+
+.ws-switcher-action {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 10px;
+ font-size: 13px;
+ font-weight: 500;
+ color: var(--text-secondary, #4b5563);
+ border-radius: var(--radius-sm, 6px);
+ cursor: pointer;
+ transition: all var(--transition, 150ms ease);
+}
+
+.ws-switcher-action:hover {
+ background: var(--bg-secondary, #f9fafb);
+ color: var(--text-primary, #111827);
+}
+
+.ws-switcher-action-icon {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 18px;
+ height: 18px;
+ font-size: 18px;
+ font-weight: 400;
+ line-height: 1;
+}
+
/* ─── User menu ─── */
.user-menu {
position: relative;
diff --git a/web/src/views/apikeys/ApiKeys.vue b/web/src/views/apikeys/ApiKeys.vue
index 38ec197..a662f9f 100644
--- a/web/src/views/apikeys/ApiKeys.vue
+++ b/web/src/views/apikeys/ApiKeys.vue
@@ -2,6 +2,7 @@
import { ref, onMounted } from 'vue'
import { apiKeysApi } from '../../api/apikeys'
import { settingsApi } from '../../api/settings'
+import { infoApi, type AppInfo } from '../../api/info'
import type { ApiKey, ApiKeyCreateResponse, Pageable } from '../../api/types'
import { useNotificationStore } from '../../stores/notification'
import { useConfirm } from '../../composables/useConfirm'
@@ -16,6 +17,7 @@ const { confirm } = useConfirm()
const keys = ref<ApiKey[]>([])
const loading = ref(true)
+const appInfo = ref<AppInfo | null>(null)
const showCreateModal = ref(false)
const newKeyName = ref('')
@@ -167,6 +169,7 @@ const { watchClickStart, confirmClickEnd } = useModalSafeClose(() => {
onMounted(() => {
loadSettings()
+ infoApi.get().then((res) => { appInfo.value = res.data.data }).catch(() => {})
})
</script>
@@ -177,6 +180,17 @@ onMounted(() => {
<button v-if="wsStore.canEdit" class="btn btn-primary" @click="showCreateModal = true">Create Key</button>
</div>
+ <div v-if="appInfo?.openapi_docs" class="card api-docs-callout">
+ <div class="api-docs-text">
+ <strong>Developer resources</strong>
+ <span>Authenticate with your API key and explore the full HTTP API.</span>
+ </div>
+ <div class="api-docs-links">
+ <a class="btn btn-secondary btn-sm" href="/docs" target="_blank" rel="noopener noreferrer">API Reference</a>
+ <a class="btn btn-secondary btn-sm" href="/swagger" target="_blank" rel="noopener noreferrer">OpenAPI (Swagger)</a>
+ </div>
+ </div>
+
<div v-if="loading" class="loading-page">
<div class="spinner"></div>
</div>
@@ -324,3 +338,20 @@ onMounted(() => {
</div>
</div>
</template>
+
+<style scoped>
+.api-docs-callout {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 16px;
+ flex-wrap: wrap;
+ padding: 16px 20px;
+ margin-bottom: 20px;
+}
+.api-docs-text { display: flex; flex-direction: column; gap: 2px; }
+.api-docs-text strong { font-size: 14px; color: var(--text-primary); }
+.api-docs-text span { font-size: 13px; color: var(--text-secondary); }
+.api-docs-links { display: flex; gap: 8px; flex-shrink: 0; }
+.api-docs-links .btn { text-decoration: none; }
+</style>
diff --git a/web/src/views/languages/Languages.vue b/web/src/views/languages/Languages.vue
index 6ddd35e..ba8e25a 100644
--- a/web/src/views/languages/Languages.vue
+++ b/web/src/views/languages/Languages.vue
@@ -6,6 +6,7 @@ import { useNotificationStore } from '../../stores/notification'
import { useConfirm } from '../../composables/useConfirm'
import { useModalSafeClose } from '../../composables/useModalSafeClose';
import { useWorkspaceStore } from '../../stores/workspace'
+import SectionHeader from '@/components/SectionHeader.vue'
import { usePagination } from '@/composables/usePagination'
import Pagination from '@/components/Pagination.vue'
@@ -133,16 +134,24 @@ const { watchClickStart, confirmClickEnd } = useModalSafeClose(() => {
<template>
<div>
- <div class="page-header">
- <h1>Languages</h1>
- <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Add Language</button>
- </div>
+ <SectionHeader
+ title="Templates"
+ :tabs="[
+ { label: 'Templates', to: '/templates' },
+ { label: 'Stylesheets', to: '/stylesheets' },
+ { label: 'Languages', to: '/languages' },
+ ]"
+ />
<div v-if="loading" class="loading-page">
<div class="spinner"></div>
</div>
<div v-else class="card">
+ <div class="card-header">
+ <h2>Languages</h2>
+ <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Add Language</button>
+ </div>
<div v-if="languages.length === 0" class="empty-state">
<h3>No Languages</h3>
<p>Add languages to use for template localizations.</p>
diff --git a/web/src/views/stylesheets/Stylesheets.vue b/web/src/views/stylesheets/Stylesheets.vue
index b1f89f4..ada036f 100644
--- a/web/src/views/stylesheets/Stylesheets.vue
+++ b/web/src/views/stylesheets/Stylesheets.vue
@@ -6,6 +6,7 @@ import { useNotificationStore } from '../../stores/notification'
import { useConfirm } from '../../composables/useConfirm'
import { useModalSafeClose } from '../../composables/useModalSafeClose';
import { useWorkspaceStore } from '../../stores/workspace'
+import SectionHeader from '@/components/SectionHeader.vue'
import { usePagination } from '@/composables/usePagination'
import Pagination from '@/components/Pagination.vue'
@@ -110,16 +111,24 @@ const { watchClickStart, confirmClickEnd } = useModalSafeClose(() => {
<template>
<div>
- <div class="page-header">
- <h1>Stylesheets</h1>
- <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Create Stylesheet</button>
- </div>
+ <SectionHeader
+ title="Templates"
+ :tabs="[
+ { label: 'Templates', to: '/templates' },
+ { label: 'Stylesheets', to: '/stylesheets' },
+ { label: 'Languages', to: '/languages' },
+ ]"
+ />
<div v-if="loading" class="loading-page">
<div class="spinner"></div>
</div>
<div v-else class="card">
+ <div class="card-header">
+ <h2>Stylesheets</h2>
+ <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Create Stylesheet</button>
+ </div>
<div v-if="stylesheets.length === 0" class="empty-state">
<h3>No Stylesheets</h3>
<p>Create a stylesheet to reuse CSS across your email templates.</p>
diff --git a/web/src/views/subscriber-lists/SubscriberLists.vue b/web/src/views/subscriber-lists/SubscriberLists.vue
index 44e516f..216c4f2 100644
--- a/web/src/views/subscriber-lists/SubscriberLists.vue
+++ b/web/src/views/subscriber-lists/SubscriberLists.vue
@@ -7,6 +7,7 @@ import { useNotificationStore } from '../../stores/notification'
import { useConfirm } from '../../composables/useConfirm'
import { useModalSafeClose } from '../../composables/useModalSafeClose'
import { useWorkspaceStore } from '../../stores/workspace'
+import SectionHeader from '@/components/SectionHeader.vue'
import { usePagination } from '@/composables/usePagination'
import Pagination from '@/components/Pagination.vue'
@@ -119,16 +120,24 @@ const { watchClickStart, confirmClickEnd } = useModalSafeClose(() => {
<template>
<div>
- <div class="page-header">
- <h1>Subscriber Lists</h1>
- <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Create List</button>
- </div>
+ <SectionHeader
+ title="Subscribers"
+ :tabs="[
+ { label: 'Subscribers', to: '/subscribers' },
+ { label: 'Lists', to: '/subscriber-lists' },
+ { label: 'Unsubscribe', to: '/unsubscribe-lists' },
+ ]"
+ />
<div v-if="loading" class="loading-page">
<div class="spinner"></div>
</div>
<div v-else class="card">
+ <div class="card-header">
+ <h2>Lists</h2>
+ <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Create List</button>
+ </div>
<div v-if="lists.length === 0" class="empty-state">
<h3>No Lists</h3>
<p>Create a segment to organize your subscribers.</p>
diff --git a/web/src/views/subscribers/Subscribers.vue b/web/src/views/subscribers/Subscribers.vue
index a007e91..6f41d99 100644
--- a/web/src/views/subscribers/Subscribers.vue
+++ b/web/src/views/subscribers/Subscribers.vue
@@ -8,6 +8,7 @@ import { usePagination } from '../../composables/usePagination'
import { useNotificationStore } from '../../stores/notification'
import { useModalSafeClose } from '../../composables/useModalSafeClose'
import { useWorkspaceStore } from '../../stores/workspace'
+import SectionHeader from '../../components/SectionHeader.vue'
const router = useRouter()
const notify = useNotificationStore()
@@ -169,17 +170,14 @@ const { watchClickStart: watchImportStart, confirmClickEnd: confirmImportEnd } =
<template>
<div>
- <div class="page-header">
- <h1>Subscribers</h1>
- <div v-if="wsStore.canEdit" style="display: flex; gap: 8px">
- <button class="btn btn-secondary" @click="openImportJson">Import JSON</button>
- <button class="btn btn-secondary" :disabled="importingCsv" @click="triggerCsvUpload">
- {{ importingCsv ? 'Importing...' : 'Import CSV' }}
- </button>
- <button class="btn btn-primary" @click="openCreate">Add Subscriber</button>
- <input ref="csvFileInput" type="file" accept=".csv" style="display: none" @change="onCsvFileSelected" />
- </div>
- </div>
+ <SectionHeader
+ title="Subscribers"
+ :tabs="[
+ { label: 'Subscribers', to: '/subscribers' },
+ { label: 'Lists', to: '/subscriber-lists' },
+ { label: 'Unsubscribe', to: '/unsubscribe-lists' },
+ ]"
+ />
<div class="card">
<div class="card-header" style="display: flex; gap: 12px; align-items: center">
@@ -198,6 +196,14 @@ const { watchClickStart: watchImportStart, confirmClickEnd: confirmImportEnd } =
<option value="bounced">Bounced</option>
<option value="complained">Complained</option>
</select>
+ <div v-if="wsStore.canEdit" class="flex gap-2" style="margin-left: auto">
+ <button class="btn btn-secondary" @click="openImportJson">Import JSON</button>
+ <button class="btn btn-secondary" :disabled="importingCsv" @click="triggerCsvUpload">
+ {{ importingCsv ? 'Importing...' : 'Import CSV' }}
+ </button>
+ <button class="btn btn-primary" @click="openCreate">Add Subscriber</button>
+ <input ref="csvFileInput" type="file" accept=".csv" style="display: none" @change="onCsvFileSelected" />
+ </div>
</div>
<div v-if="loading" class="loading-page">
diff --git a/web/src/views/templates/Templates.vue b/web/src/views/templates/Templates.vue
index 3ed8596..77ec311 100644
--- a/web/src/views/templates/Templates.vue
+++ b/web/src/views/templates/Templates.vue
@@ -16,6 +16,7 @@ import { useModalSafeClose } from "../../composables/useModalSafeClose";
import { useWorkspaceStore } from "../../stores/workspace";
import { usePagination } from '@/composables/usePagination'
import Pagination from '@/components/Pagination.vue'
+import SectionHeader from '@/components/SectionHeader.vue'
@@ -204,32 +205,14 @@ onMounted(() => {
<template>
<div>
- <div class="page-header">
- <h1>Templates</h1>
- <div class="flex gap-2">
- <input
- ref="importInput"
- type="file"
- accept=".json,.html,.htm"
- style="display: none"
- @change="handleImportFile"
- />
- <button class="btn btn-secondary" @click="router.push('/templates/preview')">
- Preview Template
- </button>
- <button
- v-if="wsStore.canEdit"
- class="btn btn-secondary"
- :disabled="importing"
- @click="triggerImport"
- >
- {{ importing ? "Importing..." : "Import" }}
- </button>
- <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">
- Create Template
- </button>
- </div>
- </div>
+ <SectionHeader
+ title="Templates"
+ :tabs="[
+ { label: 'Templates', to: '/templates' },
+ { label: 'Stylesheets', to: '/stylesheets' },
+ { label: 'Languages', to: '/languages' },
+ ]"
+ />
<div class="card">
<div class="card-header">
@@ -240,6 +223,29 @@ onMounted(() => {
style="max-width: 320px"
@input="onSearchInput"
/>
+ <div class="flex gap-2">
+ <input
+ ref="importInput"
+ type="file"
+ accept=".json,.html,.htm"
+ style="display: none"
+ @change="handleImportFile"
+ />
+ <button class="btn btn-secondary" @click="router.push('/templates/preview')">
+ Preview Template
+ </button>
+ <button
+ v-if="wsStore.canEdit"
+ class="btn btn-secondary"
+ :disabled="importing"
+ @click="triggerImport"
+ >
+ {{ importing ? "Importing..." : "Import" }}
+ </button>
+ <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">
+ Create Template
+ </button>
+ </div>
</div>
<div v-if="loading" class="loading-page">
diff --git a/web/src/views/unsubscribe-lists/UnsubscribeLists.vue b/web/src/views/unsubscribe-lists/UnsubscribeLists.vue
index 8be5dee..8520d1f 100644
--- a/web/src/views/unsubscribe-lists/UnsubscribeLists.vue
+++ b/web/src/views/unsubscribe-lists/UnsubscribeLists.vue
@@ -7,6 +7,7 @@ import { useNotificationStore } from '../../stores/notification'
import { useConfirm } from '../../composables/useConfirm'
import { useModalSafeClose } from '../../composables/useModalSafeClose'
import { useWorkspaceStore } from '../../stores/workspace'
+import SectionHeader from '@/components/SectionHeader.vue'
import { usePagination } from '@/composables/usePagination'
import Pagination from '@/components/Pagination.vue'
@@ -126,39 +127,32 @@ const { watchClickStart, confirmClickEnd } = useModalSafeClose(() => {
<template>
<div>
- <div class="page-header">
- <div style="display: flex; align-items: center; gap: 6px;">
- <h1>Unsubscribe Lists</h1>
- <button
- type="button"
- @click="showInfo = !showInfo"
- :title="showInfo ? 'Hide help' : 'How to use unsubscribe lists'"
- aria-label="Toggle help"
- style="background:transparent;border:0;cursor:pointer;color:var(--text-secondary,#6b7280);display:inline-flex;align-items:center;justify-content:center;padding:6px;border-radius:6px;"
- >
- <svg width="18" height="18" viewBox="0 0 18 18" fill="none"><circle cx="9" cy="9" r="7" stroke="currentColor" stroke-width="1.5"/><path d="M9 12.75V9M9 5.25h.007" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
- </button>
- </div>
- <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Add List</button>
- </div>
+ <SectionHeader
+ title="Subscribers"
+ :tabs="[
+ { label: 'Subscribers', to: '/subscribers' },
+ { label: 'Lists', to: '/subscriber-lists' },
+ { label: 'Unsubscribe', to: '/unsubscribe-lists' },
+ ]"
+ />
- <div v-if="showInfo" class="card" style="margin-bottom:16px;display:flex;gap:12px;align-items:flex-start;">
- <svg width="20" height="20" viewBox="0 0 18 18" fill="none" style="flex-shrink:0;color:#9333ea;margin-top:2px;"><circle cx="9" cy="9" r="7" stroke="currentColor" stroke-width="1.5"/><path d="M9 12.75V9M9 5.25h.007" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
- <div style="flex:1;min-width:0;">
- <h3 style="margin-top:0;margin-bottom:8px;">Where to use Unsubscribe Lists</h3>
- <p style="margin:0 0 8px 0;">
- Reference a list from a transactional send with <code>unsubscribe.list_id</code>.<br>
- Posta mints the signed one-click URL and emits the <code>List-Unsubscribe</code> header.<br>
- A click opts the recipient out of <strong>that list only</strong> and their receipts, password resets, and other transactional mail keep flowing.
+ <div v-if="showInfo" class="card help-card">
+ <div class="card-body">
+ <h2 class="help-title">Where to use Unsubscribe Lists</h2>
+ <p class="help-text">
+ Reference a list from a transactional send with <code>unsubscribe.list_id</code>.
+ Posta mints the signed one-click URL and emits the <code>List-Unsubscribe</code> header.
+ A click opts the recipient out of <strong>that list only</strong> &mdash; receipts, password
+ resets, and other transactional mail keep flowing.
</p>
- <pre class="code-block" style="margin:0;font-size:12px;line-height:1.5;"><code>POST /api/v1/emails/send
+ <pre class="code-block"><code>POST /api/v1/emails/send
{
"to": ["[email protected]"],
"subject": "Product update",
"html": "...",
"unsubscribe": { "list_id": 42 }
}</code></pre>
- <p style="margin:10px 0 0 0;color:var(--text-secondary,#6b7280);font-size:13px;">
+ <p class="help-text help-text-muted">
Click a list name below to see who opted out and to resubscribe individual addresses.
</p>
</div>
@@ -169,6 +163,19 @@ const { watchClickStart, confirmClickEnd } = useModalSafeClose(() => {
</div>
<div v-else class="card">
+ <div class="card-header">
+ <h2>Unsubscribe Lists</h2>
+ <div class="flex gap-2">
+ <button
+ type="button"
+ class="btn btn-secondary"
+ @click="showInfo = !showInfo"
+ >
+ {{ showInfo ? 'Hide help' : 'How to use' }}
+ </button>
+ <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Add List</button>
+ </div>
+ </div>
<div v-if="lists.length === 0" class="empty-state">
<h3>No Unsubscribe Lists</h3>
<p>Create a list, then reference it from a send with <code>unsubscribe.list_id</code>. A one-click then opts the recipient out of that list only.</p>
@@ -260,3 +267,33 @@ const { watchClickStart, confirmClickEnd } = useModalSafeClose(() => {
</div>
</div>
</template>
+
+<style scoped>
+.help-card {
+ margin-bottom: 16px;
+}
+.help-title {
+ font-size: 15px;
+ font-weight: 600;
+ color: var(--text-primary);
+ margin-bottom: 10px;
+}
+.help-text {
+ font-size: 13px;
+ line-height: 1.6;
+ color: var(--text-secondary);
+ margin-bottom: 14px;
+}
+.help-text code {
+ font-size: 12px;
+}
+.help-card .code-block {
+ font-size: 12px;
+ line-height: 1.6;
+}
+.help-text-muted {
+ color: var(--text-muted);
+ margin-top: 12px;
+ margin-bottom: 0;
+}
+</style>
diff --git a/web/src/views/webhooks/WebhookDeliveries.vue b/web/src/views/webhooks/WebhookDeliveries.vue
index 6318be2..a9ac074 100644
--- a/web/src/views/webhooks/WebhookDeliveries.vue
+++ b/web/src/views/webhooks/WebhookDeliveries.vue
@@ -3,6 +3,7 @@ import { ref } from 'vue'
import { webhookDeliveriesApi } from '../../api/webhooks'
import type { WebhookDelivery } from '../../api/types'
import Pagination from '../../components/Pagination.vue'
+import SectionHeader from '../../components/SectionHeader.vue'
import { usePagination } from '../../composables/usePagination'
const loading = ref(true)
@@ -32,9 +33,13 @@ function formatDate(date: string) {
<template>
<div>
- <div class="page-header">
- <h1>Webhook Deliveries</h1>
- </div>
+ <SectionHeader
+ title="Webhooks"
+ :tabs="[
+ { label: 'Webhooks', to: '/webhooks' },
+ { label: 'Deliveries', to: '/webhook-deliveries' },
+ ]"
+ />
<div v-if="loading" class="loading-page">
<div class="spinner"></div>
diff --git a/web/src/views/webhooks/Webhooks.vue b/web/src/views/webhooks/Webhooks.vue
index 6dc31e7..1ebb299 100644
--- a/web/src/views/webhooks/Webhooks.vue
+++ b/web/src/views/webhooks/Webhooks.vue
@@ -3,6 +3,7 @@ import { ref } from 'vue'
import { webhooksApi } from '../../api/webhooks'
import type { Webhook, WebhookInput } from '../../api/types'
import Pagination from '../../components/Pagination.vue'
+import SectionHeader from '../../components/SectionHeader.vue'
import { usePagination } from '../../composables/usePagination'
import { useNotificationStore } from '../../stores/notification'
import { useConfirm } from '../../composables/useConfirm'
@@ -132,10 +133,13 @@ const { watchClickStart, confirmClickEnd } = useModalSafeClose(() => {
<template>
<div>
- <div class="page-header">
- <h1>Webhooks</h1>
- <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Add Webhook</button>
- </div>
+ <SectionHeader
+ title="Webhooks"
+ :tabs="[
+ { label: 'Webhooks', to: '/webhooks' },
+ { label: 'Deliveries', to: '/webhook-deliveries' },
+ ]"
+ />
<div v-if="loading" class="loading-page">
<div class="spinner"></div>
@@ -143,6 +147,10 @@ const { watchClickStart, confirmClickEnd } = useModalSafeClose(() => {
<template v-else>
<div class="card">
+ <div class="card-header">
+ <h2>Webhooks</h2>
+ <button v-if="wsStore.canEdit" class="btn btn-primary" @click="openCreate">Add Webhook</button>
+ </div>
<div class="table-wrapper" v-if="webhooks.length > 0">
<table>
<thead>
diff --git a/web/src/views/workspaces/WorkspaceSettings.vue b/web/src/views/workspaces/WorkspaceSettings.vue
index bee6b93..901afa9 100644
--- a/web/src/views/workspaces/WorkspaceSettings.vue
+++ b/web/src/views/workspaces/WorkspaceSettings.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { ref, onMounted, computed } from 'vue'
+import { ref, onMounted, computed, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { workspaceApi } from '../../api/workspaces'
import { oauthApi } from '../../api/oauth'
@@ -19,7 +19,18 @@ const ws = ref<Workspace | null>(null)
const loading = ref(true)
// Tabs
-const activeTab = ref<'members' | 'invitations' | 'plan' | 'sso' | 'transfer' | 'settings'>('members')
+type WorkspaceTab = 'members' | 'invitations' | 'plan' | 'sso' | 'transfer' | 'settings'
+const validTabs: WorkspaceTab[] = ['members', 'invitations', 'plan', 'sso', 'transfer', 'settings']
+function tabFromQuery(value: unknown): WorkspaceTab {
+ return validTabs.includes(value as WorkspaceTab) ? (value as WorkspaceTab) : 'members'
+}
+const activeTab = ref<WorkspaceTab>(tabFromQuery(route.query.tab))
+
+// Keep the active tab in sync when the sidebar deep-links into a different tab
+// of the workspace that is already open.
+watch(() => route.query.tab, (value) => {
+ if (value) activeTab.value = tabFromQuery(value)
+})
// Members
const members = ref<WorkspaceMember[]>([])
diff --git a/web/src/views/workspaces/Workspaces.vue b/web/src/views/workspaces/Workspaces.vue
index 4ebba8f..5567ba3 100644
--- a/web/src/views/workspaces/Workspaces.vue
+++ b/web/src/views/workspaces/Workspaces.vue
@@ -1,12 +1,13 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
-import { useRouter } from 'vue-router'
+import { useRouter, useRoute } from 'vue-router'
import { workspaceApi } from '../../api/workspaces'
import type { Workspace, WorkspaceInvitation } from '../../api/types'
import { useNotificationStore } from '../../stores/notification'
import { useWorkspaceStore } from '../../stores/workspace'
const router = useRouter()
+const route = useRoute()
const notify = useNotificationStore()
const wsStore = useWorkspaceStore()
@@ -103,6 +104,11 @@ function formatDate(dateStr: string): string {
}
onMounted(fetchData)
+
+if (route.query.create !== undefined) {
+ showCreateModal.value = true
+ router.replace({ query: {} })
+}
</script>
<template>