From 52e08f834a31265efd3ada945910a29c4d134ec4 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Sat, 24 Feb 2024 01:12:35 +0100 Subject: [PATCH 1/5] New page ProofDetail --- src/i18n/locales/en.json | 4 +++ src/router.js | 1 + src/views/ProofDetail.vue | 72 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 src/views/ProofDetail.vue diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index b2da4e8817..fa8bdeaf63 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -219,6 +219,10 @@ "DeleteTitle": "Delete a proof", "Success": "Proof deleted!" }, + "ProofDetail": { + "Prices": "Prices", + "LoadMore": "Load more" + }, "Router": { "AddPrice": { "Title": "Add a price" diff --git a/src/router.js b/src/router.js index 35ff03b6ac..4a328a9c90 100644 --- a/src/router.js +++ b/src/router.js @@ -21,6 +21,7 @@ const routes = [ { path: '/locations', name: 'locations', component: () => import('./views/LocationList.vue'), meta: { title: 'TopLocations', icon: 'mdi-medal-outline', drawerMenu: true }}, { path: '/locations/:id', name: 'location-detail', component: () => import('./views/LocationDetail.vue'), meta: { title: 'Location detail' }}, { path: '/brands/:id', name: 'brand-detail', component: () => import('./views/BrandDetail.vue'), meta: { title: 'Brand detail' }}, + { path: '/proofs/:id', name: 'proof-detail', component: () => import('./views/ProofDetail.vue'), meta: { title: 'Proof detail', requiresAuth: true }}, { path: '/users', name: 'users', component: () => import('./views/UserList.vue'), meta: { title: 'TopContributors', icon: 'mdi-medal-outline', drawerMenu: true }}, { path: '/users/:username', name: 'user-detail', component: () => import('./views/UserDetail.vue'), meta: { title: 'User detail' }}, { path: '/stats', name: 'stats', component: () => import('./views/Stats.vue'), meta: { title: 'Stats' }}, diff --git a/src/views/ProofDetail.vue b/src/views/ProofDetail.vue new file mode 100644 index 0000000000..2d4541cfef --- /dev/null +++ b/src/views/ProofDetail.vue @@ -0,0 +1,72 @@ + + + From 0a1148641cb34e29efd004d4c746455d2447b9bf Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Sat, 24 Feb 2024 12:51:26 +0100 Subject: [PATCH 2/5] PriceCard: hide price proof --- src/components/PriceCard.vue | 3 ++- src/components/PriceFooter.vue | 3 ++- src/views/ProofDetail.vue | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/PriceCard.vue b/src/components/PriceCard.vue index 8591faf18c..af72da440b 100644 --- a/src/components/PriceCard.vue +++ b/src/components/PriceCard.vue @@ -35,7 +35,7 @@ - + @@ -61,6 +61,7 @@ export default { 'hidePriceDate': false, 'hidePriceFooter': false, 'hidePriceLocation': false, + 'hidePriceProof': false, 'readonly': false }, data() { diff --git a/src/components/PriceFooter.vue b/src/components/PriceFooter.vue index 722619ddd5..79b6eec1c3 100644 --- a/src/components/PriceFooter.vue +++ b/src/components/PriceFooter.vue @@ -13,7 +13,7 @@ - + @@ -34,6 +34,7 @@ export default { props: { 'price': null, 'hidePriceLocation': false, + 'hidePriceProof': false, 'readonly': false }, data() { diff --git a/src/views/ProofDetail.vue b/src/views/ProofDetail.vue index 2d4541cfef..f4db72a6a0 100644 --- a/src/views/ProofDetail.vue +++ b/src/views/ProofDetail.vue @@ -14,7 +14,7 @@ - + From 7f5eb88c89a0002621c13578bd24f4d1806f6e21 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Sat, 24 Feb 2024 12:57:47 +0100 Subject: [PATCH 3/5] ProofCard: add link to proof detail on price count chip --- src/components/ProofCard.vue | 6 +++++- src/components/ProofFooter.vue | 21 ++++++++++++++++++--- src/views/ProofDetail.vue | 2 +- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/components/ProofCard.vue b/src/components/ProofCard.vue index bd092d6460..5da13858a3 100644 --- a/src/components/ProofCard.vue +++ b/src/components/ProofCard.vue @@ -5,7 +5,7 @@ - + @@ -27,6 +27,10 @@ export default { type: Boolean, default: false, }, + readonly: { + type: Boolean, + default: false, + }, }, data() { return { diff --git a/src/components/ProofFooter.vue b/src/components/ProofFooter.vue index c92bddea1e..ac630e6cd6 100644 --- a/src/components/ProofFooter.vue +++ b/src/components/ProofFooter.vue @@ -11,9 +11,9 @@ {{ proofType }} - + - + @@ -37,6 +37,10 @@ export default { type: Boolean, default: false, }, + readonly: { + type: Boolean, + default: false, + }, }, data() { return { @@ -48,14 +52,25 @@ export default { username() { return this.appStore.user.username }, + isProofOwner() { + return this.username && (this.proof.owner === this.username) + }, userCanDeleteProof() { // user must be proof owner // and proof must not have any prices - return this.username && (this.proof.owner === this.username) && (this.proof.price_count === 0) + return this.isProofOwner && (this.proof.price_count === 0) }, proofType() { return this.$t(`ProofCard.${this.proof.type}`) } + }, + methods: { + goToProof() { + if (this.readonly || !this.isProofOwner) { + return + } + this.$router.push({ path: `/proofs/${this.proof.id}` }) + }, } } diff --git a/src/views/ProofDetail.vue b/src/views/ProofDetail.vue index f4db72a6a0..3faa05f8c4 100644 --- a/src/views/ProofDetail.vue +++ b/src/views/ProofDetail.vue @@ -1,7 +1,7 @@