package progress
import "time"
import "fmt"
type ImageDownloadStartNotificationData struct {
ID string
Subreddit string
PostURL string
PostName string
PostTitle string
AutoRemoveDuration time.Duration
}
templ ImageDownloadStartNotification(data ImageDownloadStartNotificationData) {
0 {
x-data={ fmt.Sprintf("{ init() { setTimeout(() => $el.remove(), %d) }}", data.AutoRemoveDuration.Milliseconds()) }
}
onclick="this.remove()"
class="alert alert-info hover:bg-success-content transition-all"
>
{ data.Subreddit }:
Start Downloading
{ truncateTitle(data.PostTitle) }
}
func truncateTitle(s string) string {
if len(s) > 20 {
return s[:20] + "..."
}
return s
}
type ImageDownloadEndNotificationData struct {
ID string
Subreddit string
PostURL string
PostName string
PostTitle string
AutoRemoveDuration time.Duration
}
templ ImageDownloadEndNotification(data ImageDownloadEndNotificationData) {
0 {
x-data={ fmt.Sprintf("{ init() { setTimeout(() => $el.remove(), %d) }}", data.AutoRemoveDuration.Milliseconds()) }
}
onclick="this.remove()"
class="alert alert-info hover:bg-success-content transition-all"
>
{ data.Subreddit }:
Finished Downloading
{ truncateTitle(data.PostTitle) }
}