mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-21 22:31:46 +00:00
fix: address PR review feedback
- 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
This commit is contained in:
@@ -222,13 +222,15 @@ interface NoteFormModalProps {
|
||||
existingCategories: string[]
|
||||
categoryColors: Record<string, string>
|
||||
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 && (
|
||||
<NoteFormModal
|
||||
note={null}
|
||||
tripId={tripId}
|
||||
onClose={() => 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}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user