diff --git a/frontend/src/hooks/useTheme.js b/frontend/src/hooks/useTheme.js index ba1d82e7..4a8d55de 100644 --- a/frontend/src/hooks/useTheme.js +++ b/frontend/src/hooks/useTheme.js @@ -7,10 +7,22 @@ const availableThemes = { dark: "Dark", }; +/** + * @typedef {'system' | 'light' | 'dark'} ThemeOption + */ + +/** + * @typedef {Object} UseThemeResult + * @property {ThemeOption} theme - The current theme preference stored in localStorage. + * @property {(newTheme: ThemeOption) => void} setTheme - Sets the theme preference. + * @property {{system: string, light: string, dark: string}} availableThemes - Map of theme keys to display names. + * @property {boolean} isLight - Whether the resolved theme is light (explicitly or via system preference). + */ + /** * Determines the current theme of the application. * "system" follows the OS preference, "light" and "dark" force that mode. - * @returns {{theme: ('system' | 'light' | 'dark'), setTheme: function, availableThemes: object}} + * @returns {UseThemeResult} */ export function useTheme() { const [theme, _setTheme] = useState(() => { @@ -59,11 +71,16 @@ export function useTheme() { /** * Sets the theme of the application and runs any * other necessary side effects - * @param {string} newTheme The new theme to set + * @param {ThemeOption} newTheme The new theme to set */ function setTheme(newTheme) { _setTheme(newTheme); } - return { theme, setTheme, availableThemes }; + return { + theme, + setTheme, + availableThemes, + isLight: resolvedTheme === "light", + }; } diff --git a/frontend/src/locales/ar/common.js b/frontend/src/locales/ar/common.js index 7c18109c..7661d562 100644 --- a/frontend/src/locales/ar/common.js +++ b/frontend/src/locales/ar/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "مرحبا في", getStarted: "بسم الله", + welcome: null, }, llm: { title: "إعدادات نموذج التعلم العميق المفضّلة", diff --git a/frontend/src/locales/cs/common.js b/frontend/src/locales/cs/common.js index f5566300..545327bd 100644 --- a/frontend/src/locales/cs/common.js +++ b/frontend/src/locales/cs/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Vítejte v", getStarted: "Začít", + welcome: null, }, llm: { title: "Preferovaný LLM", diff --git a/frontend/src/locales/da/common.js b/frontend/src/locales/da/common.js index f985f349..ae974aaf 100644 --- a/frontend/src/locales/da/common.js +++ b/frontend/src/locales/da/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Velkommen til", getStarted: "Kom godt i gang", + welcome: null, }, llm: { title: "LLM-præference", diff --git a/frontend/src/locales/de/common.js b/frontend/src/locales/de/common.js index 925955d2..fb4f5e4c 100644 --- a/frontend/src/locales/de/common.js +++ b/frontend/src/locales/de/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Willkommen bei", getStarted: "Jetzt starten", + welcome: null, }, llm: { title: "LLM-Einstellung", diff --git a/frontend/src/locales/en/common.js b/frontend/src/locales/en/common.js index 697127e5..cb87d425 100644 --- a/frontend/src/locales/en/common.js +++ b/frontend/src/locales/en/common.js @@ -2,6 +2,7 @@ const TRANSLATIONS = { onboarding: { home: { title: "Welcome to", + welcome: "Welcome", getStarted: "Get Started", }, llm: { diff --git a/frontend/src/locales/es/common.js b/frontend/src/locales/es/common.js index 778a618c..0b17abcb 100644 --- a/frontend/src/locales/es/common.js +++ b/frontend/src/locales/es/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Bienvenido a", getStarted: "Comenzar", + welcome: null, }, llm: { title: "Preferencia de LLM", diff --git a/frontend/src/locales/et/common.js b/frontend/src/locales/et/common.js index b7dd77fc..6fdc01ba 100644 --- a/frontend/src/locales/et/common.js +++ b/frontend/src/locales/et/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Tere tulemast", getStarted: "Alusta", + welcome: null, }, llm: { title: "LLM-i eelistus", diff --git a/frontend/src/locales/fa/common.js b/frontend/src/locales/fa/common.js index 90de49b6..e261abe7 100644 --- a/frontend/src/locales/fa/common.js +++ b/frontend/src/locales/fa/common.js @@ -19,6 +19,7 @@ const TRANSLATIONS = { home: { title: "به", getStarted: "شروع کنید", + welcome: null, }, llm: { title: "ترجیحات مدل‌های زبان بزرگ", diff --git a/frontend/src/locales/fr/common.js b/frontend/src/locales/fr/common.js index d00cb336..c82464de 100644 --- a/frontend/src/locales/fr/common.js +++ b/frontend/src/locales/fr/common.js @@ -18,6 +18,7 @@ const TRANSLATIONS = { home: { title: "Bienvenue", getStarted: "Commencer", + welcome: null, }, llm: { title: "Préférence LLM", diff --git a/frontend/src/locales/he/common.js b/frontend/src/locales/he/common.js index 29a48de5..dcf8d1f5 100644 --- a/frontend/src/locales/he/common.js +++ b/frontend/src/locales/he/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "ברוכים הבאים ל", getStarted: "להתחלה", + welcome: null, }, llm: { title: "העדפות מודל שפה (LLM)", diff --git a/frontend/src/locales/it/common.js b/frontend/src/locales/it/common.js index 1484161d..7baae496 100644 --- a/frontend/src/locales/it/common.js +++ b/frontend/src/locales/it/common.js @@ -19,6 +19,7 @@ const TRANSLATIONS = { home: { title: "Benvenuti a", getStarted: "Inizia", + welcome: null, }, llm: { title: "Preferenza per i modelli LLM", diff --git a/frontend/src/locales/ja/common.js b/frontend/src/locales/ja/common.js index ba7eb475..c34aeae4 100644 --- a/frontend/src/locales/ja/common.js +++ b/frontend/src/locales/ja/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "ようこそ", getStarted: "はじめる", + welcome: null, }, llm: { title: "LLMの設定", diff --git a/frontend/src/locales/ko/common.js b/frontend/src/locales/ko/common.js index d61f1b7e..34a126fd 100644 --- a/frontend/src/locales/ko/common.js +++ b/frontend/src/locales/ko/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "방문을 환영합니다", getStarted: "시작하기", + welcome: null, }, llm: { title: "LLM 기본 설정", diff --git a/frontend/src/locales/lt/common.js b/frontend/src/locales/lt/common.js index 14560999..eab62632 100644 --- a/frontend/src/locales/lt/common.js +++ b/frontend/src/locales/lt/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Sveiki atvykę į", getStarted: "Pradėti", + welcome: null, }, llm: { title: "LLM pasirinkimas", diff --git a/frontend/src/locales/lv/common.js b/frontend/src/locales/lv/common.js index fd994717..d3b6c48d 100644 --- a/frontend/src/locales/lv/common.js +++ b/frontend/src/locales/lv/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Laipni lūgti", getStarted: "Sākt darbu", + welcome: null, }, llm: { title: "LLM preferences", diff --git a/frontend/src/locales/nl/common.js b/frontend/src/locales/nl/common.js index ab35d730..e02df956 100644 --- a/frontend/src/locales/nl/common.js +++ b/frontend/src/locales/nl/common.js @@ -19,6 +19,7 @@ const TRANSLATIONS = { home: { title: "Welkom bij", getStarted: "Aan de slag", + welcome: null, }, llm: { title: "LLM-voorkeuren", diff --git a/frontend/src/locales/pl/common.js b/frontend/src/locales/pl/common.js index 1ce814bd..b49660f2 100644 --- a/frontend/src/locales/pl/common.js +++ b/frontend/src/locales/pl/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Witamy w", getStarted: "Rozpocznij", + welcome: null, }, llm: { title: "Preferencje modeli językowych", diff --git a/frontend/src/locales/pt_BR/common.js b/frontend/src/locales/pt_BR/common.js index 3ae5479e..e0ae3f9d 100644 --- a/frontend/src/locales/pt_BR/common.js +++ b/frontend/src/locales/pt_BR/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Bem-vindo ao", getStarted: "Começar", + welcome: null, }, llm: { title: "Preferência de LLM", diff --git a/frontend/src/locales/ro/common.js b/frontend/src/locales/ro/common.js index 5dead661..aead258c 100644 --- a/frontend/src/locales/ro/common.js +++ b/frontend/src/locales/ro/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Bine ai venit la", getStarted: "Începe", + welcome: null, }, llm: { title: "Preferința LLM", diff --git a/frontend/src/locales/ru/common.js b/frontend/src/locales/ru/common.js index 60ad124d..47e01a77 100644 --- a/frontend/src/locales/ru/common.js +++ b/frontend/src/locales/ru/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "Добро пожаловать в", getStarted: "Начать", + welcome: null, }, llm: { title: "Предпочитаемые LLM", diff --git a/frontend/src/locales/tr/common.js b/frontend/src/locales/tr/common.js index cf216f11..1452acb0 100644 --- a/frontend/src/locales/tr/common.js +++ b/frontend/src/locales/tr/common.js @@ -19,6 +19,7 @@ const TRANSLATIONS = { home: { title: "Hoş Geldiniz", getStarted: "Başla", + welcome: null, }, llm: { title: "LLM Tercihi", diff --git a/frontend/src/locales/vn/common.js b/frontend/src/locales/vn/common.js index b01664de..948e6718 100644 --- a/frontend/src/locales/vn/common.js +++ b/frontend/src/locales/vn/common.js @@ -19,6 +19,7 @@ const TRANSLATIONS = { home: { title: "Chào mừng đến", getStarted: "Bắt đầu", + welcome: null, }, llm: { title: "Tùy chọn LLM", diff --git a/frontend/src/locales/zh/common.js b/frontend/src/locales/zh/common.js index d77ed049..1ad0d412 100644 --- a/frontend/src/locales/zh/common.js +++ b/frontend/src/locales/zh/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "欢迎使用", getStarted: "开始", + welcome: null, }, llm: { title: "LLM 偏好", diff --git a/frontend/src/locales/zh_TW/common.js b/frontend/src/locales/zh_TW/common.js index 1575d976..6133f5cf 100644 --- a/frontend/src/locales/zh_TW/common.js +++ b/frontend/src/locales/zh_TW/common.js @@ -4,6 +4,7 @@ const TRANSLATIONS = { home: { title: "歡迎使用", getStarted: "開始使用", + welcome: null, }, llm: { title: "LLM 偏好", diff --git a/frontend/src/pages/OnboardingFlow/Steps/Home/components/OnboardingLogoSVG.jsx b/frontend/src/pages/OnboardingFlow/Steps/Home/components/OnboardingLogoSVG.jsx new file mode 100644 index 00000000..e8d68c26 --- /dev/null +++ b/frontend/src/pages/OnboardingFlow/Steps/Home/components/OnboardingLogoSVG.jsx @@ -0,0 +1,80 @@ +import { useTheme } from "@/hooks/useTheme"; + +export function OnboardingLogoSVG() { + const { isLight } = useTheme(); + return ( + + + + + + + + + + + + + + + + + {isLight ? ( + <> + + + + + ) : ( + <> + + + + + )} + + + + ); +} diff --git a/frontend/src/pages/OnboardingFlow/Steps/Home/index.jsx b/frontend/src/pages/OnboardingFlow/Steps/Home/index.jsx index f0bdae5c..fd804426 100644 --- a/frontend/src/pages/OnboardingFlow/Steps/Home/index.jsx +++ b/frontend/src/pages/OnboardingFlow/Steps/Home/index.jsx @@ -1,64 +1,56 @@ import paths from "@/utils/paths"; -import LGroupImg from "./l_group.png"; -import RGroupImg from "./r_group.png"; -import LGroupImgLight from "./l_group-light.png"; -import RGroupImgLight from "./r_group-light.png"; -import AnythingLLMLogo from "@/media/logo/anything-llm.png"; import { useNavigate } from "react-router-dom"; -import { useTheme } from "@/hooks/useTheme"; import { useTranslation } from "react-i18next"; import useRedirectToHomeOnOnboardingComplete from "@/hooks/useOnboardingComplete"; - -const IMG_SRCSET = { - light: { - l: LGroupImgLight, - r: RGroupImgLight, - }, - default: { - l: LGroupImg, - r: RGroupImg, - }, -}; +import { OnboardingLogoSVG } from "./components/OnboardingLogoSVG"; export default function OnboardingHome() { const navigate = useNavigate(); useRedirectToHomeOnOnboardingComplete(); - const { theme } = useTheme(); const { t } = useTranslation(); - const srcSet = IMG_SRCSET?.[theme] || IMG_SRCSET.default; return ( - <> -
-
+
+ {/* Dark mode background gradient */} +
+ {/* Light mode background gradient */} +
-
- -
-
-

- {t("onboarding.home.title")} -

- AnythingLLM - -
-
+
+

+ AnythingLLM +

- + +
+
+ +
+ +

+ {t("onboarding.home.welcome")} +

+ + +
+
); } diff --git a/frontend/src/pages/OnboardingFlow/Steps/Home/l_group-light.png b/frontend/src/pages/OnboardingFlow/Steps/Home/l_group-light.png deleted file mode 100644 index 646270d2..00000000 Binary files a/frontend/src/pages/OnboardingFlow/Steps/Home/l_group-light.png and /dev/null differ diff --git a/frontend/src/pages/OnboardingFlow/Steps/Home/l_group.png b/frontend/src/pages/OnboardingFlow/Steps/Home/l_group.png deleted file mode 100644 index 21fc89e3..00000000 Binary files a/frontend/src/pages/OnboardingFlow/Steps/Home/l_group.png and /dev/null differ diff --git a/frontend/src/pages/OnboardingFlow/Steps/Home/r_group-light.png b/frontend/src/pages/OnboardingFlow/Steps/Home/r_group-light.png deleted file mode 100644 index cb60436c..00000000 Binary files a/frontend/src/pages/OnboardingFlow/Steps/Home/r_group-light.png and /dev/null differ diff --git a/frontend/src/pages/OnboardingFlow/Steps/Home/r_group.png b/frontend/src/pages/OnboardingFlow/Steps/Home/r_group.png deleted file mode 100644 index 305e1793..00000000 Binary files a/frontend/src/pages/OnboardingFlow/Steps/Home/r_group.png and /dev/null differ