| 1 | <html> |
| 2 | <head> |
| 3 | <script type="module"> |
| 4 | import { store } from "/components/sidebar/bottom/preferences/preferences-store.js"; |
| 5 | </script> |
| 6 | </head> |
| 7 | <body> |
| 8 | <div x-data> |
| 9 | <template x-if="$store.preferences"> |
| 10 | <div class="pref-section"> |
| 11 | <span> |
| 12 | <h3 class="pref-header" |
| 13 | data-bs-toggle="collapse" |
| 14 | @click="$store.sidebar.toggleSection('preferences')" |
| 15 | x-effect="!$store.sidebar.isSectionOpen('preferences') ? $el.classList.add('collapsed') : $el.classList.remove('collapsed')"> |
| 16 | Preferences |
| 17 | <svg class="arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"> |
| 18 | <path d="M8 4l8 8-8 8" /> |
| 19 | </svg> |
| 20 | </h3> |
| 21 | <ul class="config-list collapse" id="preferences-collapse" |
| 22 | x-effect="(() => { const c = bootstrap.Collapse.getOrCreateInstance($el, { toggle: false }); $store.sidebar.isSectionOpen('preferences') ? c.show() : c.hide(); })()"> |
| 23 | <li x-data> |
| 24 | <span class="switch-label">Dark mode</span> |
| 25 | <label class="switch"> |
| 26 | <input type="checkbox" x-model="$store.preferences.darkMode"> |
| 27 | <span class="slider"></span> |
| 28 | </label> |
| 29 | </li> |
| 30 | <li x-data class="chat-width-setting"> |
| 31 | <span class="width-label">Width</span> |
| 32 | <div class="width-buttons"> |
| 33 | <template x-for="(opt, idx) in $store.preferences.chatWidthOptions" :key="opt.value"> |
| 34 | <span class="width-btn-wrapper"> |
| 35 | <button type="button" |
| 36 | class="width-btn" |
| 37 | :class="{ 'active': $store.preferences.chatWidth === opt.value }" |
| 38 | @click="$store.preferences.chatWidth = opt.value" |
| 39 | x-text="opt.label"></button> |
| 40 | <span class="width-sep" x-show="idx < $store.preferences.chatWidthOptions.length - 1">·</span> |
| 41 | </span> |
| 42 | </template> |
| 43 | </div> |
| 44 | </li> |
| 45 | <li x-data class="detail-mode-setting"> |
| 46 | <span class="detail-label">Detail</span> |
| 47 | <div class="detail-buttons"> |
| 48 | <template x-for="(opt, idx) in $store.preferences.detailModeOptions" :key="opt.value"> |
| 49 | <span class="detail-btn-wrapper"> |
| 50 | <button type="button" |
| 51 | class="detail-btn" |
| 52 | :class="{ 'active': $store.preferences.detailMode === opt.value }" |
| 53 | @click="$store.preferences.detailMode = opt.value" |
| 54 | :title="opt.title" |
| 55 | x-text="opt.label"></button> |
| 56 | <span class="detail-sep" x-show="idx < $store.preferences.detailModeOptions.length - 1">·</span> |
| 57 | </span> |
| 58 | </template> |
| 59 | </div> |
| 60 | </li> |
| 61 | <li x-data> |
| 62 | <span class="switch-label">Speech</span> |
| 63 | <label class="switch"> |
| 64 | <input type="checkbox" x-model="$store.preferences.speech"> |
| 65 | <span class="slider"></span> |
| 66 | </label> |
| 67 | </li> |
| 68 | <li x-data> |
| 69 | <span>Show utility messages</span> |
| 70 | <label class="switch"> |
| 71 | <input type="checkbox" x-model="$store.preferences.showUtils"> |
| 72 | <span class="slider"></span> |
| 73 | </label> |
| 74 | </li> |
| 75 | </ul> |
| 76 | </span> |
| 77 | </div> |
| 78 | </template> |
| 79 | </div> |
| 80 | |
| 81 | <style> |
| 82 | .pref-section { |
| 83 | font-size: var(--font-size-small); |
| 84 | padding: 0.6rem var(--spacing-md) 0.05rem var(--spacing-md); |
| 85 | } |
| 86 | /* Collapse transition */ |
| 87 | .pref-section [x-cloak] { |
| 88 | display: none; |
| 89 | } |
| 90 | .pref-section .pref-header { |
| 91 | display: flex; |
| 92 | align-items: center; |
| 93 | justify-content: space-between; |
| 94 | gap: 6px; |
| 95 | cursor: pointer; |
| 96 | user-select: none; |
| 97 | } |
| 98 | .pref-section .config-list { |
| 99 | list-style: none; |
| 100 | padding: 0.05rem 0; |
| 101 | margin: 0; |
| 102 | display: flex; |
| 103 | flex-direction: column; |
| 104 | gap: 1px; |
| 105 | } |
| 106 | #preferences-collapse li { |
| 107 | opacity: 0.8; |
| 108 | } |
| 109 | .pref-section .switch-label, |
| 110 | .pref-section span { |
| 111 | font-size: 0.8rem; |
| 112 | } |
| 113 | .pref-section .switch { |
| 114 | position: relative; |
| 115 | display: inline-block; |
| 116 | width: 35px; |
| 117 | height: 19px; |
| 118 | margin-left: auto; |
| 119 | } |
| 120 | .pref-section li { display: flex; align-items: center; } |
| 121 | |
| 122 | /* Chat width button bar */ |
| 123 | .chat-width-setting { |
| 124 | gap: 0.25rem; |
| 125 | } |
| 126 | .chat-width-setting .width-label { |
| 127 | flex: 1; |
| 128 | } |
| 129 | .width-buttons { |
| 130 | display: flex; |
| 131 | align-items: center; |
| 132 | gap: 0; |
| 133 | } |
| 134 | .width-btn-wrapper { |
| 135 | display: flex; |
| 136 | align-items: center; |
| 137 | } |
| 138 | .width-btn { |
| 139 | background: none; |
| 140 | border: none; |
| 141 | color: var(--color-primary); |
| 142 | font-size: 0.7rem; |
| 143 | font-weight: 500; |
| 144 | letter-spacing: 0.02em; |
| 145 | padding: 0.15rem 0.1rem; |
| 146 | cursor: pointer; |
| 147 | opacity: 0.7; |
| 148 | transition: opacity 0.15s ease, color 0.15s ease; |
| 149 | } |
| 150 | .width-btn:hover { |
| 151 | opacity: 0.85; |
| 152 | } |
| 153 | .width-btn.active { |
| 154 | opacity: 1; |
| 155 | color: var(--color-text); |
| 156 | } |
| 157 | .width-sep { |
| 158 | color: var(--color-text-secondary, #666); |
| 159 | font-size: 0.6rem; |
| 160 | margin: 0 0.1rem; |
| 161 | opacity: 0.5; |
| 162 | } |
| 163 | |
| 164 | /* Detail mode button bar */ |
| 165 | .detail-mode-setting { |
| 166 | gap: 0.25rem; |
| 167 | } |
| 168 | .detail-mode-setting .detail-label { |
| 169 | flex: 1; |
| 170 | } |
| 171 | .detail-buttons { |
| 172 | display: flex; |
| 173 | align-items: center; |
| 174 | gap: 0; |
| 175 | } |
| 176 | .detail-btn-wrapper { |
| 177 | display: flex; |
| 178 | align-items: center; |
| 179 | } |
| 180 | .detail-btn { |
| 181 | background: none; |
| 182 | border: none; |
| 183 | color: var(--color-primary); |
| 184 | font-size: 0.7rem; |
| 185 | font-weight: 500; |
| 186 | letter-spacing: 0.02em; |
| 187 | padding: 0.15rem 0.1rem; |
| 188 | cursor: pointer; |
| 189 | opacity: 0.7; |
| 190 | transition: opacity 0.15s ease; |
| 191 | } |
| 192 | .detail-btn .material-symbols-outlined { |
| 193 | font-size: 1rem; |
| 194 | } |
| 195 | .detail-btn:hover { |
| 196 | opacity: 0.85; |
| 197 | } |
| 198 | .detail-btn.active { |
| 199 | opacity: 1; |
| 200 | color: var(--color-text); |
| 201 | } |
| 202 | .detail-sep { |
| 203 | color: var(--color-text-secondary, #666); |
| 204 | font-size: 0.6rem; |
| 205 | margin: 0 0.1rem; |
| 206 | opacity: 0.5; |
| 207 | } |
| 208 | </style> |
| 209 | </body> |
| 210 | </html> |
| 211 | |
| 212 |