package templates // Breadcrumb is one segment of the current directory path shown above the // file listing, e.g. "docs" linking to "/web/files/docs/". type Breadcrumb struct { Name string Path string // relative path (no leading slash) used to build the link } // FileEntry is a single row (directory or file) in the file browser. type FileEntry struct { Name string IsDir bool Size string // human-readable, empty for directories ModTime string RelPath string // relative path (no leading slash) used to build the link } templ FilesPage(username string, breadcrumbs []Breadcrumb, entries []FileEntry, currentPath string, sortBy string, sortDir string) { @Layout("Files", username) {

Files

for _, e := range entries { } if len(entries) == 0 { }

} } templ fileEntryLink(e FileEntry) { if e.IsDir { { e.Name } } else { { e.Name } } } // fileActions renders the per-entry action buttons: a Download link // (forces a save-as via ?download=1, since the name link above now opens // files inline so the browser can play/preview natively-supported types // like video, audio, images, or PDFs) plus the Delete button. Folders have // no download link since they aren't served as a single file. templ fileActions(e FileEntry) { if !e.IsDir { Download } @fileDeleteButton(e) } templ fileDeleteButton(e FileEntry) { }