diff --git a/.claude/plans/reflective-meandering-castle.md b/.claude/plans/reflective-meandering-castle.md index 1b131ccf..9f10703c 100644 --- a/.claude/plans/reflective-meandering-castle.md +++ b/.claude/plans/reflective-meandering-castle.md @@ -40,7 +40,7 @@ After getting Claude Max OAuth working on the live server, hardening the deploy - **Change**: Ensure tab bar element has `data-mobile-tab-bar` attribute so `useMobileBackButton` composable works. CloudFolder.vue already uses this correctly. - **Verify**: CloudFolder on mobile — "Back to Cloud" button floats 8px above tab bar -### Task 7: Cloud homepage real data +### Task 7: Cloud homepage real data [DONE] - **Files**: `neode-ui/src/views/Home.vue`, `neode-ui/src/api/filebrowser-client.ts` - **Change**: Add `getUsage()` method to filebrowser-client. In Home.vue, replace hardcoded "2.4 GB" and "5" folders with real data from FileBrowser API. Add `formatBytes()` helper. Show loading state while fetching. - **Verify**: Home Cloud card shows real storage numbers from FileBrowser diff --git a/neode-ui/src/api/filebrowser-client.ts b/neode-ui/src/api/filebrowser-client.ts index 507bde75..850f8e72 100644 --- a/neode-ui/src/api/filebrowser-client.ts +++ b/neode-ui/src/api/filebrowser-client.ts @@ -104,6 +104,23 @@ class FileBrowserClient { if (!res.ok) throw new Error(`Delete failed: ${res.status}`) } + async getUsage(): Promise<{ totalSize: number; folderCount: number; fileCount: number }> { + if (!this.isAuthenticated) { + const ok = await this.login() + if (!ok) return { totalSize: 0, folderCount: 0, fileCount: 0 } + } + const res = await fetch(`${this.baseUrl}/api/resources/`, { + headers: this.headers(), + }) + if (!res.ok) return { totalSize: 0, folderCount: 0, fileCount: 0 } + const data: FileBrowserListResponse = await res.json() + const items = data.items || [] + const folderCount = items.filter(i => i.isDir).length + const fileCount = items.filter(i => !i.isDir).length + const totalSize = items.reduce((sum, i) => sum + (i.size || 0), 0) + return { totalSize, folderCount, fileCount } + } + async rename(oldPath: string, newName: string): Promise { const safePath = oldPath.startsWith('/') ? oldPath : `/${oldPath}` const dir = safePath.substring(0, safePath.lastIndexOf('/') + 1) diff --git a/neode-ui/src/views/Home.vue b/neode-ui/src/views/Home.vue index 3fca08db..bebdf8e5 100644 --- a/neode-ui/src/views/Home.vue +++ b/neode-ui/src/views/Home.vue @@ -91,11 +91,11 @@

Storage Used

-

2.4 GB

+

{{ cloudStorageDisplay }}

Folders

-

5

+

{{ cloudFolderDisplay }}

@@ -275,7 +275,7 @@