From 34b18a9f0881d96e215b878b23119c606f3d3fb1 Mon Sep 17 00:00:00 2001 From: curo1305 Date: Sun, 31 May 2026 15:07:04 +0200 Subject: [PATCH] =?UTF-8?q?feat(06.2-02):=20frontend=20=E2=80=94=20is=5Fsh?= =?UTF-8?q?ared=20badge=20fix=20+=20permission=20dropdown=20+=20View/Edit?= =?UTF-8?q?=20toggle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - DocumentCard.vue: fix Shared pill to read doc.is_shared (was doc.share_count > 0) - ShareModal.vue: add permission select between handle input and submit button - ShareModal.vue: replace static "view" span with View/Edit toggle group per share row - ShareModal.vue: add handlePermissionChange with optimistic update + rollback on error - documents.js: update shareDocument(docId, handle, permission='view') signature - documents.js: add updateSharePermission(shareId, permission) action - api/client.js: pass permission in createShare POST body - api/client.js: add updateSharePermission PATCH helper Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/api/client.js | 12 ++++- .../src/components/documents/DocumentCard.vue | 2 +- .../src/components/sharing/ShareModal.vue | 53 ++++++++++++++++++- frontend/src/stores/documents.js | 10 ++-- 4 files changed, 69 insertions(+), 8 deletions(-) diff --git a/frontend/src/api/client.js b/frontend/src/api/client.js index 80598e1..b71bae7 100644 --- a/frontend/src/api/client.js +++ b/frontend/src/api/client.js @@ -328,11 +328,19 @@ export function moveDocument(docId, folderId) { // ── Shares ──────────────────────────────────────────────────────────────────── -export function createShare(docId, recipientHandle) { +export function createShare(docId, recipientHandle, permission = 'view') { return request('/api/shares', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ document_id: docId, recipient_handle: recipientHandle }), + body: JSON.stringify({ document_id: docId, recipient_handle: recipientHandle, permission }), + }) +} + +export function updateSharePermission(shareId, permission) { + return request(`/api/shares/${shareId}`, { + method: 'PATCH', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ permission }), }) } diff --git a/frontend/src/components/documents/DocumentCard.vue b/frontend/src/components/documents/DocumentCard.vue index 9679789..08a9ba8 100644 --- a/frontend/src/components/documents/DocumentCard.vue +++ b/frontend/src/components/documents/DocumentCard.vue @@ -28,7 +28,7 @@ -
+
Shared
diff --git a/frontend/src/components/sharing/ShareModal.vue b/frontend/src/components/sharing/ShareModal.vue index 099404f..8a369bc 100644 --- a/frontend/src/components/sharing/ShareModal.vue +++ b/frontend/src/components/sharing/ShareModal.vue @@ -36,6 +36,14 @@ class="flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500" @keydown.enter="submitShare" /> + +