Files
aperonight/app/javascript/controllers/flash_message_controller.js
kbe 784d5158b4 fix: flash message icons not displaying properly
- Add specific case for 'info' flash message type in flash_icon helper
- Initialize Lucide icons when flash message controller connects
- Ensures icons render correctly with Turbo navigation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-28 16:25:22 +02:00

33 lines
710 B
JavaScript
Executable File

import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["message"]
connect() {
console.log("FlashMessageController mounted", this.element);
// Initialize Lucide icons for this element
if (typeof lucide !== 'undefined') {
lucide.createIcons({ within: this.element });
}
// Auto-dismiss after 2 seconds
this.timeout = setTimeout(() => {
this.close()
}, 2000)
}
disconnect() {
if (this.timeout) {
clearTimeout(this.timeout)
}
}
close() {
this.element.classList.add('opacity-0', 'transition-opacity', 'duration-300')
setTimeout(() => {
this.element.remove()
}, 300)
}
}