Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Clean up the PhotoDetailPage and PhotoDetails components (#334)

Olga Bulatd63d25266a1a
diff --git a/src/components/ImageDetails/PhotoDetails.vue b/src/components/ImageDetails/PhotoDetails.vue
index be175687c..c9b48448d 100644
--- a/src/components/ImageDetails/PhotoDetails.vue
+++ b/src/components/ImageDetails/PhotoDetails.vue
@@ -30,9 +30,9 @@
<div class="mb-1 text-left">
<button
+ type="button"
class="button is-text tiny p-0 report mt-2"
- @click.prevent="toggleReportFormVisibility"
- @keypress.enter.prevent="toggleReportFormVisibility"
+ @click="toggleReportFormVisibility"
>
<span class="text-trans-blue ml-2 text-sm">
<i class="icon flag mr-2" />
@@ -139,7 +139,6 @@
</section>
<a
- v-if="activeTab < 2"
data-testid="source-button"
:href="image.foreign_landing_url"
target="_blank"
@@ -152,7 +151,7 @@
<i class="icon external-link ml-4 text-base pt-1 text-light-gray" />
</a>
- <ReuseSurvey v-if="activeTab < 2" :image="image" />
+ <ReuseSurvey :image="image" />
</div>
</div>
</template>
@@ -173,7 +172,6 @@ export default {
'image',
'breadCrumbURL',
'shouldShowBreadcrumb',
- 'query',
'imageWidth',
'imageHeight',
'imageType',
@@ -237,7 +235,7 @@ export default {
this.activeTab = tabIdx
},
attributionHtml() {
- const licenseUrl = `${this.openverseLicenseUrl}&atype=html`
+ const licenseUrl = `${this.licenseUrl}&atype=html`
return attributionHtml(this.image, licenseUrl, this.fullLicenseName)
},
toggleReportFormVisibility() {
diff --git a/src/components/SearchGridManualLoad.vue b/src/components/SearchGridManualLoad.vue
index 2e5de0e4a..d0c4834f4 100644
--- a/src/components/SearchGridManualLoad.vue
+++ b/src/components/SearchGridManualLoad.vue
@@ -54,7 +54,6 @@
<MetaSearchForm
type="image"
:noresult="storeImagesCount === 0"
- :query="query"
:supported="true"
/>
</div>
diff --git a/src/pages/audio/_id.vue b/src/pages/audio/_id.vue
index 48055bd80..25e4861ce 100644
--- a/src/pages/audio/_id.vue
+++ b/src/pages/audio/_id.vue
@@ -47,13 +47,7 @@ const AudioDetailPage = {
}
},
computed: {
- ...mapState(['query', 'audio']),
- filter() {
- return this.query.filter
- },
- tags() {
- return this.audio.tags
- },
+ ...mapState(['audio']),
fullLicenseName() {
return getFullLicenseName(this.audio.license, this.audio.license_version)
},
diff --git a/src/pages/photos/_id.vue b/src/pages/photos/_id.vue
index e4d3a9c5e..14eeb91f5 100644
--- a/src/pages/photos/_id.vue
+++ b/src/pages/photos/_id.vue
@@ -5,7 +5,6 @@
:thumbnail="thumbnailURL"
:bread-crumb-u-r-l="breadCrumbURL"
:should-show-breadcrumb="shouldShowBreadcrumb"
- :query="query"
:image-width="imageWidth"
:image-height="imageHeight"
:image-type="imageType"
@@ -17,9 +16,8 @@
<script>
import axios from 'axios'
-import { mapActions, mapMutations, mapState } from 'vuex'
+import { mapActions, mapState } from 'vuex'
import { FETCH_IMAGE } from '~/constants/action-types'
-import { SET_IMAGE } from '~/constants/mutation-types'
const PhotoDetailPage = {
name: 'PhotoDetailPage',
@@ -31,7 +29,6 @@ const PhotoDetailPage = {
data() {
return {
breadCrumbURL: '',
- hasClarifaiTags: false,
isPrimaryImageLoaded: false,
shouldShowBreadcrumb: false,
imageWidth: 0,
@@ -42,13 +39,7 @@ const PhotoDetailPage = {
}
},
computed: {
- ...mapState(['images', 'query', 'image']),
- filter() {
- return this.query.filter
- },
- tags() {
- return this.image.tags
- },
+ ...mapState(['image']),
},
async asyncData({ env, route }) {
return {
@@ -79,7 +70,6 @@ const PhotoDetailPage = {
},
methods: {
...mapActions([FETCH_IMAGE]),
- ...mapMutations([SET_IMAGE]),
onImageLoaded(event) {
this.imageWidth = event.target.naturalWidth
this.imageHeight = event.target.naturalHeight
diff --git a/src/pages/search/audio.vue b/src/pages/search/audio.vue
index 99dbed379..ff5616d49 100644
--- a/src/pages/search/audio.vue
+++ b/src/pages/search/audio.vue
@@ -6,12 +6,7 @@
:query="query"
@onLoadMoreAudios="onLoadMoreAudios"
/>
- <MetaSearchForm
- type="audio"
- :query="query"
- :noresult="false"
- :supported="supported"
- />
+ <MetaSearchForm type="audio" :noresult="false" :supported="supported" />
</div>
</template>