feat: unassign rooms from other participants when unavailable
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user