From 09652176f97f11bc06f4c9b57a448e14744eac12 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Sat, 24 May 2025 12:59:43 +0000
Subject: feat: Allow defaulting to reader mode when clicking on bookmarks.
 Fixes #662

---
 apps/web/app/dashboard/layout.tsx | 42 ++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 18 deletions(-)

(limited to 'apps/web/app/dashboard/layout.tsx')

diff --git a/apps/web/app/dashboard/layout.tsx b/apps/web/app/dashboard/layout.tsx
index 45b97653..c4a53e4b 100644
--- a/apps/web/app/dashboard/layout.tsx
+++ b/apps/web/app/dashboard/layout.tsx
@@ -4,6 +4,7 @@ import MobileSidebar from "@/components/shared/sidebar/MobileSidebar";
 import Sidebar from "@/components/shared/sidebar/Sidebar";
 import SidebarLayout from "@/components/shared/sidebar/SidebarLayout";
 import { Separator } from "@/components/ui/separator";
+import { UserSettingsContextProvider } from "@/lib/userSettings";
 import { api } from "@/server/api/client";
 import { getServerAuthSession } from "@/server/auth";
 import { TFunction } from "i18next";
@@ -30,7 +31,10 @@ export default async function Dashboard({
     redirect("/");
   }
 
-  const lists = await api.lists.list();
+  const [lists, userSettings] = await Promise.all([
+    api.lists.list(),
+    api.users.settings(),
+  ]);
 
   const items = (t: TFunction) =>
     [
@@ -75,22 +79,24 @@ export default async function Dashboard({
   ];
 
   return (
-    <SidebarLayout
-      sidebar={
-        <Sidebar
-          items={items}
-          extraSections={
-            <>
-              <Separator />
-              <AllLists initialData={lists} />
-            </>
-          }
-        />
-      }
-      mobileSidebar={<MobileSidebar items={mobileSidebar} />}
-      modal={modal}
-    >
-      {children}
-    </SidebarLayout>
+    <UserSettingsContextProvider userSettings={userSettings}>
+      <SidebarLayout
+        sidebar={
+          <Sidebar
+            items={items}
+            extraSections={
+              <>
+                <Separator />
+                <AllLists initialData={lists} />
+              </>
+            }
+          />
+        }
+        mobileSidebar={<MobileSidebar items={mobileSidebar} />}
+        modal={modal}
+      >
+        {children}
+      </SidebarLayout>
+    </UserSettingsContextProvider>
   );
 }
-- 
cgit v1.2.3-70-g09d2

