diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 6eda261..ea20d08 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -34,7 +34,9 @@
- + +

No files shared with you yet

+

Click a file to open it

{{ trashItems.length }} item(s) @@ -656,12 +658,38 @@ async function handleImageDrop(e) { async function loadShared() { try { - sharedFiles.value = await api('/api/files/shared', {}) + const data = await api('/api/files/shared', {}) + // Convert to FileTree-compatible format + sharedFiles.value = (data || []).filter(f => f.type !== 'outgoing').map(f => ({ + name: `${f.path} (${f.owner}, ${f.level})`, + path: f.path, + isDir: false, + owner_id: f.owner_id, + })) } catch (e) { sharedFiles.value = [] } } +async function openSharedFile(path) { + // Find the shared file entry to get owner_id + const entry = sharedFiles.value.find(f => f.path === path) + if (!entry || !entry.owner_id) { + openFile(path) + return + } + try { + const res = await api('/api/files/read', { path, owner_id: entry.owner_id }) + currentFile.value = path + content.value = res.content + fileMeta.value = `Shared by ${entry.name.split('(')[1]?.split(')')[0] || 'unknown'}` + isDirty.value = false + view.value = 'shared' + } catch (e) { + toast('Cannot open shared file', 'error') + } +} + async function loadTrash() { try { trashItems.value = await api('/api/files/trash', {}) @@ -1400,6 +1428,7 @@ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; b right: 0; top: 50px; width: 360px; + max-width: calc(100vw - 280px); max-height: calc(100vh - 60px); overflow-y: auto; background: var(--bg-primary);