// 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) {
name
size
last commit
author
date
@TreeRows(p)
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 != "" {
}
}
// 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) {