Ariver
2026-06-03 50263bd08a9979bb18258a2314ad223899e96f0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<script lang="ts">
  import { currentPage } from '../../lib/stores/app'
  import { t } from '../../lib/i18n'
  import GeneralPage from './GeneralPage.svelte'
  import PermissionsPage from './PermissionsPage.svelte'
  import HistoryPage from './HistoryPage.svelte'
  import UserDictPage from './UserDictPage.svelte'
  import AboutPage from './AboutPage.svelte'
  import AppIcon from '../shared/AppIcon.svelte'
 
  const navItems = [
    { id: 'general', label: () => t('nav.home') },
    { id: 'userdict', label: () => t('nav.userdict') },
    { id: 'permissions', label: () => t('nav.permissions') },
    { id: 'history', label: () => t('nav.history') },
    { id: 'about', label: () => t('nav.about') },
  ]
 
  let page = $state('general')
  const unsubPage = currentPage.subscribe(p => { page = p })
 
  function navigate(id: string) {
    currentPage.set(id)
  }
</script>
 
<div class="settings-layout">
  <!-- Sidebar -->
  <nav class="sidebar">
    <div class="sidebar-header">
      <AppIcon size={24} />
      <span class="app-name">{t('app.name')}</span>
    </div>
 
    <div class="nav-items">
      {#each navItems as item}
        <button
          class="nav-item"
          class:active={page === item.id}
          onclick={() => navigate(item.id)}
        >
          <span class="nav-icon">
            {#if item.id === 'general'}
              <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round">
                <path d="M2.5 7.5L8 3l5.5 4.5"/>
                <path d="M4 6.5V13h3v-3.5h2V13h3V6.5"/>
              </svg>
            {:else if item.id === 'history'}
              <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round">
                <circle cx="8" cy="8" r="6"/>
                <polyline points="8,4.5 8,8 10.5,9.5"/>
              </svg>
            {:else if item.id === 'userdict'}
              <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round">
                <path d="M3 3.5h10"/>
                <path d="M3 8h7"/>
                <path d="M3 12.5h5"/>
                <path d="M11 11l1.2 1.2L14.5 10"/>
              </svg>
            {:else if item.id === 'permissions'}
              <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round">
                <path d="M8 2L3.5 4v3.2c0 2.9 1.8 5.1 4.5 6.3 2.7-1.2 4.5-3.4 4.5-6.3V4L8 2Z"/>
                <path d="M5.8 7.9l1.4 1.4 3-3.2"/>
              </svg>
            {:else if item.id === 'about'}
              <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round">
                <circle cx="8" cy="8" r="6"/>
                <path d="M8 7.5V11"/>
                <circle cx="8" cy="5.5" r="0.6" fill="currentColor" stroke="none"/>
              </svg>
            {/if}
          </span>
          <span class="nav-label">{item.label()}</span>
        </button>
      {/each}
    </div>
  </nav>
 
  <!-- Content -->
  <main class="content">
    {#if page === 'general'}
      <GeneralPage />
    {:else if page === 'userdict'}
      <UserDictPage />
    {:else if page === 'permissions'}
      <PermissionsPage />
    {:else if page === 'history'}
      <HistoryPage />
    {:else if page === 'about'}
      <AboutPage />
    {/if}
  </main>
</div>
 
<style>
  .settings-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
  }
 
  .sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: var(--spacing-lg);
    padding-top: 40px;
    border-right: 1px solid var(--color-separator);
    -webkit-app-region: drag;
  }
 
  .sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    -webkit-app-region: no-drag;
  }
 
  .app-name {
    font-weight: 600;
    font-size: var(--font-size-lg);
  }
 
  .nav-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    -webkit-app-region: no-drag;
  }
 
  .nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: var(--font-size-base);
    color: var(--color-secondary-label);
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
    position: relative;
  }
 
  .nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-label);
  }
 
  .nav-item.active {
    background: rgba(0, 122, 255, 0.08);
    color: var(--color-blue);
  }
 
  .nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 2px;
    background: var(--color-blue);
  }
 
  .nav-icon {
    width: 20px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
 
  .nav-label {
    font-weight: 500;
  }
 
  .content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
  }
</style>