feat: implement flash messages system with auto-dismiss notifications
- Add flash message helper and styles for consistent notifications - Replace Devise error messages with flash-based notifications - Add dashboard page with event statistics - Configure SMTP settings for development and production - Update authentication controllers to use flash messages - Add JavaScript controller for auto-dismiss functionality
This commit is contained in:
27
app/javascript/controllers/flash_message_controller.js
Normal file
27
app/javascript/controllers/flash_message_controller.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["message"]
|
||||
|
||||
connect() {
|
||||
console.log("FlashMessageController mounted", this.element);
|
||||
|
||||
// Auto-dismiss after 5 seconds
|
||||
this.timeout = setTimeout(() => {
|
||||
this.close()
|
||||
}, 5000)
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
if (this.timeout) {
|
||||
clearTimeout(this.timeout)
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
this.element.classList.add('opacity-0', 'transition-opacity', 'duration-300')
|
||||
setTimeout(() => {
|
||||
this.element.remove()
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user