Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
<script setup lang="ts">
import { navigateTo, useHead } from "#imports"
import { computed } from "vue"
import { ALL_MEDIA } from "#shared/constants/media"
import { skipToContentTargetId } from "#shared/constants/window"
import { useSearchStore } from "~/stores/search"
import { useAnalytics } from "~/composables/use-analytics"
import VLink from "~/components/VLink.vue"
import VStandaloneSearchBar from "~/components/VHeader/VSearchBar/VStandaloneSearchBar.vue"
import VSvg from "~/components/VSvg/VSvg.vue"
import type { NuxtError } from "#app"
const props = defineProps<{ error: NuxtError }>()
const isRateLimited = computed(() => props.error?.statusCode === 429)
const searchStore = useSearchStore()
const { sendCustomEvent } = useAnalytics()
const handleSearch = (searchTerm: string) => {
sendCustomEvent("SUBMIT_SEARCH", {
searchType: ALL_MEDIA,
query: searchTerm,
})
return navigateTo(
searchStore.updateSearchPath({ type: ALL_MEDIA, searchTerm })
)
}
useHead({
meta: [{ key: "theme-color", name: "theme-color", content: "#ffe033" }],
})
</script>
<template>
<div class="error grid overflow-x-hidden">
<VSvg
class="pointer-events-none z-0 col-start-1 row-start-1 mx-[-15%] fill-gray-12 opacity-5 lg:mx-15 lg:-mt-20 dark:fill-gray-8"
viewBox="0 0 1320 569"
name="oops"
/>
<div
class="page-404 col-start-1 row-start-1 flex flex-col justify-self-stretch px-6 lg:max-w-2xl lg:justify-self-center lg:px-0"
>
<!-- Push content by 1/4th height without absolute positioning. -->
<div class="spacer grow" />
<main
:id="skipToContentTargetId"
tabindex="-1"
class="z-10 grow-3 space-y-4 lg:space-y-6"
>
<template v-if="isRateLimited">
<h1 class="mb-6 heading-5 lg:mb-10 lg:heading-2">
{{ $t("rateLimited.heading") }}
</h1>
<p class="label-bold lg:heading-6">
{{ $t("rateLimited.description") }}
</p>
</template>
<h1 v-else class="mb-6 heading-5 lg:mb-10 lg:heading-2">
{{ $t("404.title") }}
</h1>
<p v-if="!isRateLimited" class="label-bold lg:heading-6">
<i18n-t scope="global" keypath="404.main" tag="span">
<template #link>
<VLink
class="text-current underline hover:text-current active:text-current"
href="/"
>Openverse</VLink
>
</template>
</i18n-t>
</p>
<VStandaloneSearchBar route="404" @submit="handleSearch" />
</main>
</div>
</div>
</template>