package pages import ( "git.hafen.run/lukas/timeshare/components/badge" "git.hafen.run/lukas/timeshare/components/button" "git.hafen.run/lukas/timeshare/components/checkbox" "git.hafen.run/lukas/timeshare/components/icon" "git.hafen.run/lukas/timeshare/components/table" "path" "time" ) type File struct { Filename string Key string } templ filetypeIcon(filename string) { switch path.Ext(filename) { case ".jpg",".jpeg", ".png",".heic", ".webp", ".avif", ".gif", ".tiff": @icon.FileImage() case ".mp3",".flac", ".m4a",".m4b", ".wav", ".midi": @icon.FileAudio() case ".mov",".mp4": @icon.FileVideo() case ".txt",".md": @icon.FileText() case ".zip": @icon.FileArchive() case ".xlsx", ".csv": @icon.FileSpreadsheet() case ".pdf", ".docx", ".doc": @icon.FileText() case ".epub": @icon.BookMarked() case ".stl", ".3mf", ".step": @icon.FileAxis3d() case ".json": @icon.FileJson() default: @icon.File() } } templ ListShareContents(expires time.Time, shareid string, files []File) { @PageSkeleton("Download - Time Share") {

Download from Share

@badge.Badge(badge.Props{ Class: "flex gap-2 items-center dark:text-white", }) { @icon.Timer() { expires.Format("03:04PM Jan 2") } }
@button.Button(button.Props{ID: "download-button"}) { @icon.FolderDown() Download All }
@table.Table() { @table.Header() { @table.Row() { @table.Head() @table.Head() { Filename } } } @table.Body() { for _, file := range files { @table.Row() { @table.Cell(table.CellProps{Class: "w-2"}) { @checkbox.Checkbox(checkbox.Props{ Name: file.Key, Value: file.Key, }) } @table.Cell() { @filetypeIcon(file.Filename) { file.Filename } } } } } }
} }