package views
import "fmt"
import "git.32bit.cafe/32bitcafe/guestbook/internal/models"
import "git.32bit.cafe/32bitcafe/guestbook/internal/forms"
import "time"
templ GuestbookDashboardCommentsView(title string, data CommonData, website models.Website, guestbook models.Guestbook, comments []models.GuestbookComment) {
	@base(title, data) {
		
			@wSidebar(website)
			
				
					
					
					if len(comments) == 0 {
						No comments yet!
					}
					for  _, c := range comments {
						@GuestbookDashboardCommentView(data, website, c)
					}
				
			 
		 
	}
}
templ GuestbookDashboardCommentView(data CommonData, w models.Website, c models.GuestbookComment) {
	{{ commentUrl := fmt.Sprintf("%s/dashboard/guestbook/comments/%s", wUrl(w), shortIdToSlug(c.ShortId)) }}
	{{ hxHeaders := fmt.Sprintf("{\"X-CSRF-Token\": \"%s\"}", data.CSRFToken) }}
	
}
templ commentForm(form forms.CommentCreateForm) {
	
}
templ GuestbookView(title string, data CommonData, website models.Website, guestbook models.Guestbook, comments []models.GuestbookComment, form forms.CommentCreateForm) {
	{{ postUrl := fmt.Sprintf("/websites/%s/guestbook/comments/create", shortIdToSlug(website.ShortId)) }}
	if data.IsHtmx {
		@commentForm(form)
	} else {
		
			
				{ title }
				
				
				
			
			
				
					
						{ website.Name } Guestbook
						{ data.Flash }
						
					
					
				
			
		
	}
}
templ settingRadio(selected bool, name, id, value string) {
	
}
templ EmbeddableGuestbookCommentForm(data CommonData, w models.Website, f forms.CommentCreateForm) {
	{{ postUrl := fmt.Sprintf("/websites/%s/guestbook/comments/create?headless=true", shortIdToSlug(w.ShortId)) }}
	
		
			
		
		
			{ data.Flash }
			
		
	
}
templ AllGuestbooksView(data CommonData, websites []models.Website) {
	@base("All Guestbooks", data) {
		
			
				This page exists only for testing the service.
			
			
				for _, w := range websites {
					- 
						{{ gbUrl := fmt.Sprintf("/websites/%s/guestbook", shortIdToSlug(w.ShortId)) }}
						{ w.Name }
					
 
				}
			
		 
	}
}
templ GuestbookCommentCreateRemoteErrorView(url, err string) {
	
		
			
		
		
			
				An error occurred while posting comment. { err }. Redirecting.
			
			
				Redirect
			
		
	
}
templ GuestbookCommentCreateRemoteSuccessView(url string) {
	
		
			
		
		
			
				Comment successfully posted. Redirecting.
			
			
				Redirect
			
		
	
}
Comments
if len(comments) == 0 {No comments yet!
} for i, c := range comments { {{ commentAuthorRole := fmt.Sprintf("comment-author-%d", i+1) }}if c.AuthorSite != "" { { c.AuthorName } } else { { c.AuthorName } }
{ c.CommentText }