Unverified Commit 013ea525 authored by Om vataliya's avatar Om vataliya Committed by GitHub

fix: apply theme and locale changes immediately on login screen (#5440) (#5442)

parent 7c3fcc29
...@@ -2,7 +2,7 @@ import { GlobeIcon } from "lucide-react"; ...@@ -2,7 +2,7 @@ import { GlobeIcon } from "lucide-react";
import { FC } from "react"; import { FC } from "react";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { locales } from "@/i18n"; import { locales } from "@/i18n";
import { getLocaleDisplayName } from "@/utils/i18n"; import { getLocaleDisplayName, loadLocale } from "@/utils/i18n";
interface Props { interface Props {
value: Locale; value: Locale;
...@@ -13,6 +13,9 @@ const LocaleSelect: FC<Props> = (props: Props) => { ...@@ -13,6 +13,9 @@ const LocaleSelect: FC<Props> = (props: Props) => {
const { onChange, value } = props; const { onChange, value } = props;
const handleSelectChange = async (locale: Locale) => { const handleSelectChange = async (locale: Locale) => {
// Apply locale globally immediately
loadLocale(locale);
// Also notify parent component
onChange(locale); onChange(locale);
}; };
......
import { Monitor, Moon, MoonStar, Palette, Sun, Wallpaper } from "lucide-react"; import { Monitor, Moon, MoonStar, Palette, Sun, Wallpaper } from "lucide-react";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { THEME_OPTIONS } from "@/utils/theme"; import { loadTheme, THEME_OPTIONS } from "@/utils/theme";
interface ThemeSelectProps { interface ThemeSelectProps {
value?: string; value?: string;
...@@ -21,6 +21,9 @@ const ThemeSelect = ({ value, onValueChange, className }: ThemeSelectProps = {}) ...@@ -21,6 +21,9 @@ const ThemeSelect = ({ value, onValueChange, className }: ThemeSelectProps = {})
const currentTheme = value || "system"; const currentTheme = value || "system";
const handleThemeChange = (newTheme: string) => { const handleThemeChange = (newTheme: string) => {
// Apply theme globally immediately
loadTheme(newTheme);
// Also notify parent component if callback is provided
if (onValueChange) { if (onValueChange) {
onValueChange(newTheme); onValueChange(newTheme);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment