| 1 | "use client"; |
| 2 | |
| 3 | import { QueryClientProvider } from |
| 4 | import { ThemeProvider } |
| 5 | import Link from "next/link |
| 6 | import { useRouter } |
| 7 | import type { ReactNode |
| 8 | |
| 9 | import { AuthProvider } |
| 10 | import { ThemeEffects } |
| 11 | import { authClient } |
| 12 | import { avatar } |
| 13 | import { usernamePlugin } |
| 14 | import { apiKeyPlugin } |
| 15 | |
| 16 | import { getQueryClient } |
| 17 | import { APP_THEME_IDS } |
| 18 | |
| 19 | export function Providers({ |
| 20 | const router = |
| 21 | const queryClient = |
| 22 | |
| 23 | return ( |
| 24 | <ThemeProvider |
| 25 | attribute="class" |
| 26 | defaultTheme="system" |
| 27 | enableSystem |
| 28 | disableTransitionOnChange |
| 29 | themes={APP_THEME_IDS} |
| 30 | > |
| 31 | <ThemeEffects /> |
| 32 | <QueryClientProvider client={ |
| 33 | <AuthProvider |
| 34 | authClient={authClient} |
| 35 | avatar={avatar} |
| 36 | redirectTo="/dashboard" |
| 37 | plugins={[usernamePlugin() |
| 38 | navigate={({ to |
| 39 | replace ? router. |
| 40 | } |
| 41 | Link={Link} |
| 42 | > |
| 43 | {children} |
| 44 | </AuthProvider> |
| 45 | </QueryClientProvider> |
| 46 | </ThemeProvider> |
| 47 | ); |
| 48 | } |