Skip to content

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

Fix Audio single result layout (#2006)

Olga Bulatdcf5cffaddce
diff --git a/package.json b/package.json
index 1c60d1277..0c2905360 100644
--- a/package.json
+++ b/package.json
@@ -43,11 +43,13 @@
"test:playwright:debug": "PWDEBUG=1 pnpm test:playwright:local",
"test:playwright:recreate-tapes": "rimraf test/tapes && pnpm test:playwright:update-tapes",
"test:playwright:update-tapes": "UPDATE_TAPES=true pnpm test:playwright",
+ "test:playwright:update-snapshots": "pnpm test:playwright visual-regression --update-snapshots",
"test:playwright:gen": "playwright codegen localhost:8443/",
"test:storybook": "TEST_COMMAND=test:storybook:local ./bin/playwright.sh",
"test:storybook:local": "playwright test -c test/storybook",
"test:storybook:debug": "PWDEBUG=1 pnpm test:storybook:local",
"test:storybook:gen": "playwright codegen localhost:54000/",
+ "test:storybook:update-snapshots": "pnpm test:storybook --update-snapshots",
"types": "vue-tsc --noEmit",
"lint": "prettier --check .; eslint --ext .js,.vue,.ts --ignore-path .gitignore --ignore-path .eslintignore --max-warnings=0 .",
"lint:fix": "prettier --write --loglevel=warn .; pnpm lint --fix",
diff --git a/src/components/VAudioDetails/VAudioDetails.vue b/src/components/VAudioDetails/VAudioDetails.vue
index df1104cf3..c960ec3af 100644
--- a/src/components/VAudioDetails/VAudioDetails.vue
+++ b/src/components/VAudioDetails/VAudioDetails.vue
@@ -1,7 +1,7 @@
<template>
<section class="audio-info">
<header class="mb-6 flex flex-row items-center justify-between">
- <h2 class="text-2xl lg:text-3xl">
+ <h2 class="heading-6 md:heading-5">
{{ $t('audio-details.information') }}
</h2>
<VContentReportPopover :media="audio" />
diff --git a/src/components/VAudioDetails/VRelatedAudio.vue b/src/components/VAudioDetails/VRelatedAudio.vue
index 6265468f2..23570e639 100644
--- a/src/components/VAudioDetails/VRelatedAudio.vue
+++ b/src/components/VAudioDetails/VRelatedAudio.vue
@@ -1,12 +1,12 @@
<template>
<aside :aria-label="$t('audio-details.related-audios')">
- <h2 class="mb-6 text-2xl lg:text-3xl">
+ <h2 class="heading-6 lg:heading-6 mb-6">
{{ $t('audio-details.related-audios') }}
</h2>
<!-- Negative margin compensates for the `p-4` padding in row layout. -->
<div
v-if="!fetchState.fetchingError"
- class="-mx-4 mb-12 flex flex-col gap-4"
+ class="-mx-2 mb-12 flex flex-col gap-4 md:-mx-4"
>
<VAudioTrack
v-for="audio in media"
@@ -23,31 +23,30 @@
</aside>
</template>
-<script>
-import { computed } from '@nuxtjs/composition-api'
+<script lang="ts">
+import { computed, defineComponent, PropType } from '@nuxtjs/composition-api'
import { useUiStore } from '~/stores/ui'
+import type { FetchState } from '~/models/fetch-state'
+import type { AudioDetail } from '~/models/media'
+
import LoadingIcon from '~/components/LoadingIcon.vue'
import VAudioTrack from '~/components/VAudioTrack/VAudioTrack.vue'
-export default {
+export default defineComponent({
name: 'VRelatedAudio',
components: { VAudioTrack, LoadingIcon },
props: {
media: {
- type: Array,
+ type: Array as PropType<AudioDetail>,
required: true,
},
fetchState: {
- type: Object,
+ type: Object as PropType<FetchState>,
required: true,
},
},
- /**
- * Fetches related audios on `audioId` change
- * @return {{audioTrackSize: import('@nuxtjs/composition-api').ComputedRef<"l" | "s"> }}
- */
setup() {
const uiStore = useUiStore()
@@ -57,5 +56,5 @@ export default {
return { audioTrackSize }
},
-}
+})
</script>
diff --git a/src/components/VModal/VModalContent.vue b/src/components/VModal/VModalContent.vue
index 16c358c36..2f5c5fd8d 100644
--- a/src/components/VModal/VModalContent.vue
+++ b/src/components/VModal/VModalContent.vue
@@ -28,7 +28,7 @@
-->
<div
v-if="variant === 'default'"
- class="md:justify-end md:bg-tx md:px-0 md:py-3 flex w-full shrink-0 justify-between py-4 pe-3 ps-4"
+ class="flex w-full shrink-0 justify-between py-4 pe-3 ps-4 md:justify-end md:bg-tx md:px-0 md:py-3"
:class="[$style[`top-bar-${variant}`], $style[`top-bar-${mode}`]]"
>
<VLogoButtonOld
@@ -41,7 +41,7 @@
ref="closeButton"
size="disabled"
variant="plain"
- class="md:text-base md:text-white text-sr"
+ class="text-sr md:text-base md:text-white"
@click="hide()"
>
{{ $t('modal.close') }}
@@ -179,10 +179,10 @@ export default defineComponent({
<style module>
.top-bar-default {
- @apply md:justify-end md:bg-tx md:px-0 md:py-3 flex w-full shrink-0 justify-between bg-white py-4 pe-3 ps-4;
+ @apply flex w-full shrink-0 justify-between bg-white py-4 pe-3 ps-4 md:justify-end md:bg-tx md:px-0 md:py-3;
}
.top-bar-full {
- @apply md:items-stretch md:justify-start md:py-4 md:px-7 flex h-20 w-full shrink-0 justify-between bg-dark-charcoal px-4 py-3;
+ @apply flex h-20 w-full shrink-0 justify-between bg-dark-charcoal px-4 py-3 md:items-stretch md:justify-start md:py-4 md:px-7;
}
.top-bar-two-thirds {
@apply bg-tx;
@@ -201,7 +201,7 @@ export default defineComponent({
@apply bg-white text-dark-charcoal;
}
.modal-content-default {
- @apply md:rounded-t-md text-left align-bottom;
+ @apply text-left align-bottom md:rounded-t-md;
}
.modal-content-full {
@apply flex w-full flex-col justify-between px-6 pb-10;
diff --git a/src/types/media.ts b/src/types/media.ts
index 05e1cd189..1e31ce512 100644
--- a/src/types/media.ts
+++ b/src/types/media.ts
@@ -27,6 +27,8 @@ export interface Media {
frontendMediaType: SupportedMediaType
+ description?: string
+
category: string | null
provider: string
source?: string
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-2xl-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-2xl-linux.png
index 89b6ac57d..5ac523cd4 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-2xl-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-2xl-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-lg-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-lg-linux.png
index 2ff3ba4fa..c62d133db 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-lg-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-lg-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-md-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-md-linux.png
index c4edfcebc..0553496f9 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-md-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-md-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-sm-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-sm-linux.png
index a5834ef9b..4aff14b3d 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-sm-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-sm-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-xl-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-xl-linux.png
index e80bd53e5..2d6792295 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-xl-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-xl-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-xs-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-xs-linux.png
index 1724bfebd..fdbe0b2cd 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-xs-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-ltr-from-search-results-xs-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-2xl-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-2xl-linux.png
index 21c741995..afbdb4404 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-2xl-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-2xl-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-lg-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-lg-linux.png
index 6af29bb6e..712950694 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-lg-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-lg-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-md-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-md-linux.png
index 4f60aff54..e39a9528b 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-md-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-md-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-sm-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-sm-linux.png
index 1d950c07a..2ff750713 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-sm-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-sm-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-xl-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-xl-linux.png
index 283dbc399..0a06f7972 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-xl-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-xl-linux.png differ
diff --git a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-xs-linux.png b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-xs-linux.png
index fa30c5dde..65f3df990 100644
Binary files a/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-xs-linux.png and b/test/playwright/visual-regression/pages/pages-single-result.spec.ts-snapshots/audio-rtl-from-search-results-xs-linux.png differ