mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
* Saved sort selection into local storage for later use * Updated code to use userLocalManager module
This commit is contained in:
committed by
Matteo Pagliazzi
parent
ed761a8b7b
commit
c1a6ba6242
@@ -399,6 +399,8 @@
|
|||||||
import openedItemRowsMixin from 'client/mixins/openedItemRows';
|
import openedItemRowsMixin from 'client/mixins/openedItemRows';
|
||||||
import petMixin from 'client/mixins/petMixin';
|
import petMixin from 'client/mixins/petMixin';
|
||||||
|
|
||||||
|
import { CONSTANTS, setLocalSetting, getLocalSetting } from 'client/libs/userlocalManager';
|
||||||
|
|
||||||
// TODO Normalize special pets and mounts
|
// TODO Normalize special pets and mounts
|
||||||
// import Store from 'client/store';
|
// import Store from 'client/store';
|
||||||
// import deepFreeze from 'client/libs/deepFreeze';
|
// import deepFreeze from 'client/libs/deepFreeze';
|
||||||
@@ -430,13 +432,15 @@
|
|||||||
mousePosition: MouseMoveDirective,
|
mousePosition: MouseMoveDirective,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
const stableSortState = getLocalSetting(CONSTANTS.keyConstants.STABLE_SORT_STATE) || 'standard';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
viewOptions: {},
|
viewOptions: {},
|
||||||
hideMissing: false,
|
hideMissing: false,
|
||||||
searchText: null,
|
searchText: null,
|
||||||
searchTextThrottled: '',
|
searchTextThrottled: '',
|
||||||
// sort has the translation-keys as values
|
// sort has the translation-keys as values
|
||||||
selectedSortBy: 'standard',
|
selectedSortBy: stableSortState,
|
||||||
sortByItems: [
|
sortByItems: [
|
||||||
'standard',
|
'standard',
|
||||||
'AZ',
|
'AZ',
|
||||||
@@ -461,6 +465,11 @@
|
|||||||
let search = this.searchText.toLowerCase();
|
let search = this.searchText.toLowerCase();
|
||||||
this.searchTextThrottled = search;
|
this.searchTextThrottled = search;
|
||||||
}, 250),
|
}, 250),
|
||||||
|
selectedSortBy: {
|
||||||
|
handler () {
|
||||||
|
setLocalSetting(CONSTANTS.keyConstants.STABLE_SORT_STATE, this.selectedSortBy);
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ const CONSTANTS = {
|
|||||||
SPELL_DRAWER_STATE: 'spell-drawer-state',
|
SPELL_DRAWER_STATE: 'spell-drawer-state',
|
||||||
EQUIPMENT_DRAWER_STATE: 'equipment-drawer-state',
|
EQUIPMENT_DRAWER_STATE: 'equipment-drawer-state',
|
||||||
CURRENT_EQUIPMENT_DRAWER_TAB: 'current-equipment-drawer-tab',
|
CURRENT_EQUIPMENT_DRAWER_TAB: 'current-equipment-drawer-tab',
|
||||||
|
STABLE_SORT_STATE: 'stable-sort-state',
|
||||||
},
|
},
|
||||||
drawerStateValues: {
|
drawerStateValues: {
|
||||||
DRAWER_CLOSED: 'drawer-closed',
|
DRAWER_CLOSED: 'drawer-closed',
|
||||||
|
|||||||
Reference in New Issue
Block a user