feat: add API docs link button in sidebar footer

Opens Swagger UI (/docs) in a new tab. Proxies /docs and /openapi.json
in dev mode so the link works from the Vite dev server.
This commit is contained in:
2026-03-24 16:00:22 +03:00
parent ad2fd33697
commit f90cc36ebd
4 changed files with 23 additions and 14 deletions
+1
View File
@@ -806,6 +806,7 @@
"headersInvalid": "Invalid JSON", "headersInvalid": "Invalid JSON",
"language": "Language", "language": "Language",
"theme": "Theme", "theme": "Theme",
"apiDocs": "API Docs",
"light": "Light", "light": "Light",
"dark": "Dark", "dark": "Dark",
"system": "System", "system": "System",
+1
View File
@@ -806,6 +806,7 @@
"headersInvalid": "Невалидный JSON", "headersInvalid": "Невалидный JSON",
"language": "Язык", "language": "Язык",
"theme": "Тема", "theme": "Тема",
"apiDocs": "API Docs",
"light": "Светлая", "light": "Светлая",
"dark": "Тёмная", "dark": "Тёмная",
"system": "Системная", "system": "Системная",
+18 -13
View File
@@ -354,19 +354,6 @@
</button> </button>
</div> </div>
<!-- Search button -->
<div class="{collapsed ? 'px-2 py-1.5' : 'px-3 py-1.5'}" style="border-bottom: 1px solid var(--color-border);">
<button onclick={() => openSearch?.()}
class="search-btn flex items-center gap-2 w-full {collapsed ? 'justify-center px-2' : 'px-2.5'} py-1.5 rounded-lg text-sm transition-all duration-200"
title={t('searchPalette.placeholder')}>
<MdiIcon name="mdiMagnify" size={16} />
{#if !collapsed}
<span class="flex-1 text-left text-xs">{t('searchPalette.placeholder')}</span>
<kbd class="text-[0.6rem] font-mono px-1 py-0.5 rounded" style="background: var(--color-background); border: 1px solid var(--color-border);">{isMac ? '⌘' : 'Ctrl '}K</kbd>
{/if}
</button>
</div>
<!-- Global provider filter --> <!-- Global provider filter -->
{#if allProviders.length > 1} {#if allProviders.length > 1}
<div class="{collapsed ? 'px-2 py-1' : 'px-3 py-1.5'}" style="border-bottom: 1px solid var(--color-border);"> <div class="{collapsed ? 'px-2 py-1' : 'px-3 py-1.5'}" style="border-bottom: 1px solid var(--color-border);">
@@ -386,6 +373,19 @@
</div> </div>
{/if} {/if}
<!-- Search button -->
<div class="{collapsed ? 'px-2 py-1.5' : 'px-3 py-1.5'}" style="border-bottom: 1px solid var(--color-border);">
<button onclick={() => openSearch?.()}
class="search-btn flex items-center gap-2 w-full {collapsed ? 'justify-center px-2' : 'px-2.5'} py-1.5 rounded-lg text-sm transition-all duration-200"
title={t('searchPalette.placeholder')}>
<MdiIcon name="mdiMagnify" size={16} />
{#if !collapsed}
<span class="flex-1 text-left text-xs">{t('searchPalette.placeholder')}</span>
<kbd class="text-[0.6rem] font-mono px-1 py-0.5 rounded" style="background: var(--color-background); border: 1px solid var(--color-border);">{isMac ? '⌘' : 'Ctrl '}K</kbd>
{/if}
</button>
</div>
<!-- Nav --> <!-- Nav -->
<nav class="flex-1 p-2 space-y-0.5 overflow-y-auto"> <nav class="flex-1 p-2 space-y-0.5 overflow-y-auto">
{#each navEntries as entry} {#each navEntries as entry}
@@ -463,6 +463,11 @@
title={t('common.theme')}> title={t('common.theme')}>
<MdiIcon name={theme.resolved === 'dark' ? 'mdiWeatherNight' : theme.current === 'system' ? 'mdiDesktopTowerMonitor' : 'mdiWeatherSunny'} size={14} /> <MdiIcon name={theme.resolved === 'dark' ? 'mdiWeatherNight' : theme.current === 'system' ? 'mdiDesktopTowerMonitor' : 'mdiWeatherSunny'} size={14} />
</button> </button>
<a href="/docs" target="_blank" rel="noopener noreferrer"
class="footer-pill flex items-center justify-center {collapsed ? 'w-8 h-8' : 'px-2.5 py-1'} rounded-lg text-xs transition-all duration-200"
title={t('common.apiDocs')}>
<MdiIcon name="mdiApi" size={14} />
</a>
</div> </div>
<!-- User info --> <!-- User info -->
+3 -1
View File
@@ -6,7 +6,9 @@ export default defineConfig({
plugins: [tailwindcss(), sveltekit()], plugins: [tailwindcss(), sveltekit()],
server: { server: {
proxy: { proxy: {
'/api': 'http://localhost:8420' '/api': 'http://localhost:8420',
'/docs': 'http://localhost:8420',
'/openapi.json': 'http://localhost:8420'
} }
} }
}); });