verstak/frontend/src/lib/SettingsSidebar.svelte

86 lines
2.3 KiB
Svelte

<script>
import { t } from './i18n'
export let activeSection = 'general'
export let onSelect = null
const sections = [
{ id: 'general', label: t('settings.general'), icon: '⚙️' },
{ id: 'workspace', label: t('settings.workspace'), icon: '🏠' },
{ id: 'templates', label: t('settings.templates'), icon: '📋' },
{ id: 'plugins', label: t('settings.plugins'), icon: '🔌' },
{ id: 'files', label: t('settings.files'), icon: '📁' },
{ id: 'activity', label: t('settings.activity'), icon: '📊' },
{ id: 'sync', label: t('settings.sync'), icon: '🔄' },
{ id: 'backup', label: t('settings.backup'), icon: '💾' },
]
function select(id) {
if (onSelect) onSelect(id)
}
</script>
<nav class="settings-sidebar">
{#each sections as sec}
<button
class="settings-nav-item"
class:active={activeSection === sec.id}
class:disabled={sec.id === 'plugins' || sec.id === 'files' || sec.id === 'activity' || sec.id === 'backup'}
on:click={() => select(sec.id)}
>
<span class="settings-nav-icon">{sec.icon}</span>
<span class="settings-nav-label">{sec.label}</span>
</button>
{/each}
</nav>
<style>
.settings-sidebar {
width: 200px;
min-width: 200px;
border-right: 1px solid var(--border, #2a2a3e);
padding: 0.75rem 0;
overflow-y: auto;
background: var(--surface, #1e1e2e);
}
.settings-nav-item {
display: flex;
align-items: center;
gap: 0.5rem;
width: 100%;
padding: 0.55rem 1rem;
border: none;
background: transparent;
color: var(--text-dim, #888);
font-size: 0.9rem;
cursor: pointer;
text-align: left;
transition: background 0.15s, color 0.15s;
font-family: inherit;
}
.settings-nav-item:hover:not(.disabled) {
background: var(--surface-alt, #252538);
color: var(--text, #e0e0e0);
}
.settings-nav-item.active {
background: var(--accent-bg, rgba(99, 102, 241, 0.15));
color: var(--accent, #818cf8);
font-weight: 600;
}
.settings-nav-item.disabled {
opacity: 0.4;
cursor: default;
}
.settings-nav-icon {
font-size: 1rem;
width: 1.4rem;
text-align: center;
flex-shrink: 0;
}
.settings-nav-label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>