From 9cfad1d0d260126c4ebda815d1ae83580768fe4a Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 5 Dec 2026 01:36:10 +0100 Subject: [PATCH] fix(planner): show rating alongside stop participants --- .../src/components/Planner/PlaceInspector.tsx | 88 +++++++------------ 1 file changed, 33 insertions(+), 55 deletions(-) diff --git a/client/src/components/Planner/PlaceInspector.tsx b/client/src/components/Planner/PlaceInspector.tsx index f99068e0e..9e8ff2349 100644 --- a/client/src/components/Planner/PlaceInspector.tsx +++ b/client/src/components/Planner/PlaceInspector.tsx @@ -48,7 +48,7 @@ import LinkedBookingCard from './PlaceLinkedBookingCard' import { usePlaceLanguage } from '../../hooks/usePlaceLanguage' import { participantsWith, participantsWithout, splitParticipants, usePlaceFileUpload } from './usePlaceActions' -const DETAIL_GRID = 'grid min-w-0 flex-none grid-cols-[repeat(auto-fit,minmax(min(100%,208px),1fr))] items-start gap-3' +const DETAIL_GRID = 'grid min-w-0 flex-none grid-cols-[repeat(auto-fit,minmax(min(100%,208px),1fr))] gap-3' const detailsCache = new Map() function getSessionCache(key) { @@ -364,6 +364,10 @@ export default function PlaceInspector({ const phone = place.phone || googleDetails?.phone const description = place.description || googleDetails?.summary const showRating = (mode === 'trip' && !!onRate) || !!shortReview + const showParticipants = mode === 'trip' && !!selectedAssignmentId && tripMembers.length > 1 + const participantIds = assignmentInDay?.id === selectedAssignmentId + ? assignmentInDay?.participants?.map(participant => participant.user_id) ?? [] + : [] const mapCard = centredMapCard(leftWidth, rightWidth, { clearPill: clearMapPill }) return ( @@ -391,7 +395,7 @@ export default function PlaceInspector({ {/* The body scrolls inside the capped card; each block keeps its natural height (#1195). */}
- {(showRating || roadtripEndDay || roadtripStay) && ( + {(showRating || showParticipants) && (
{showRating && ( @@ -407,7 +411,15 @@ export default function PlaceInspector({
)} - {(roadtripEndDay || roadtripStay) && } + {showParticipants && ( + + )} +
+ )} + {(roadtripEndDay || roadtripStay) && ( +
+
)} {roadtripActive && place.stop_type === 'charging' && } @@ -419,7 +431,7 @@ export default function PlaceInspector({ )} {(place.notes || assignmentInDay?.notes) && ( -
+
{place.notes && ( {place.notes} @@ -433,11 +445,9 @@ export default function PlaceInspector({
)} - {/* Bookings + participants — trip-only (collections have no days) */} {mode === 'trip' && ( - )} @@ -570,64 +580,32 @@ function MarkdownBox({ children }: { children: string }) { ) } -interface PlaceBookingsAndPeopleProps { +interface PlaceBookingsProps { selectedAssignmentId: number | null placeId: number reservations: Reservation[] - assignments: AssignmentsMap - selectedDayId: number | null - tripMembers: TripMember[] timeFormat: string - onSetParticipants?: (assignmentId: number, dayId: number, participantIds: number[]) => void onEditTransport?: (reservation: Reservation) => void onEditReservation?: (reservation: Reservation) => void onOpenBooking?: (reservation: Reservation) => void } -/** The bookings pinned to this stop and who joins it, side by side from sm up. */ -function PlaceBookingsAndPeople({ selectedAssignmentId, placeId, reservations, assignments, selectedDayId, - tripMembers, timeFormat, onSetParticipants, onEditTransport, onEditReservation, onOpenBooking }: PlaceBookingsAndPeopleProps) { +/** The bookings pinned to this stop. */ +function PlaceBookings({ selectedAssignmentId, placeId, reservations, timeFormat, + onEditTransport, onEditReservation, onOpenBooking }: PlaceBookingsProps) { const { t } = useTranslation() const linked = getPlaceBookings(reservations, selectedAssignmentId, placeId) - const assignment = selectedAssignmentId ? (assignments[String(selectedDayId)] || []).find(a => a.id === selectedAssignmentId) : null - const currentParticipants = assignment?.participants || [] - const participantIds = currentParticipants.map(p => p.user_id) - const allJoined = currentParticipants.length === 0 - const showParticipants = !!selectedAssignmentId && tripMembers.length > 1 - if (linked.length === 0 && !showParticipants) return null + if (linked.length === 0) return null return ( -
- {/* Bookings pinned to this stop; several can share one (#2201) */} - {linked.length > 0 && ( - -
- {linked.map(res => { - // The strip summarised the booking but went nowhere, so its - // attachments and fields had no route from the map (#2012). - // A transport has its own form; picking by type is what the day - // sidebar does, and an absent handler means this user may not - // open this one, so the strip stays inert rather than lying. - // With a detail to show, the card is the booking itself and opens it; - // the editor is one Edit further, under the same rights as before. - if (onOpenBooking) return onOpenBooking(res)} opens="detail" /> - const editor = TRANSPORT_TYPES.has(res.type) ? onEditTransport : onEditReservation - return editor(res) : undefined} /> - })} -
-
- )} - - {showParticipants && ( - - )} -
+ +
+ {linked.map(res => { + if (onOpenBooking) return onOpenBooking(res)} opens="detail" /> + const editor = TRANSPORT_TYPES.has(res.type) ? onEditTransport : onEditReservation + return editor(res) : undefined} /> + })} +
+
) } @@ -890,7 +868,7 @@ function PlaceExtras({ openingHours, weekdayIndex, hoursExpanded, setHoursExpand const showFiles = placeFiles.length > 0 || !!onFileUpload const trackColor = resolveTrackColor(place) return ( -
+
{hasHours && (