From e68f8f9716ccb3a2435bb35a1316798d3a55ab3a Mon Sep 17 00:00:00 2001 From: Precious Oritsedere Date: Tue, 11 Nov 2025 18:02:27 +0000 Subject: [PATCH] feat: add my storages functionality --- app/components/AuthWrapper.tsx | 23 +- app/components/Sidebar.tsx | 70 ++--- app/lib/hooks/index.ts | 4 +- app/lib/hooks/useSolidStorages.ts | 454 ++++++++++++++++++++++++++++++ app/page.tsx | 164 ++++++----- package-lock.json | 422 ++++++++++++++++++++++++++- package.json | 3 + 7 files changed, 1026 insertions(+), 114 deletions(-) create mode 100644 app/lib/hooks/useSolidStorages.ts diff --git a/app/components/AuthWrapper.tsx b/app/components/AuthWrapper.tsx index 70856a1..75c5494 100644 --- a/app/components/AuthWrapper.tsx +++ b/app/components/AuthWrapper.tsx @@ -22,8 +22,18 @@ export default function AuthWrapper({ children }: AuthWrapperProps) { async function checkAuth() { try { setError(null); - await handleIncomingRedirect(); + const redirectInfo = await handleIncomingRedirect(); const session = getDefaultSession(); + + // Log authentication response after redirect + console.log("=== Authentication Response ==="); + console.log("Redirect Info:", redirectInfo); + console.log("Session Info:", session.info); + console.log("WebID:", session.info.webId); + console.log("Is Logged In:", session.info.isLoggedIn); + console.log("Session ID:", session.info.sessionId); + console.log("==============================="); + setIsAuthenticated(session.info.isLoggedIn); } catch (err) { console.error("Auth check failed:", err); @@ -44,9 +54,18 @@ export default function AuthWrapper({ children }: AuthWrapperProps) { if (!isAuthenticated && !error) { const interval = setInterval(async () => { try { - await handleIncomingRedirect(); + const redirectInfo = await handleIncomingRedirect(); const session = getDefaultSession(); if (session.info.isLoggedIn) { + // Log authentication response after redirect (from polling) + console.log("=== Authentication Response (from polling) ==="); + console.log("Redirect Info:", redirectInfo); + console.log("Session Info:", session.info); + console.log("WebID:", session.info.webId); + console.log("Is Logged In:", session.info.isLoggedIn); + console.log("Session ID:", session.info.sessionId); + console.log("=============================================="); + setIsAuthenticated(true); setError(null); } diff --git a/app/components/Sidebar.tsx b/app/components/Sidebar.tsx index 21db9bf..bb151c0 100644 --- a/app/components/Sidebar.tsx +++ b/app/components/Sidebar.tsx @@ -1,33 +1,27 @@ "use client"; import Button from "./shared/Button"; -import { XMarkIcon, FolderIcon } from "@heroicons/react/24/outline"; - -interface Drive { - id: string; - name: string; - url: string; -} +import { XMarkIcon } from "@heroicons/react/24/outline"; interface SidebarProps { - drives: Drive[]; - selectedDriveId?: string; - onDriveSelect: (driveId: string) => void; isOpen?: boolean; onClose?: () => void; + activeTab?: string; } export default function Sidebar({ - drives, - selectedDriveId, - onDriveSelect, isOpen = true, onClose, + activeTab = "my-storages", }: SidebarProps) { // On desktop (lg+), sidebar is always visible, so isOpen doesn't matter // On mobile, use isOpen state const isMobileOpen = isOpen; + const navigationTabs = [ + { id: "my-storages", label: "My Storages" }, + ]; + return ( <> {/* Sidebar */} @@ -36,11 +30,9 @@ export default function Sidebar({ isMobileOpen ? "translate-x-0" : "-translate-x-full lg:translate-x-0" }`} > -