package views
import "fmt"
import "git.32bit.cafe/32bitcafe/guestbook/internal/models"
import "git.32bit.cafe/32bitcafe/guestbook/internal/forms"
func wUrl(w models.Website) string {
	return fmt.Sprintf("/websites/%s", shortIdToSlug(w.ShortId))
}
templ wSidebar(website models.Website) {
	{{ dashUrl := wUrl(website) + "/dashboard" }}
	{{ gbUrl := wUrl(website) + "/guestbook" }}
	
}
templ displayWebsites(websites []models.Website) {
	if len(websites) == 0 {
		
No Websites yet. Register a website.
	} else {
		
	}
}
templ websiteCreateForm(csrfToken string, form forms.WebsiteCreateForm) {
	
	
		{{ err, exists := form.FieldErrors["sitename"] }}
		
		if exists {
			
		}
		
	
	
		{{ err, exists = form.FieldErrors["siteurl"] }}
		
		if exists {
			
		}
		
	
	
		{{ err, exists = form.FieldErrors["authorname"] }}
		
		if exists {
			
		}
		
	
	
		
	
}
templ WebsiteCreateButton() {
	
}
templ WebsiteList(title string, data CommonData, websites []models.Website) {
	@base(title, data) {
		My Websites
		
			@WebsiteCreateButton()
		
		
			@displayWebsites(websites)
		
	}
}
templ WebsiteDashboard(title string, data CommonData, website models.Website) {
	@base(title, data) {
		
			@wSidebar(website)
			
				{ website.Name }
				Embed your Guestbook
				Comment form
				
					Use this form to allow readers of your website to comment on your guestbook!
				
				
					//
					@embeddableForm(data.RootUrl, website)
				
				Embed your comments
				
					Upload this JavaScript WebComponent to your site and include it in your { `` } tag.
				
				
					//
					
						
							{ 
`
    
` }
						
					
					
						Then add the custom element where you want the comments to show up
					
					{{ getUrl := fmt.Sprintf("https://%s/websites/%s/guestbook/comments", data.RootUrl, shortIdToSlug(website.ShortId)) }}
					//
					
						
							{ fmt.Sprintf(``, getUrl) }
						
					
					@embedJavaScriptSnippet(data.RootUrl, website)
				
 
			 
		 
	}
}
templ WebsiteDashboardComingSoon(title string, data CommonData, website models.Website) {
	@base(title, data) {
		
			@wSidebar(website)
			
				{ website.Name }
				
					Coming Soon
				
			 
		 
	}
}
templ WebsiteCreate(title string, data CommonData, form forms.WebsiteCreateForm) {
	
}
templ embeddableForm(root string, website models.Website) {
	{{ postUrl := fmt.Sprintf("https://%s/websites/%s/guestbook/comments/create/remote", root, shortIdToSlug(website.ShortId)) }}
	{{formStr :=
	``
	}}
	
		
			{ fmt.Sprintf(formStr, postUrl) }
		
	
}
templ embedJavaScriptSnippet(root string, website models.Website) {
}