diff --git a/src/context/theme.context.tsx b/src/context/theme.context.tsx index fc331abe..e790d923 100644 --- a/src/context/theme.context.tsx +++ b/src/context/theme.context.tsx @@ -15,6 +15,7 @@ export enum Theme { Light = 'light', Dark = 'dark', Glass = 'glass', + LightGlass = 'lightglass', Icy = 'icy', Zarna = 'zarna', esteghlal = 'esteghlal', diff --git a/src/layouts/setting/tabs/appearance/components/theme-selector.tsx b/src/layouts/setting/tabs/appearance/components/theme-selector.tsx index 48ed6f3a..8a8d47c3 100644 --- a/src/layouts/setting/tabs/appearance/components/theme-selector.tsx +++ b/src/layouts/setting/tabs/appearance/components/theme-selector.tsx @@ -60,52 +60,51 @@ interface Props { export function ThemeSelector({ fetched_themes }: Props) { const { setTheme, theme } = useTheme() - const [themes, setThemes] = useState(defaultThemes) - const [selected, setSelected] = useState(null) - - function onClick(item: ThemeItem) { - setTheme(item.id) - setSelected(item) - Analytics.event('theme_selected') - } - - useEffect(() => { - const currentTheme = themes.find((t) => t.id === theme) - if (currentTheme) { - setSelected(currentTheme) - } - }, [themes]) - - useEffect(() => { - if (fetched_themes.length) { - const mapped: ThemeItem[] = fetched_themes.map((item) => ({ - id: item.value, - name: item.name ?? 'بدون نام', - icon: , - description: item?.description || 'تم خریداری شده', - })) - setThemes([...defaultThemes, ...mapped]) - } - }, [fetched_themes]) - - const handleMoreClick = () => { - Analytics.event('theme_market_opened') - callEvent('openMarketModal') - } - - const renderThemePreview = (item: ThemeItem) => ( - -
- - {item.icon} - - {item.description} -
-
- ) + const themes = [ + { + id: 'glass', + name: 'شیشه‌ای تیره', + icon: , + buttonClass: 'backdrop-blur-md text-white bg-black/40', + activeClass: 'ring-2 ring-blue-500', + }, + { + id: 'lightglass', + name: 'شیشه‌ای روشن', + icon: , + buttonClass: 'backdrop-blur-md text-gray-800 bg-white/55', + activeClass: 'ring-2 ring-blue-500', + }, + { + id: 'icy', + name: 'یخی (آزمایشی)', + icon: , + buttonClass: + 'backdrop-blur-md text-gray-800 bg-white/50 border border-white/20', + activeClass: 'ring-2 ring-blue-500', + }, + { + id: 'light', + name: 'روشن', + icon: , + buttonClass: 'bg-gray-100 text-gray-800 border border-gray-200', + activeClass: 'ring-2 ring-blue-500', + }, + { + id: 'dark', + name: 'تیره', + icon: , + buttonClass: 'text-white', + activeClass: 'ring-2 ring-blue-500', + }, + { + id: 'zarna', + name: 'زرنا', + icon: , + buttonClass: 'text-content', + activeClass: 'ring-2 ring-blue-500', + }, + ] return ( @@ -118,10 +117,23 @@ export function ThemeSelector({ fetched_themes }: Props) { isActive={selected?.id === item.id} onClick={() => onClick(item)} key={item.id} - className="w-full !h-20 !max-h-20 !min-h-20" - label={item.name} - description={renderThemePreview(item)} - /> + onClick={() => setTheme(item.id)} + className={` + relative flex flex-col p-2 rounded-lg transition-all cursor-pointer duration-300 shadow-md hover:shadow-lg bg-base-100 justify-center + ${item.buttonClass} + ${theme === item.id ? item.activeClass : 'hover:ring-2 hover:ring-blue-300'} + `} + > +
+ + {item.icon} + + {item.name} + {theme === item.id && ( +
+ )} +
+
))}