Error.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import { errorOptions } from '#shared/router/error.ts'
  5. import { ErrorStatusCodes } from '#shared/types/error.ts'
  6. import CommonBackButton from '#mobile/components/CommonBackButton/CommonBackButton.vue'
  7. const errorImage = computed(() => {
  8. switch (errorOptions.value.statusCode) {
  9. case ErrorStatusCodes.Forbidden:
  10. return '/assets/error/error-403.svg'
  11. case ErrorStatusCodes.NotFound:
  12. return '/assets/error/error-404.svg'
  13. case ErrorStatusCodes.InternalError:
  14. default:
  15. return '/assets/error/error-500.svg'
  16. }
  17. })
  18. </script>
  19. <template>
  20. <div class="flex min-h-screen flex-col px-4">
  21. <header class="fixed">
  22. <div class="grid h-16 grid-cols-[75px_auto_75px]">
  23. <div
  24. class="flex cursor-pointer items-center justify-self-start text-base"
  25. >
  26. <CommonBackButton fallback="/" />
  27. </div>
  28. </div>
  29. </header>
  30. <main class="flex grow flex-col items-center justify-center">
  31. <h1 class="mb-9 text-8xl font-extrabold">
  32. {{ errorOptions.statusCode }}
  33. </h1>
  34. <img :alt="$t('Error')" :src="errorImage" />
  35. <h2 class="mt-9 max-w-prose text-center text-xl font-semibold">
  36. {{ $t(errorOptions.title) }}
  37. </h2>
  38. <p class="text-gray mt-4 min-h-[4rem] max-w-prose text-center">
  39. {{
  40. $t(errorOptions.message, ...(errorOptions.messagePlaceholder || []))
  41. }}
  42. </p>
  43. <p v-if="errorOptions.route" class="text-gray max-w-prose text-center">
  44. {{ errorOptions.route }}
  45. </p>
  46. </main>
  47. </div>
  48. </template>