Skip to content

Commit e68f8f9

Browse files
feat: add my storages functionality
1 parent 2a3c9dd commit e68f8f9

7 files changed

Lines changed: 1026 additions & 114 deletions

File tree

app/components/AuthWrapper.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,18 @@ export default function AuthWrapper({ children }: AuthWrapperProps) {
2222
async function checkAuth() {
2323
try {
2424
setError(null);
25-
await handleIncomingRedirect();
25+
const redirectInfo = await handleIncomingRedirect();
2626
const session = getDefaultSession();
27+
28+
// Log authentication response after redirect
29+
console.log("=== Authentication Response ===");
30+
console.log("Redirect Info:", redirectInfo);
31+
console.log("Session Info:", session.info);
32+
console.log("WebID:", session.info.webId);
33+
console.log("Is Logged In:", session.info.isLoggedIn);
34+
console.log("Session ID:", session.info.sessionId);
35+
console.log("===============================");
36+
2737
setIsAuthenticated(session.info.isLoggedIn);
2838
} catch (err) {
2939
console.error("Auth check failed:", err);
@@ -44,9 +54,18 @@ export default function AuthWrapper({ children }: AuthWrapperProps) {
4454
if (!isAuthenticated && !error) {
4555
const interval = setInterval(async () => {
4656
try {
47-
await handleIncomingRedirect();
57+
const redirectInfo = await handleIncomingRedirect();
4858
const session = getDefaultSession();
4959
if (session.info.isLoggedIn) {
60+
// Log authentication response after redirect (from polling)
61+
console.log("=== Authentication Response (from polling) ===");
62+
console.log("Redirect Info:", redirectInfo);
63+
console.log("Session Info:", session.info);
64+
console.log("WebID:", session.info.webId);
65+
console.log("Is Logged In:", session.info.isLoggedIn);
66+
console.log("Session ID:", session.info.sessionId);
67+
console.log("==============================================");
68+
5069
setIsAuthenticated(true);
5170
setError(null);
5271
}

app/components/Sidebar.tsx

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
"use client";
22

33
import Button from "./shared/Button";
4-
import { XMarkIcon, FolderIcon } from "@heroicons/react/24/outline";
5-
6-
interface Drive {
7-
id: string;
8-
name: string;
9-
url: string;
10-
}
4+
import { XMarkIcon } from "@heroicons/react/24/outline";
115

126
interface SidebarProps {
13-
drives: Drive[];
14-
selectedDriveId?: string;
15-
onDriveSelect: (driveId: string) => void;
167
isOpen?: boolean;
178
onClose?: () => void;
9+
activeTab?: string;
1810
}
1911

2012
export default function Sidebar({
21-
drives,
22-
selectedDriveId,
23-
onDriveSelect,
2413
isOpen = true,
2514
onClose,
15+
activeTab = "my-storages",
2616
}: SidebarProps) {
2717
// On desktop (lg+), sidebar is always visible, so isOpen doesn't matter
2818
// On mobile, use isOpen state
2919
const isMobileOpen = isOpen;
3020

21+
const navigationTabs = [
22+
{ id: "my-storages", label: "My Storages" },
23+
];
24+
3125
return (
3226
<>
3327
{/* Sidebar */}
@@ -36,11 +30,9 @@ export default function Sidebar({
3630
isMobileOpen ? "translate-x-0" : "-translate-x-full lg:translate-x-0"
3731
}`}
3832
>
39-
<nav className="p-2" aria-label="Drives navigation">
33+
<nav className="p-2" aria-label="Navigation">
4034
<div className="mb-2 flex items-center justify-between px-3 py-2 lg:block">
41-
<h2 className="text-xs font-medium uppercase tracking-wider text-gray-500">
42-
Drives
43-
</h2>
35+
4436
{onClose && (
4537
<Button
4638
variant="icon"
@@ -52,31 +44,27 @@ export default function Sidebar({
5244
</Button>
5345
)}
5446
</div>
47+
48+
{/* Navigation Tabs */}
5549
<ul className="space-y-1" role="list">
56-
{drives.map((drive) => (
57-
<li key={drive.id}>
58-
<button
59-
type="button"
60-
onClick={() => {
61-
onDriveSelect(drive.id);
62-
if (onClose) {
63-
onClose();
64-
}
65-
}}
66-
className={`cursor-pointer w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors ${
67-
selectedDriveId === drive.id
68-
? "bg-[#F3EDFF] text-black"
69-
: "text-gray-700 hover:bg-gray-100"
70-
}`}
71-
aria-current={selectedDriveId === drive.id ? "page" : undefined}
72-
>
73-
<div className="flex items-center gap-3">
74-
<FolderIcon className="h-5 w-5 flex-shrink-0 text-gray-600" />
75-
<span className="truncate">{drive.name}</span>
76-
</div>
77-
</button>
78-
</li>
79-
))}
50+
{navigationTabs.map((tab) => {
51+
const isActive = activeTab === tab.id;
52+
return (
53+
<li key={tab.id}>
54+
<button
55+
type="button"
56+
className={`cursor-pointer w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors ${
57+
isActive
58+
? "bg-[#F3EDFF] text-black"
59+
: "text-gray-700 hover:bg-gray-100"
60+
}`}
61+
aria-current={isActive ? "page" : undefined}
62+
>
63+
{tab.label}
64+
</button>
65+
</li>
66+
);
67+
})}
8068
</ul>
8169
</nav>
8270
</aside>

app/lib/hooks/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
* ```
1010
*/
1111

12-
// Export hooks here as they are created
13-
// Example: export { useCustomHook } from './useCustomHook';
12+
export { useSolidStorages } from "./useSolidStorages";
13+
export type { SolidStorage } from "./useSolidStorages";
1414

0 commit comments

Comments
 (0)