feat(viewPref): keep record of user view preferences per section (groupBy, order, list or grid)

This commit is contained in:
Edouard Vanbelle
2026-05-28 11:12:36 +02:00
parent 7f4b329718
commit bd474aa67e
7 changed files with 204 additions and 7 deletions
+6 -2
View File
@@ -20,6 +20,7 @@ import { ui } from '../../app/ui.js';
import { ResourceListComponent } from '../../components/resourceList.js';
import { normalizeDateBucket, sizeBucket } from '../../core/formatters.js';
import { i18n } from '../../core/i18n.js';
import * as viewPrefs from '../../core/viewPrefs.js';
import { batchToolbar } from '../../features/files/batchToolbar.js';
import * as itemTooltip from '../../features/itemTooltip.js';
import { favorites } from '../../features/library/favorites.js';
@@ -164,6 +165,7 @@ const favoritesView = {
setGroupBy(key) {
if (this._groupBy === key) return;
this._groupBy = key;
viewPrefs.save('favorites', this._groupBy, this._reversed, viewPrefs.load('favorites').view);
this._nextCursor = null;
this._component?.clear();
this._loadPage();
@@ -177,6 +179,7 @@ const favoritesView = {
setDirection(reversed) {
if (this._reversed === reversed) return;
this._reversed = reversed;
viewPrefs.save('favorites', this._groupBy, this._reversed, viewPrefs.load('favorites').view);
this._nextCursor = null;
this._component?.clear();
this._loadPage();
@@ -189,8 +192,9 @@ const favoritesView = {
async init() {
this._nextCursor = null;
this._loading = false;
this._groupBy = '';
this._reversed = false;
const _savedPrefs = viewPrefs.load('favorites');
this._groupBy = _savedPrefs.groupBy;
this._reversed = _savedPrefs.reversed;
this._ensureLoadMoreButton();