Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add External sources popover instead of the Meta search form (#1665)
Olga Bulat9eb9561faec8
diff --git a/src/components/VMetaSearch/VMetaSearchForm.vue b/src/components/VMetaSearch/VMetaSearchForm.vueindex f5cd8efd1..24ab81264 100644--- a/src/components/VMetaSearch/VMetaSearchForm.vue+++ b/src/components/VMetaSearch/VMetaSearchForm.vue@@ -2,23 +2,27 @@<section:key="type"ref="sectionRef"- class="meta-search p-6 text-center"+ class="meta-search mb-16 flex flex-row place-items-center justify-center p-4"data-testid="meta-search-form"@keydown.tab.exact="handleTab"><i18n- v-if="!hasNoResults"- :path="- isSupported- ? 'meta-search.form.supported-title'- : 'meta-search.form.unsupported-title'- "+ v-if="!hasNoResults && isSupported"+ path="meta-search.form.supported-title"+ tag="p"+ class="text-base font-normal leading-[130%]"+ />++ <i18n+ v-else-if="!hasNoResults && !isSupported"+ path="meta-search.form.unsupported-title"tag="p"class="text-base font-normal leading-[130%]"><template #openverse>Openverse</template><template #type>{{ $t(`meta-search.form.types.${type}`) }}</template></i18n>+<i18nv-elsepath="meta-search.form.no-results-title"@@ -28,28 +32,12 @@<template #type>{{ $t(`meta-search.form.types.${type}`) }}</template><template #query>{{ query.q }}</template></i18n>- <i18n- class="text-base font-normal leading-[130%]"- path="meta-search.form.caption"- tag="p"- >- <template #type>{{- $t(`meta-search.form.types-plural.${type}`)- }}</template>- <template #break>- <br />- </template>- </i18n><VMetaSourceList- class="my-8 md:justify-center"+ class="ms-2 inline-flex md:justify-center":type="type":query="query"/>-- <p class="my-0 mx-auto max-w-3xl text-base font-normal leading-[130%]">- {{ $t('meta-search.caption', { openverse: 'Openverse' }) }}- </p></section></template>diff --git a/src/components/VMetaSearch/VMetaSourceList.vue b/src/components/VMetaSearch/VMetaSourceList.vueindex 6384cc2ce..38962c2e4 100644--- a/src/components/VMetaSearch/VMetaSourceList.vue+++ b/src/components/VMetaSearch/VMetaSourceList.vue@@ -1,27 +1,66 @@<template>- <ul- class="meta-sources flex w-full flex-col flex-wrap items-stretch gap-4 md:flex-row"+ <VPopover+ ref="sourceListPopover"+ class="flex items-stretch"+ :label="$t('meta-search.button').toString()"+ placement="top-start">- <li v-for="source in sources" :key="source.name">+ <template #trigger="{ a11yProps }"><VButton- as="VLink"+ :pressed="a11yProps['aria-expanded']"+ :aria-haspopup="a11yProps['aria-haspopup']"+ aria-controls="source-list-popover"variant="tertiary"size="disabled"- :href="source.url"- class="w-full p-4 text-sr font-bold md:w-auto md:py-2 md:px-3"+ class="justify-between py-1 px-3 text-sr font-normal leading-[130%] text-dark-charcoal pe-2"+ >{{ $t('meta-search.button').toString() }}+ <VIcon+ class="text-dark-charcoal-40 ms-1"+ :class="a11yProps['aria-expanded'] ? 'rotate-180' : 'rotate-0'"+ :icon-path="icons.caretDown"+ /></VButton>+ </template>+ <template #default="{ close }">+ <div+ class="relative max-w-[280px] p-2 pt-0"+ data-testid="source-list-popover">- {{ source.name }}- <sup class="top-0">+ <VIconButton+ class="absolute top-0 border-none text-dark-charcoal-70 end-0"+ size="search-medium"+ :icon-props="{ iconPath: icons.closeSmall }"+ :button-props="{+ 'aria-label': $t('modal.close').toString(),+ variant: 'plain',+ }"+ @click="close"+ />+ <h2 class="mb-2 px-4 pt-5 text-base font-semibold text-start">+ {{ $t('meta-search.title') }}+ </h2>+ <p class="mb-4 px-4 text-sr text-start">+ {{ $t('meta-search.caption', { openverse: 'Openverse' }) }}+ </p>+ <VButton+ v-for="source in sources"+ :key="source.name"+ as="VLink"+ variant="plain"+ size="disabled"+ class="w-full justify-between px-4 py-3 text-sr font-bold text-dark-charcoal hover:bg-dark-charcoal-10"+ :href="source.url"+ >+ {{ source.name }}<VIcon:icon-path="icons.externalLink":size="4":rtl-flip="true"class="ms-2"/>- </sup>- </VButton>- </li>- </ul>+ </VButton>+ </div>+ </template>+ </VPopover></template><script lang="ts">@@ -33,8 +72,12 @@ import type { MediaType } from '~/constants/media'import VButton from '~/components/VButton.vue'import VIcon from '~/components/VIcon/VIcon.vue'+import VIconButton from '~/components/VIconButton/VIconButton.vue'+import VPopover from '~/components/VPopover/VPopover.vue'import externalLinkIcon from '~/assets/icons/external-link.svg'+import caretDownIcon from '~/assets/icons/caret-down.svg'+import closeSmallIcon from '~/assets/icons/close-small.svg'/*** This component renders a list of pre-populated links to additional sources@@ -42,7 +85,7 @@ import externalLinkIcon from '~/assets/icons/external-link.svg'*/export default defineComponent({name: 'VMetaSourceList',- components: { VButton, VIcon },+ components: { VButton, VIcon, VIconButton, VPopover },props: {/*** the media type to use as the criteria for filtering additional sources@@ -61,6 +104,8 @@ export default defineComponent({return {icons: {externalLink: externalLinkIcon,+ caretDown: caretDownIcon,+ closeSmall: closeSmallIcon,},sources,}diff --git a/src/locales/en.json b/src/locales/en.jsonindex fee37e68c..9bae9e870 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -512,19 +512,16 @@"weblink": "Get this audio"},"meta-search": {- "caption": "{openverse} does not currently index the sources listed above, but through this interface is offering convenient access to search services provided by other independent organizations. {openverse} has no control over the results that are returned. Do not assume that the results displayed in this search portal are under a CC license. Always verify that the work is actually under a CC license by following the link. If you are in doubt, you should contact the copyright holder directly, or try to contact the site where you found the content.",+ "caption": "{openverse} can not guarantee the accuracy of license information. Always verify that the work is actually under a CC license.",+ "button": "Source list",+ "title": "External sources","card": {- "search": "Not finding what you're looking for? Try additional sources",- "caption": "Click on a source below to directly search other collections of CC-licensed images.{break}Please note that Use filters are not supported for Open Clip Art Library or Nappy.",- "checkboxes": {- "title": "Use",- "commercial": "Use for commercial purposes",- "modify": "Modify or adapt"- }+ "search": "Not finding what you're looking for? Try external sources",+ "caption": "Click on a source below to directly search other collections of CC-licensed images.{break}Please note that Use filters are not supported for Open Clip Art Library or Nappy."},"form": {"unsupported-title": "{openverse} does not yet support built-in {type} search.",- "supported-title": "Not finding what you're looking for? Try additional {type} sources.",+ "supported-title": "Not finding what you're looking for? Try an external source:","no-results-title": "No {type} results for \"{query}\".","caption": "Click on a source below to directly search other collections of CC-licensed {type}.","types": {@@ -615,7 +612,7 @@},"no-results": {"heading": "We couldn't find anything for \"{query}\".",- "alternatives": "Try a different query or use one of the additional sources to expand your search."+ "alternatives": "Try a different query or use one of the external sources to expand your search."},"server-timeout": {"heading": "Whoops, it looks like that request took too long to complete. Please try again."@@ -628,7 +625,7 @@"model-3d": "3D Models","label": "Type of content to search","heading": "Content types",- "additional": "Additional sources",+ "additional": "Coming soon","status-beta": "Beta","see-image": "See all images","see-audio": "See all audio"diff --git a/test/locales/ar.json b/test/locales/ar.jsonindex 532edb019..2db55f239 100644--- a/test/locales/ar.json+++ b/test/locales/ar.json@@ -44,7 +44,7 @@},"no-results": {"heading": "لم نتمكن من العثور على أي شيء لـ \"{query}\".",- "alternatives": "جرب استعلامًا مختلفًا أو استخدم أحد المصادر الإضافية لتوسيع نطاق البحث."+ "alternatives": "جرب استعلامًا مختلفًا أو استخدم أحد المصادر الخارجية لتوسيع نطاق البحث."},"error-images": {"depressed-musician": "عازف البيانو المكتئب يضع رأسه في أيديهم.",@@ -118,10 +118,16 @@"edge": "حافة"},"meta-search": {- "caption": "لا يقوم {openverse} حاليًا بفهرسة المصادر المذكورة أعلاه ، ولكن من خلال هذه الواجهة يوفر وصولاً سهلاً إلى خدمات البحث التي تقدمها مؤسسات مستقلة أخرى. {openverse} لا يتحكم في النتائج التي يتم إرجاعها. لا تفترض أن النتائج المعروضة في بوابة البحث هذه تخضع لترخيص CC. تحقق دائمًا من أن العمل خاضع بالفعل لترخيص CC باتباع الرابط. إذا كنت في شك ، فيجب عليك الاتصال بصاحب حقوق الطبع والنشر مباشرةً ، أو محاولة الاتصال بالموقع الذي عثرت فيه على المحتوى.",+ "caption": "{openverse} لا يتحكم في النتائج ، تحقق دائمًا من أن العمل في الواقع خاضع لترخيص CC.",+ "button": "قائمة مصدر",+ "title": "مصادر خارجية",+ "card": {+ "search": "لا تجد ما تبحث عنه؟ جرب المصادر الخارجية",+ "caption": "انقر فوق أحد المصادر أدناه للبحث مباشرة في مجموعات أخرى من الصور المرخصة CC. {break} يرجى ملاحظة أن استخدام المرشحات غير مدعوم لمكتبة Open Clip Art Library أو Nappy."+ },"form": {"unsupported-title": "{openverse} لا يدعم حتى الآن البحث المضمن {type}.",- "supported-title": "لا تجد ما تبحث عنه؟ جرب مصادر {type} إضافية.",+ "supported-title": "لا تجد ما تبحث عنه؟ جرب مصدر خارجي:","no-results-title": "لا توجد نتائج {type} لـ \"{query}\".","caption": "انقر فوق أحد المصادر أدناه للبحث مباشرة في مجموعات أخرى من {type} المرخصة CC.","types-plural": {@@ -136,15 +142,6 @@"video": "فيديو","model-3d": "نموذج 3D"}- },- "card": {- "search": "لا تجد ما تبحث عنه؟ جرب مصادر إضافية",- "caption": "انقر فوق أحد المصادر أدناه للبحث مباشرة في مجموعات أخرى من الصور المرخصة CC. {break} يرجى ملاحظة أن استخدام المرشحات غير مدعوم لمكتبة Open Clip Art Library أو Nappy.",- "checkboxes": {- "title": "يستخدم",- "commercial": "الاستخدام لأغراض تجارية",- "modify": "تعديل أو تكييف"- }}},"audio-details": {diff --git a/test/playwright/visual-regression/components/external-sources-section.spec.ts b/test/playwright/visual-regression/components/external-sources-section.spec.tsnew file mode 100644index 000000000..c2116dbb1--- /dev/null+++ b/test/playwright/visual-regression/components/external-sources-section.spec.ts@@ -0,0 +1,31 @@+import { test, expect } from '@playwright/test'++import {+ goToSearchTerm,+ languageDirections,+} from '~~/test/playwright/utils/navigation'++import { supportedSearchTypes } from '~/constants/media'++test.describe.configure({ mode: 'parallel' })++for (const dir of languageDirections) {+ for (const searchType of supportedSearchTypes) {+ test(`External ${searchType} sources popover - ${dir}`, async ({+ page,+ }) => {+ await goToSearchTerm(page, 'birds', { searchType, dir })+ const externalSourcesButton = page.locator(+ '[aria-controls="source-list-popover"]'+ )++ await externalSourcesButton.click()++ expect(+ await page.locator('[data-testid="source-list-popover"]').screenshot()+ ).toMatchSnapshot({+ name: `external-${searchType}-sources-popover-${dir}.png`,+ })+ })+ }+}diff --git a/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-all-sources-popover-ltr-linux.png b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-all-sources-popover-ltr-linux.pngnew file mode 100644index 000000000..963ce3c2fBinary files /dev/null and b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-all-sources-popover-ltr-linux.png differdiff --git a/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-all-sources-popover-rtl-linux.png b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-all-sources-popover-rtl-linux.pngnew file mode 100644index 000000000..299cd3435Binary files /dev/null and b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-all-sources-popover-rtl-linux.png differdiff --git a/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-audio-sources-popover-ltr-linux.png b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-audio-sources-popover-ltr-linux.pngnew file mode 100644index 000000000..6bdd3f676Binary files /dev/null and b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-audio-sources-popover-ltr-linux.png differdiff --git a/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-audio-sources-popover-rtl-linux.png b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-audio-sources-popover-rtl-linux.pngnew file mode 100644index 000000000..a7414607eBinary files /dev/null and b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-audio-sources-popover-rtl-linux.png differdiff --git a/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-image-sources-popover-ltr-linux.png b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-image-sources-popover-ltr-linux.pngnew file mode 100644index 000000000..7c081d444Binary files /dev/null and b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-image-sources-popover-ltr-linux.png differdiff --git a/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-image-sources-popover-rtl-linux.png b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-image-sources-popover-rtl-linux.pngnew file mode 100644index 000000000..df0facde5Binary files /dev/null and b/test/playwright/visual-regression/components/external-sources-section.spec.ts-snapshots/external-image-sources-popover-rtl-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-2xl-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-2xl-linux.pngindex 0c2223dd7..d5e0b3098 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-2xl-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-2xl-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-lg-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-lg-linux.pngindex f6442b3e3..2be030ff0 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-lg-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-lg-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-md-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-md-linux.pngindex d1e8e4aba..7793461be 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-md-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-md-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-sm-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-sm-linux.pngindex 5eddb2a48..67d92c920 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-sm-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-sm-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-xl-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-xl-linux.pngindex b86e6e721..75f33699d 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-xl-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-xl-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-xs-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-xs-linux.pngindex 004fb518c..f19dd8c7c 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-xs-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-ltr-xs-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-2xl-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-2xl-linux.pngindex 4821c972f..57cb6fad2 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-2xl-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-2xl-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-lg-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-lg-linux.pngindex 87df9af0e..90e17b86b 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-lg-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-lg-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-md-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-md-linux.pngindex 6721cd248..0c2ff07c3 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-md-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-md-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-sm-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-sm-linux.pngindex 394c8eac6..e43fc9eb9 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-sm-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-sm-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-xl-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-xl-linux.pngindex 561457880..2a9304255 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-xl-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-xl-linux.png differdiff --git a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-xs-linux.png b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-xs-linux.pngindex 489c1be0b..6a25428d1 100644Binary files a/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-xs-linux.png and b/test/playwright/visual-regression/pages/pages.spec.ts-snapshots/meta-search-rtl-xs-linux.png differdiff --git a/tsconfig.json b/tsconfig.jsonindex 6f80a0f03..d51ecbe55 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -47,6 +47,7 @@"src/components/VMigrationNotice.vue","src/components/VVariations.vue","src/components/VBackToSearchResultsLink.vue",+ "src/components/VSnackbar.vue","src/components/VSourcesTable.vue","src/components/TableSortIcon.vue","src/components/VCopyButton.vue",@@ -65,8 +66,6 @@"src/components/VLogoLoader/**.vue","src/components/VMediaInfo/**.vue","src/components/VMediaTag/**.vue",- "src/components/VMetaSearch/*.vue",- "src/components/VSnackbar.vue","src/components/VSkeleton/**.vue","src/components/VTabs/**.vue",