forked from whisperrnote/whisperrflow
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproviders.tsx
More file actions
59 lines (53 loc) · 1.8 KB
/
providers.tsx
File metadata and controls
59 lines (53 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use client';
import React, { useEffect } from 'react';
import { useLastActiveApp } from '@/lib/sdk/routing';
import { usePathname } from 'next/navigation';
import { ThemeProvider } from '@/theme/ThemeProvider';
import { TaskProvider } from '@/context/TaskContext';
import { AuthProvider } from '@/context/auth/AuthContext';
import { LayoutProvider } from '@/context/LayoutContext';
import { NotificationProvider } from '@/context/NotificationContext';
import { SudoProvider } from '@/context/SudoContext';
import { SubscriptionProvider } from '@/context/subscription/SubscriptionContext';
import { DataNexusProvider } from '@/context/DataNexusContext';
import { useEcosystemIntents } from '@/hooks/useEcosystemIntents';
import { useEcosystemNode } from '@/hooks/useEcosystemNode';
interface AppProvidersProps {
children: React.ReactNode;
}
function EcosystemHandler() {
useEcosystemIntents();
useEcosystemNode('flow');
const pathname = usePathname();
useEffect(() => {
const mood = pathname?.startsWith('/form/') ? 'serious' : 'ambient';
document.body.dataset.uiMood = mood;
return () => {
document.body.dataset.uiMood = 'ambient';
};
}, [pathname]);
return null;
}
export function AppProviders({ children }: AppProvidersProps) {
useLastActiveApp();
return (
<SubscriptionProvider>
<ThemeProvider>
<AuthProvider>
<DataNexusProvider>
<NotificationProvider>
<LayoutProvider>
<SudoProvider>
<TaskProvider>
<EcosystemHandler />
{children}
</TaskProvider>
</SudoProvider>
</LayoutProvider>
</NotificationProvider>
</DataNexusProvider>
</AuthProvider>
</ThemeProvider>
</SubscriptionProvider>
);
}