diff --git a/src/components/layout/AppShell/AppShell.tsx b/src/components/layout/AppShell/AppShell.tsx index bb8f401..7b4bf61 100644 --- a/src/components/layout/AppShell/AppShell.tsx +++ b/src/components/layout/AppShell/AppShell.tsx @@ -6,6 +6,8 @@ import { useTranslation } from 'react-i18next'; import { useAuthStore } from '@/store/auth'; import { useBackButton, useHaptic } from '@/platform'; import { useTelegramSDK } from '@/hooks/useTelegramSDK'; +import { useTheme } from '@/hooks/useTheme'; +import { themeColorsApi } from '@/api/themeColors'; import { referralApi } from '@/api/referral'; import { wheelApi } from '@/api/wheel'; import { contestsApi } from '@/api/contests'; @@ -142,6 +144,38 @@ const LogoutIcon = ({ className }: { className?: string }) => ( ); +const SunIcon = ({ className }: { className?: string }) => ( + + + +); + +const MoonIcon = ({ className }: { className?: string }) => ( + + + +); + const FALLBACK_NAME = import.meta.env.VITE_APP_NAME || 'Cabinet'; const FALLBACK_LOGO = import.meta.env.VITE_APP_LOGO || 'V'; @@ -164,6 +198,15 @@ export function AppShell({ children }: AppShellProps) { isMobile, } = useTelegramSDK(); const haptic = useHaptic(); + const { toggleTheme, isDark } = useTheme(); + + // Theme toggle visibility + const { data: enabledThemes } = useQuery({ + queryKey: ['enabled-themes'], + queryFn: themeColorsApi.getEnabledThemes, + staleTime: 1000 * 60 * 5, + }); + const canToggleTheme = enabledThemes?.dark && enabledThemes?.light; // Only apply fullscreen UI adjustments on mobile Telegram (iOS/Android) const isMobileFullscreen = isFullscreen && isMobile; @@ -460,6 +503,18 @@ export function AppShell({ children }: AppShellProps) { {/* Right side actions */}
+ {canToggleTheme && ( + + )}