|
5 | 5 | * Created Date: 2025-09-17 17:25:36 |
6 | 6 | * Author: 3urobeat |
7 | 7 | * |
8 | | - * Last Modified: 2026-04-28 21:58:45 |
| 8 | + * Last Modified: 2026-04-29 18:45:52 |
9 | 9 | * Modified By: 3urobeat |
10 | 10 | * |
11 | 11 | * Copyright (c) 2025 - 2026 3urobeat <https://github.com/3urobeat> |
|
26 | 26 | <div class="flex w-full justify-between md:justify-end gap-x-4 p-1.5 rounded-2xl backdrop-blur-lg"> |
27 | 27 | <!-- Sort dropdown --> |
28 | 28 | <div class="flex min-w-18 sm:min-w-32 justify-end rounded-xl shadow-md select-none bg-bg-field-light dark:bg-bg-field-dark"> |
29 | | - <select class="w-full px-2 m-0.5" v-model="selectedSort"> |
30 | | - <option :value="sortModes.dateDesc">{{ $t('sortByDateDesc') }}</option> |
31 | | - <option :value="sortModes.dateAsc">{{ $t('sortByDateAsc') }}</option> |
32 | | - <option :value="sortModes.nameDesc">{{ $t('sortByNameDesc') }}</option> |
33 | | - <option :value="sortModes.nameAsc">{{ $t('sortByNameAsc') }}</option> |
| 29 | + <select class="w-full px-2 m-0.5" v-model="selectedSort" v-on:change="saveUxSetting"> |
| 30 | + <option :value="SortMode.dateDesc">{{ $t('sortByDateDesc') }}</option> |
| 31 | + <option :value="SortMode.dateAsc">{{ $t('sortByDateAsc') }}</option> |
| 32 | + <option :value="SortMode.nameDesc">{{ $t('sortByNameDesc') }}</option> |
| 33 | + <option :value="SortMode.nameAsc">{{ $t('sortByNameAsc') }}</option> |
34 | 34 | </select> |
35 | 35 | </div> |
36 | 36 |
|
|
95 | 95 | <script setup lang="ts"> |
96 | 96 | import { defaultUXSettings } from '~/model/storage'; |
97 | 97 | import type { Label } from '~/model/label'; |
98 | | - import { sortModes } from '~/model/sort-modes'; |
| 98 | + import { SortMode } from '~/model/sort-modes'; |
99 | 99 |
|
100 | 100 |
|
101 | 101 | // Get global cache from app.vue |
102 | 102 | const storedLabels = getAllLabelsFromServer(); |
103 | 103 |
|
104 | 104 | // Refs |
105 | | - const selectedSort: Ref<sortModes> = ref(sortModes.dateDesc); |
| 105 | + const selectedSort: Ref<SortMode> = ref(SortMode.dateDesc); |
106 | 106 | const selectedFilters: Ref<string[]> = ref([]); |
107 | 107 | const selectedScaling: Ref<number> = ref(defaultUXSettings.selectedItemCardsScaling); |
108 | 108 |
|
109 | 109 | // Client side only |
110 | 110 | onBeforeMount(() => { |
111 | 111 | selectedScaling.value = getUXSettings().selectedItemCardsScaling; |
| 112 | + selectedSort.value = getUXSettings().selectedItemSort; |
112 | 113 | }); |
113 | 114 |
|
114 | 115 |
|
115 | 116 | // Save scaling setting |
116 | 117 | function saveUxSetting() { |
117 | 118 | setUXSetting("selectedItemCardsScaling", selectedScaling.value); |
| 119 | + setUXSetting("selectedItemSort", selectedSort.value); |
118 | 120 | } |
119 | 121 |
|
120 | 122 |
|
|
0 commit comments