Add WS reconnect logic + connection indicator in calendar

- useHotelSocket: reconnect with exponential backoff (up to 30s), return connected state, log errors to console
- BookingCalendar: show green/gray dot + Online/Offline label in toolbar
- CalendarPage: pass wsConnected prop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 18:51:32 +03:00
parent 02c3b7452a
commit 352d22a101
3 changed files with 76 additions and 16 deletions

View File

@@ -49,7 +49,7 @@ export function CalendarPage() {
}
}, [])
const { send } = useHotelSocket({ slug, token: session?.token ?? null, onMessage: handleWsMessage })
const { send, connected } = useHotelSocket({ slug, token: session?.token ?? null, onMessage: handleWsMessage })
const handleCreate = async (data: Partial<Booking>) => {
try {
@@ -134,6 +134,7 @@ export function CalendarPage() {
locks={locks}
onDraftStart={handleDraftStart}
onDraftCancel={handleDraftCancel}
wsConnected={connected}
/>
</div>
</div>