From 0ec8d96a6f3beadbcbec77c268dc2ca765c136ef Mon Sep 17 00:00:00 2001 From: Shaun Ellis Date: Sat, 28 Jul 2018 20:13:41 -0400 Subject: [PATCH] adds leaderboard --- src/pages/IsTree.vue | 5 +++-- src/pages/Leaderboard.vue | 41 +++++++++++++++++++++++++++++++++++++++ src/pages/Profile.vue | 2 +- src/pages/tag.vue | 4 ++-- src/router/routes.js | 2 ++ 5 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 src/pages/Leaderboard.vue diff --git a/src/pages/IsTree.vue b/src/pages/IsTree.vue index 7b9f32b..4069419 100644 --- a/src/pages/IsTree.vue +++ b/src/pages/IsTree.vue @@ -5,8 +5,9 @@

Help us validate other users' images.

Current score: {{ profile.points }}

- + +

{{ isTree['.key'] }}

Viewing {{ currentSlideIndex + 1 }} out of {{ isTreeList.length }}

@@ -56,7 +57,7 @@ export default { }, computed: { isTreeList () { - return this.trees.filter(tree => tree.user_id !== this.userId) + return this.trees.filter(tree => tree.user_id !== this.userId).reverse() }, profile: { get () { diff --git a/src/pages/Leaderboard.vue b/src/pages/Leaderboard.vue new file mode 100644 index 0000000..4939b3c --- /dev/null +++ b/src/pages/Leaderboard.vue @@ -0,0 +1,41 @@ + + + + diff --git a/src/pages/Profile.vue b/src/pages/Profile.vue index add6c5a..423a243 100644 --- a/src/pages/Profile.vue +++ b/src/pages/Profile.vue @@ -119,7 +119,7 @@ export default { let newProfile = Object.assign({}, this.profile) newProfile.points = newProfile.points - this.spamToll this.$store.dispatch('setProfile', newProfile) - this.profilesRef.child(this.userId).update({points: newProfile.points}) + this.$profilesRef.child(this.userId).update({points: newProfile.points}) .then(this.removeFlagged()) }, photosFlaggedAlert () { diff --git a/src/pages/tag.vue b/src/pages/tag.vue index 70b4e00..1508bb1 100644 --- a/src/pages/tag.vue +++ b/src/pages/tag.vue @@ -180,7 +180,7 @@ save (formData) { // upload data to the server let key - let imageUrl + let s3url this.currentStatus = STATUS_SAVING this.$treesRef.push(this.tree) @@ -209,7 +209,7 @@ }) .then(downloadURL => { console.log(`Successfully uploaded file and got download link - ${downloadURL}`); - return this.$treesRef.child(key).update({imageUrl: downloadURL}) + return this.$treesRef.child(key).update({s3url: downloadURL}) }) .then(() => { //this.updateProfilePoints diff --git a/src/router/routes.js b/src/router/routes.js index 67ec5c0..54f461e 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -14,6 +14,8 @@ export default [ requiresAuth: true }}, { path: '/istree', component: () => import('pages/IsTree'), meta: { requiresAuth: true }}, + { path: '/leaderboard', component: () => import('pages/Leaderboard'), meta: { + requiresAuth: true }}, { path: '/profile', component: () => import('pages/Profile'), meta: { requiresAuth: true }}, { path: '/success', component: () => import('pages/Success'), meta: {