39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
package templates
|
|
|
|
import "fmt"
|
|
|
|
// Notification displays a temporary notification message
|
|
templ Notification(message string, notificationType string) {
|
|
<div id="notification"
|
|
class={ templ.Classes(
|
|
"notification",
|
|
templ.KV(notificationType, true),
|
|
)}
|
|
_="on load wait 4s then add .fade-out wait 1s then remove me">
|
|
<p>{ message }</p>
|
|
</div>
|
|
}
|
|
|
|
// Success notification
|
|
templ SuccessNotification(message string) {
|
|
@Notification(message, "success")
|
|
}
|
|
|
|
// Error notification
|
|
templ ErrorNotification(message string) {
|
|
@Notification(message, "error")
|
|
}
|
|
|
|
// RestoreSuccessResponse returns a response for successful restore operation
|
|
templ RestoreSuccessResponse(backupID string) {
|
|
<div hx-swap-oob="true:#notification-area">
|
|
@SuccessNotification("Backup restoration started successfully")
|
|
</div>
|
|
}
|
|
|
|
// RestoreErrorResponse returns a response for failed restore operation
|
|
templ RestoreErrorResponse(errorMessage string) {
|
|
<div hx-swap-oob="true:#notification-area">
|
|
@ErrorNotification(fmt.Sprintf("Backup restoration failed: %s", errorMessage))
|
|
</div>
|
|
} |