From 9199d91844c5435b8c75cb91261b7db96dc0e54c Mon Sep 17 00:00:00 2001 From: James Chang Date: Sat, 10 Apr 2021 11:32:46 -0400 Subject: [PATCH] Switch to dropdown instead of chips for public-pbs presets --- frontend/layouts/default.vue | 2 +- frontend/pages/index.vue | 33 +++++++--- frontend/pages/public-pbs.vue | 115 +++++++++++++++++++++++----------- 3 files changed, 106 insertions(+), 44 deletions(-) diff --git a/frontend/layouts/default.vue b/frontend/layouts/default.vue index d93062f..1207db8 100644 --- a/frontend/layouts/default.vue +++ b/frontend/layouts/default.vue @@ -251,7 +251,7 @@ export default { navItems: [ { icon: 'mdi-podium', - title: 'Fastest PBs', + title: 'Leaderboard', to: generateRoute('/public-pbs', { sortBy: ['score'], sortDesc: [false], diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue index 55bede9..f626755 100644 --- a/frontend/pages/index.vue +++ b/frontend/pages/index.vue @@ -48,8 +48,9 @@ - Track My PBs + mdi-card-text + Track My PBs - View Latest PBs + mdi-podium + Leaderboard @@ -89,10 +91,27 @@ export default { user: 'auth/user', }), - latestPbsRoute() { + fastestPbsRoute() { return generateRoute('/public-pbs', { - sortBy: ['happenedOn'], - sortDesc: [true], + sortBy: ['score'], + sortDesc: [false], + filters: [ + { + field: 'event.id', + operator: 'eq', + value: 4, // 3x3x3 on prod db + }, + { + field: 'pbClass.id', + operator: 'eq', + value: 1, // pbClass single on prod db + }, + { + field: 'setSize', + operator: 'eq', + value: 1, + }, + ], }) }, }, diff --git a/frontend/pages/public-pbs.vue b/frontend/pages/public-pbs.vue index d62e0ba..ba2e88c 100644 --- a/frontend/pages/public-pbs.vue +++ b/frontend/pages/public-pbs.vue @@ -5,31 +5,32 @@ v-if="loading.presets" indeterminate > -
-
Events
- - - - - {{ item.name }} - - - -
PB Types
- - {{ item.text }} - -
+ + + + + + + + filterObject.field === 'event.id' + ) + + if (eventFilterObject) { + this.inputs.event = this.events.find( + (event) => event.id === eventFilterObject.value + ) + } else { + this.inputs.event = null + } + + const setSizeFilterObject = originalPageOptions.filters.find( + (filterObject) => filterObject.field === 'setSize' + ) + + const pbClassFilterObject = originalPageOptions.filters.find( + (filterObject) => filterObject.field === 'pbClass.id' + ) - this.events = events.slice(0, 18) + if (setSizeFilterObject && pbClassFilterObject) { + this.inputs.pbType = this.pbTypes.find( + (pbType) => + pbType.attributes.setSize === setSizeFilterObject.value && + pbType.attributes['pbClass.id'] === pbClassFilterObject.value + ) + } else { + this.inputs.pbType = null + } + } this.loading.presets = false },