- 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>
33 lines
710 B
JavaScript
Executable File
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)
|
|
}
|
|
}
|