|
1 | 1 | <script lang="ts" setup>
|
2 |
| -import { NFlex } from 'naive-ui'; |
| 2 | +import { NFormItem, NSelect } from 'naive-ui'; |
3 | 3 |
|
4 |
| -import { useExtensionSettingsStore } from '~/stores/settings/extension.store'; |
| 4 | +import { ref } from 'vue'; |
5 | 5 |
|
6 |
| -const { logLevel } = useExtensionSettingsStore(); |
| 6 | +import { LogLevel, useLogStore } from '~/stores/settings/log.store'; |
| 7 | +import { useI18n } from '~/utils'; |
| 8 | +
|
| 9 | +const i18n = useI18n('settings', 'logs'); |
| 10 | +
|
| 11 | +const { logLevel } = useLogStore(); |
| 12 | +
|
| 13 | +const options = Object.entries(LogLevel) |
| 14 | + .filter(([_, v]) => typeof v === 'number') |
| 15 | + .map(([key, value]) => ({ |
| 16 | + label: key, |
| 17 | + value, |
| 18 | + })); |
| 19 | +
|
| 20 | +const container = ref(); |
7 | 21 | </script>
|
8 | 22 |
|
9 | 23 | <template>
|
10 |
| - <NFlex> This is the logs card : {{ logLevel }} </NFlex> |
| 24 | + <div ref="container" class="logs-container"> |
| 25 | + <NFormItem class="form-row" :show-feedback="false" label-placement="left"> |
| 26 | + <template #label> |
| 27 | + <span class="from-label">{{ i18n('label_log_level') }}</span> |
| 28 | + </template> |
| 29 | + <NSelect |
| 30 | + v-model:value="logLevel" |
| 31 | + class="form-select" |
| 32 | + :to="container" |
| 33 | + :options="options" |
| 34 | + /> |
| 35 | + </NFormItem> |
| 36 | + </div> |
11 | 37 | </template>
|
| 38 | + |
| 39 | +<style lang="scss" scoped> |
| 40 | +.logs-container { |
| 41 | + display: flex; |
| 42 | + flex-direction: column; |
| 43 | + gap: 1.5rem; |
| 44 | +} |
| 45 | +
|
| 46 | +.form-select { |
| 47 | + min-width: 10rem; |
| 48 | +} |
| 49 | +
|
| 50 | +.from-label { |
| 51 | + color: var(--white-70); |
| 52 | + font-weight: 600; |
| 53 | + font-size: 1rem; |
| 54 | + transition: color 0.3s var(--n-bezier); |
| 55 | +} |
| 56 | +
|
| 57 | +.form-row { |
| 58 | + display: flex; |
| 59 | + flex: 1 1 auto; |
| 60 | + flex-wrap: wrap; |
| 61 | + justify-content: space-between; |
| 62 | +
|
| 63 | + &:hover { |
| 64 | + .from-label { |
| 65 | + color: var(--white-mute); |
| 66 | + } |
| 67 | + } |
| 68 | +} |
| 69 | +</style> |
0 commit comments