From 4f17ea61cbb11a72712a1ea8c98904a1cc513e41 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Sun, 14 Apr 2024 00:51:56 +0300
Subject: feature(web): Allow changing the bookmark grid layout (#98)

---
 apps/web/lib/providers.tsx | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

(limited to 'apps/web/lib/providers.tsx')

diff --git a/apps/web/lib/providers.tsx b/apps/web/lib/providers.tsx
index 60f30931..9c937281 100644
--- a/apps/web/lib/providers.tsx
+++ b/apps/web/lib/providers.tsx
@@ -1,9 +1,11 @@
 "use client";
 
+import type { UserLocalSettings } from "@/lib/userLocalSettings/types";
 import type { Session } from "next-auth";
 import React, { useState } from "react";
 import { ThemeProvider } from "@/components/theme-provider";
 import { TooltipProvider } from "@/components/ui/tooltip";
+import { UserLocalSettingsCtx } from "@/lib/userLocalSettings/bookmarksLayout";
 import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
 import { httpBatchLink, loggerLink } from "@trpc/client";
 import { SessionProvider } from "next-auth/react";
@@ -46,10 +48,12 @@ export default function Providers({
   children,
   session,
   clientConfig,
+  userLocalSettings,
 }: {
   children: React.ReactNode;
   session: Session | null;
   clientConfig: ClientConfig;
+  userLocalSettings: UserLocalSettings;
 }) {
   const queryClient = getQueryClient();
 
@@ -72,20 +76,22 @@ export default function Providers({
 
   return (
     <ClientConfigCtx.Provider value={clientConfig}>
-      <SessionProvider session={session}>
-        <api.Provider client={trpcClient} queryClient={queryClient}>
-          <QueryClientProvider client={queryClient}>
-            <ThemeProvider
-              attribute="class"
-              defaultTheme="system"
-              enableSystem
-              disableTransitionOnChange
-            >
-              <TooltipProvider delayDuration={0}>{children}</TooltipProvider>
-            </ThemeProvider>
-          </QueryClientProvider>
-        </api.Provider>
-      </SessionProvider>
+      <UserLocalSettingsCtx.Provider value={userLocalSettings}>
+        <SessionProvider session={session}>
+          <api.Provider client={trpcClient} queryClient={queryClient}>
+            <QueryClientProvider client={queryClient}>
+              <ThemeProvider
+                attribute="class"
+                defaultTheme="system"
+                enableSystem
+                disableTransitionOnChange
+              >
+                <TooltipProvider delayDuration={0}>{children}</TooltipProvider>
+              </ThemeProvider>
+            </QueryClientProvider>
+          </api.Provider>
+        </SessionProvider>
+      </UserLocalSettingsCtx.Provider>
     </ClientConfigCtx.Provider>
   );
 }
-- 
cgit v1.2.3-70-g09d2

