feat(viewPref): keep record of user view preferences per section (groupBy, order, list or grid)
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user