Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Make `searchTerm` for VAudioTrack and VImageCell optional (#955)
Olga Bulat5ca56c9f9270
diff --git a/frontend/src/components/VAudioTrack/VAudioTrack.vue b/frontend/src/components/VAudioTrack/VAudioTrack.vueindex 197fefe51..290bca51d 100644--- a/frontend/src/components/VAudioTrack/VAudioTrack.vue+++ b/frontend/src/components/VAudioTrack/VAudioTrack.vue@@ -135,7 +135,6 @@ export default defineComponent({*/searchTerm: {type: String,- required: true,},},emits: {@@ -456,7 +455,9 @@ export default defineComponent({const layoutBasedProps = computed(() =>isComposite.value? {- href: `/audio/${props.audio.id}/?q=${props.searchTerm}`,+ href: `/audio/${props.audio.id}/${+ props.searchTerm ? "?q=" + props.searchTerm : ""+ }`,class: ["cursor-pointer",{diff --git a/frontend/src/components/VSearchResultsGrid/VImageCell.vue b/frontend/src/components/VSearchResultsGrid/VImageCell.vueindex a0ed13aed..ea8cdb643 100644--- a/frontend/src/components/VSearchResultsGrid/VImageCell.vue+++ b/frontend/src/components/VSearchResultsGrid/VImageCell.vue@@ -2,7 +2,7 @@<VLinkitemprop="contentUrl":title="image.title"- :href="`/image/${image.id}?q=${searchTerm}`"+ :href="imageLink"class="group relative block w-full overflow-hidden rounded-sm bg-dark-charcoal-10 text-dark-charcoal-10 focus-bold-filled":aria-label="image.title":style="styles.container"@@ -65,9 +65,12 @@ export default defineComponent({type: Object as PropType<ImageDetail>,required: true,},+ /**+ * The search term is added to the URL to allow the user to+ * navigate back/forward to the search results page.+ */searchTerm: {type: String,- required: true,},/*** All content view uses the square image cells, Image view@@ -96,6 +99,12 @@ export default defineComponent({return toAbsolutePath(url)})+ const imageLink = computed(() => {+ return `/image/${props.image.id}/${+ props.searchTerm ? "?q=" + props.searchTerm : ""+ }`+ })+const getImageForeignUrl = () =>toAbsolutePath(props.image.foreign_landing_url)@@ -126,6 +135,7 @@ export default defineComponent({imgWidth,imgHeight,imageUrl,+ imageLink,getImageForeignUrl,onImageLoadError,