OnBoarding.svelte 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <script>
  2. import { getContext, onMount } from 'svelte';
  3. const i18n = getContext('i18n');
  4. import { WEBUI_BASE_URL } from '$lib/constants';
  5. import Marquee from './common/Marquee.svelte';
  6. import SlideShow from './common/SlideShow.svelte';
  7. import ArrowRightCircle from './icons/ArrowRightCircle.svelte';
  8. export let show = true;
  9. export let getStartedHandler = () => {};
  10. function setLogoImage() {
  11. const logo = document.getElementById('logo');
  12. if (logo) {
  13. const isDarkMode = document.documentElement.classList.contains('dark');
  14. if (isDarkMode) {
  15. const darkImage = new Image();
  16. darkImage.src = `${WEBUI_BASE_URL}/static/favicon-dark.png`;
  17. darkImage.onload = () => {
  18. logo.src = `${WEBUI_BASE_URL}/static/favicon-dark.png`;
  19. logo.style.filter = ''; // Ensure no inversion is applied if splash-dark.png exists
  20. };
  21. darkImage.onerror = () => {
  22. logo.style.filter = 'invert(1)'; // Invert image if splash-dark.png is missing
  23. };
  24. }
  25. }
  26. }
  27. $: if (show) {
  28. setLogoImage();
  29. }
  30. </script>
  31. {#if show}
  32. <div class="w-full h-screen max-h-[100dvh] text-white relative">
  33. <div class="fixed m-10 z-50">
  34. <div class="flex space-x-2">
  35. <div class=" self-center">
  36. <img
  37. id="logo"
  38. crossorigin="anonymous"
  39. src="{WEBUI_BASE_URL}/static/favicon.png"
  40. class=" w-6 rounded-full"
  41. alt="logo"
  42. />
  43. </div>
  44. </div>
  45. </div>
  46. <SlideShow duration={5000} />
  47. <div
  48. class="w-full h-full absolute top-0 left-0 bg-linear-to-t from-20% from-black to-transparent"
  49. ></div>
  50. <div class="w-full h-full absolute top-0 left-0 backdrop-blur-xs bg-black/50"></div>
  51. <div class="relative bg-transparent w-full h-screen max-h-[100dvh] flex z-10">
  52. <div class="flex flex-col justify-end w-full items-center pb-10 text-center">
  53. <div class="text-5xl lg:text-7xl font-secondary">
  54. <Marquee
  55. duration={5000}
  56. words={[
  57. $i18n.t('Explore the cosmos'),
  58. $i18n.t('Unlock mysteries'),
  59. $i18n.t('Chart new frontiers'),
  60. $i18n.t('Dive into knowledge'),
  61. $i18n.t('Discover wonders'),
  62. $i18n.t('Ignite curiosity'),
  63. $i18n.t('Forge new paths'),
  64. $i18n.t('Unravel secrets'),
  65. $i18n.t('Pioneer insights'),
  66. $i18n.t('Embark on adventures')
  67. ]}
  68. />
  69. <div class="mt-0.5">{$i18n.t(`wherever you are`)}</div>
  70. </div>
  71. <div class="flex justify-center mt-8">
  72. <div class="flex flex-col justify-center items-center">
  73. <button
  74. aria-labelledby="get-started"
  75. class="relative z-20 flex p-1 rounded-full bg-white/5 hover:bg-white/10 transition font-medium text-sm"
  76. on:click={() => {
  77. getStartedHandler();
  78. }}
  79. >
  80. <ArrowRightCircle className="size-6" />
  81. </button>
  82. <div id="get-started" class="mt-1.5 font-primary text-base font-medium">
  83. {$i18n.t(`Get started`)}
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. {/if}