// SPDX-License-Identifier: AGPL-3.0-or-later package web // Tree is a directory: the file finder, the entries with their last commit, the // notes on what is left out, and the README of the directory below. templ Tree(l Layout, p TreePage) { @Shell(l, nil) {
@TreeRows(p)
namesizelast commitauthordate
if len(p.Rows) == 0 {

this directory is empty.

} for _, n := range p.Notes {

{ n }

} if p.Readme != nil { @ReadmeCard(*p.Readme) }
} } // TreeRows is the rows of a directory alone: what files.js inserts under a // directory it opens in place. When the directory has more entries than are // listed, the last row links to its page. templ TreeRows(p TreePage) { for _, r := range p.Rows { @TreeRowView(r) } if p.More != "" { more entries: open the directory } } // TreeRowView is one entry of a directory. Glyph: ▸ directory (▾ once opened // in place), @ symbolic link, + submodule, · file. A directory link carries // data-expand, the URL of its rows. templ TreeRowView(r TreeRow) { { r.Glyph } if r.Href != "" { } else { { r.Name } } { r.Size } if r.CHref != "" { { r.Subject } } { r.Author } if r.WhenAt != "" { } }