From 9a2c7c5db630d97f1a9d58cd22305855ce2818dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rnyi=20M=C3=A1rk?= Date: Tue, 31 Mar 2026 23:56:19 +0200 Subject: [PATCH] fix: address PR review feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Suppress note context menu when canEditDays is false instead of showing empty menu - Untie poll voting from collab_edit — voting is participation, not editing; any trip member can vote - Restore NoteFormModal props (note, tripId) to required; remove leftover canUploadFiles prop in favor of direct zustand hook --- client/src/components/Collab/CollabNotes.tsx | 15 ++++++++------- client/src/components/Collab/CollabPolls.tsx | 8 ++++---- client/src/components/Planner/DayPlanSidebar.tsx | 10 +++++----- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/client/src/components/Collab/CollabNotes.tsx b/client/src/components/Collab/CollabNotes.tsx index bee4e0d..1486b55 100644 --- a/client/src/components/Collab/CollabNotes.tsx +++ b/client/src/components/Collab/CollabNotes.tsx @@ -222,13 +222,15 @@ interface NoteFormModalProps { existingCategories: string[] categoryColors: Record getCategoryColor: (category: string) => string - note?: CollabNote | null - tripId?: number + note: CollabNote | null + tripId: number t: (key: string) => string - canUploadFiles?: boolean } -function NoteFormModal({ onClose, onSubmit, onDeleteFile, existingCategories, categoryColors, getCategoryColor, note, tripId, t, canUploadFiles = true }: NoteFormModalProps) { +function NoteFormModal({ onClose, onSubmit, onDeleteFile, existingCategories, categoryColors, getCategoryColor, note, tripId, t }: NoteFormModalProps) { + const can = useCanDo() + const tripObj = useTripStore((s) => s.trip) + const canUploadFiles = can('file_upload', tripObj) const isEdit = !!note const allCategories = [...new Set([...existingCategories, ...Object.keys(categoryColors || {})])].filter(Boolean) @@ -887,7 +889,6 @@ export default function CollabNotes({ tripId, currentUser }: CollabNotesProps) { const can = useCanDo() const trip = useTripStore((s) => s.trip) const canEdit = can('collab_edit', trip) - const canUploadFiles = can('file_upload', trip) const [notes, setNotes] = useState([]) const [loading, setLoading] = useState(true) const [showNewModal, setShowNewModal] = useState(false) @@ -1337,12 +1338,13 @@ export default function CollabNotes({ tripId, currentUser }: CollabNotesProps) { {showNewModal && ( setShowNewModal(false)} onSubmit={handleCreateNote} existingCategories={categories} categoryColors={categoryColors} getCategoryColor={getCategoryColor} - canUploadFiles={canUploadFiles} t={t} /> )} @@ -1358,7 +1360,6 @@ export default function CollabNotes({ tripId, currentUser }: CollabNotesProps) { existingCategories={categories} categoryColors={categoryColors} getCategoryColor={getCategoryColor} - canUploadFiles={canUploadFiles} t={t} /> )} diff --git a/client/src/components/Collab/CollabPolls.tsx b/client/src/components/Collab/CollabPolls.tsx index dc71ff9..1a63ea1 100644 --- a/client/src/components/Collab/CollabPolls.tsx +++ b/client/src/components/Collab/CollabPolls.tsx @@ -270,15 +270,15 @@ function PollCard({ poll, currentUser, canEdit, onVote, onClose, onDelete, t }: const isWinner = isClosed && count === Math.max(...(poll.options || []).map(o => o.voters?.length || 0)) && count > 0 return ( -