feat: unassign rooms from other participants when unavailable

This commit is contained in:
Björn Fromme
2025-10-21 17:02:26 +02:00
parent cc1d1e5746
commit ab91c138d5
8 changed files with 576 additions and 95 deletions
+10 -4
View File
@@ -11,16 +11,22 @@ export default class extends Controller {
this.showToast(this.textValue, this.classValue)
}
// Listen for HTMX notification events
document.addEventListener('showNotifications', this.handleNotifications.bind(this))
// Bind handler for proper cleanup
this.boundHandleNotifications = this.handleNotifications.bind(this)
// Listen for custom HTMX notification events on document.body
// Events from HX-Trigger response headers bubble up to document.body
document.body.addEventListener('showNotifications', this.boundHandleNotifications)
}
disconnect() {
document.removeEventListener('showNotifications', this.handleNotifications.bind(this))
document.body.removeEventListener('showNotifications', this.boundHandleNotifications)
}
handleNotifications(event) {
const notifications = event.detail?.notifications || []
// HTMX wraps the trigger value in an object with 'value' and 'elt' properties
// event.detail.value contains the actual array from the HX-Trigger header
const notifications = event.detail?.value || []
notifications.forEach(notification => {
const className = this.getClassForType(notification.type)