22
33import React , { useState , useEffect , useCallback , useRef , useMemo , ReactNode } from 'react' ;
44import { useRouter , usePathname } from 'next/navigation' ;
5- import { Sun , Moon } from 'lucide-react' ;
5+ import { Sun , Moon , Waves } from 'lucide-react' ;
66import clsx from 'clsx' ;
77import { getDomains , getSetupFlowStatus , AUTH_ERROR_EVENT } from '../lib/api' ;
88import { getSetupFlowDecision , SETUP_STATUS_CHANGED_EVENT , type SetupFlowStatus } from '@/lib/bootSetup' ;
99import { LanguageProvider , useT } from '../lib/i18n' ;
1010import { ThemeProvider , useTheme } from '../lib/theme' ;
1111import TokenAuth from './TokenAuth' ;
1212import { ConfirmProvider , useConfirm } from './ConfirmDialog' ;
13- import { AppUIProvider , Button } from './ui' ;
14- import { AuroraBackground } from '@lobehub/ui/awesome' ;
13+ import { AppUIProvider , AuroraBackdrop , Button } from './ui' ;
1514import { AxiosError } from 'axios' ;
1615
1716const BOOT_SETUP_ACK_KEY = 'lore-boot-setup-confirmed' ;
@@ -68,7 +67,7 @@ export function NavDock(): React.JSX.Element {
6867 const pathname = usePathname ( ) || '' ;
6968 const router = useRouter ( ) ;
7069 const { t, lang, setLang } = useT ( ) ;
71- const { theme, toggleTheme } = useTheme ( ) ;
70+ const { auroraBackgroundEnabled , theme, toggleAuroraBackground , toggleTheme } = useTheme ( ) ;
7271 const navRef = useRef < HTMLElement > ( null ) ;
7372 const tabRefs = useRef < Map < string , HTMLButtonElement > > ( new Map ( ) ) ;
7473 const [ hoverHref , setHoverHref ] = useState < string | null > ( null ) ;
@@ -184,6 +183,20 @@ export function NavDock(): React.JSX.Element {
184183 ? < Moon size = { 14 } strokeWidth = { 2 } />
185184 : < Sun size = { 14 } strokeWidth = { 2 } /> }
186185 </ button >
186+ < button
187+ onClick = { toggleAuroraBackground }
188+ aria-pressed = { auroraBackgroundEnabled }
189+ aria-label = { auroraBackgroundEnabled ? t ( 'Disable Aurora Background' ) : t ( 'Enable Aurora Background' ) }
190+ title = { auroraBackgroundEnabled ? t ( 'Disable Aurora Background' ) : t ( 'Enable Aurora Background' ) }
191+ className = { clsx (
192+ 'press flex h-9 w-9 md:h-8 md:w-8 shrink-0 items-center justify-center rounded-full transition-colors' ,
193+ auroraBackgroundEnabled
194+ ? 'bg-sys-blue/15 text-sys-blue shadow-sm'
195+ : 'text-txt-secondary hover:bg-fill-quaternary hover:text-txt-primary' ,
196+ ) }
197+ >
198+ < Waves size = { 14 } strokeWidth = { 2.2 } />
199+ </ button >
187200 </ div >
188201
189202 < div className = "hidden sm:flex items-center rounded-full bg-fill-quaternary p-[3px]" >
@@ -209,11 +222,27 @@ interface AppShellInnerProps {
209222 children : ReactNode ;
210223}
211224
225+ interface AppShellFrameProps {
226+ auroraBackgroundEnabled : boolean ;
227+ children : ReactNode ;
228+ }
229+
230+ export function AppShellFrame ( { auroraBackgroundEnabled, children } : AppShellFrameProps ) : React . JSX . Element {
231+ return (
232+ < div className = "relative h-screen w-full max-w-full overflow-hidden bg-bg-system text-txt-primary" >
233+ { auroraBackgroundEnabled ? < AuroraBackdrop /> : null }
234+ < NavDock />
235+ < div className = { appContentClassName } > { children } </ div >
236+ </ div >
237+ ) ;
238+ }
239+
212240function AppShellInner ( { children } : AppShellInnerProps ) : React . JSX . Element {
213241 const router = useRouter ( ) ;
214242 const pathname = usePathname ( ) || '' ;
215243 const { confirm } = useConfirm ( ) ;
216244 const { t } = useT ( ) ;
245+ const { auroraBackgroundEnabled } = useTheme ( ) ;
217246 const [ isAuthenticated , setIsAuthenticated ] = useState ( false ) ;
218247 const [ isCheckingAuth , setIsCheckingAuth ] = useState ( true ) ;
219248 const [ backendError , setBackendError ] = useState ( false ) ;
@@ -425,15 +454,9 @@ function AppShellInner({ children }: AppShellInnerProps): React.JSX.Element {
425454 }
426455
427456 return (
428- < div className = "relative h-screen w-full max-w-full overflow-hidden bg-bg-system text-txt-primary" >
429- < AuroraBackground
430- className = "absolute inset-0 h-full w-full"
431- classNames = { { content : 'hidden' } }
432- styles = { { content : { display : 'none' } } }
433- />
434- < NavDock />
435- < div className = { appContentClassName } > { children } </ div >
436- </ div >
457+ < AppShellFrame auroraBackgroundEnabled = { auroraBackgroundEnabled } >
458+ { children }
459+ </ AppShellFrame >
437460 ) ;
438461}
439462
0 commit comments