fix: 8 improvements — calendar overlaps, legend, nav, tech tasks photos/sort/modal, hk history active maintenance

This commit is contained in:
2026-03-24 19:32:46 +03:00
parent 8b55bc58f1
commit 9a2e45b4c4
5 changed files with 162 additions and 73 deletions

View File

@@ -367,11 +367,11 @@ export function BookingCalendar({ rooms, bookings, slug, onBookingCreate, onBook
<div className="flex-1" />
{/* Legend */}
<div className="hidden lg:flex items-center gap-3 text-xs text-slate-500">
<div className="hidden md:flex items-center gap-2 text-xs text-slate-500">
{(['confirmed', 'checked_in', 'checked_out', 'inquiry'] as const).map(s => (
<div key={s} className="flex items-center gap-1.5">
<div className={cn('w-3 h-3 rounded-sm', BOOKING_STATUS_COLORS[s].split(' ')[0])} />
<span>{BOOKING_STATUS_LABELS[s]}</span>
<div key={s} className="flex items-center gap-1">
<div className={cn('w-2.5 h-2.5 rounded-sm shrink-0', BOOKING_STATUS_COLORS[s].split(' ')[0])} />
<span className="hidden lg:inline">{BOOKING_STATUS_LABELS[s]}</span>
</div>
))}
</div>
@@ -386,7 +386,7 @@ export function BookingCalendar({ rooms, bookings, slug, onBookingCreate, onBook
'w-1.5 h-1.5 rounded-full',
wsConnected ? 'bg-emerald-500' : 'bg-slate-300 dark:bg-slate-600 animate-pulse',
)} />
<span className="hidden sm:inline">{wsConnected ? 'Онлайн' : 'Офлайн'}</span>
<span className="hidden sm:inline">{wsConnected ? 'Синхронизация' : 'Офлайн'}</span>
</div>
)}
@@ -489,7 +489,15 @@ export function BookingCalendar({ rooms, bookings, slug, onBookingCreate, onBook
)
}
// Room row
const roomBookings = bookings.filter(b => b.roomId === room.id && b.status !== 'cancelled')
const allRoomBookings = bookings.filter(b => b.roomId === room.id && b.status !== 'cancelled')
// Hide checked_out bookings that overlap with a newer active booking
const activeRoomBookings = allRoomBookings.filter(b => b.status !== 'checked_out')
const roomBookings = allRoomBookings.filter(b => {
if (b.status !== 'checked_out') return true
return !activeRoomBookings.some(other =>
other.id !== b.id && b.checkIn < other.checkOut && b.checkOut > other.checkIn,
)
})
const draftStyle = getDraftStyle(room.id)
rows.push(
<div