From efa37a642062181106764aa9a3e7a2a7611716f7 Mon Sep 17 00:00:00 2001 From: Gamebrary Date: Mon, 23 Nov 2020 16:15:43 -0700 Subject: [PATCH] sort platforms --- src/components/Board/PlatformPicker.vue | 62 +++++++++---------------- src/store/getters.js | 45 +++++++++--------- 2 files changed, 45 insertions(+), 62 deletions(-) diff --git a/src/components/Board/PlatformPicker.vue b/src/components/Board/PlatformPicker.vue index 2f40b0ec..84f72915 100644 --- a/src/components/Board/PlatformPicker.vue +++ b/src/components/Board/PlatformPicker.vue @@ -1,50 +1,27 @@ diff --git a/src/store/getters.js b/src/store/getters.js index 77dbda12..bb0afdc3 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,4 +1,4 @@ -import { PLATFORM_FILTER_FIELDS } from '@/constants'; +// import { PLATFORM_FILTER_FIELDS } from '@/constants'; import orderby from 'lodash.orderby'; export default { @@ -6,31 +6,34 @@ export default { sortedBoards: ({ boards }) => orderby(boards, 'name'), filteredPlatforms: (state) => { - const filterField = state.settings && state.settings.platformsFilterField - ? state.settings.platformsFilterField - : null; + // const filterField = state.settings && state.settings.platformsFilterField + // ? state.settings.platformsFilterField + // : null; - const sortField = state.settings && state.settings.platformsSortField - ? state.settings.platformsSortField - : 'generation'; + // const sortField = state.settings && state.settings.platformsSortField + // ? state.settings.platformsSortField + // : 'generation'; - let filteredPlatforms = []; + // let filteredPlatforms = []; + // + // if (filterField === 'all') { + // filteredPlatforms = state.platforms; + // } else { + // filteredPlatforms = filterField && PLATFORM_FILTER_FIELDS.includes(filterField) + // ? state.platforms.filter(({ category }) => category === filterField) + // : filteredPlatforms = state.platforms.filter(({ popular }) => popular); + // } - if (filterField === 'all') { - filteredPlatforms = state.platforms; - } else { - filteredPlatforms = filterField && PLATFORM_FILTER_FIELDS.includes(filterField) - ? state.platforms.filter(({ category }) => category === filterField) - : filteredPlatforms = state.platforms.filter(({ popular }) => popular); - } + const sortedPlatforms = orderby(state.platforms, ['popular', 'generation']); + // const sortedPlatforms = orderby(filteredPlatforms, sortField); - const sortedPlatforms = orderby(filteredPlatforms, sortField); + return sortedPlatforms.reverse(); - const reverseOrder = ['releaseYear', 'generation'].includes(sortField); - - return reverseOrder - ? sortedPlatforms.reverse() - : sortedPlatforms; + // const reverseOrder = ['releaseYear', 'generation'].includes(sortField); + // + // return reverseOrder + // ? sortedPlatforms.reverse() + // : sortedPlatforms; }, platformNames: (state) => {