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