// SPDX-License-Identifier: AGPL-3.0-or-later
package web
// Home is the repository list.
templ Home(l Layout, p HomePage) {
@Shell(l, nil) {
filter>
if len(p.Rows) == 0 {
no repositories yet.
}
}
}
// Summary is the summary of a repository: the README reads in the main
// column at the reading measure; what one acts on sits in the rail.
templ Summary(l Layout, p SummaryPage) {
@Shell(l, summaryRail(p)) {
if p.Desc != "" {
{ p.Desc }
}
if p.Readme != nil {
{ p.Readme.Name }
@ReadmeView(*p.Readme)
}
}
}
templ summaryRail(p SummaryPage) {
clone @CloneBlock(p.Clone)
if len(p.Recent) > 0 {
recent commits all @CommitRows(p.Recent)
}
if len(p.Outline) > 0 && p.Readme != nil {
{ p.Readme.Name } @Outline(p.Outline)
}
}
// Refs lists the branches and tags of a repository.
templ Refs(l Layout, p RefsPage) {
@Shell(l, refsRail(p)) {
filter>
kind name commit subject date
@RefsBody(p)
if p.Note != "" {
{ p.Note }
}
}
}
templ refRow(kind string, r RefRow) {
{ kind }
{ r.Name }
if r.Default {
*
}
if r.CHref != "" {
{ r.Short }
} else {
{ r.Short }
}
{ r.Subject }
if r.WhenAt != "" {
{ r.When }
}
}
templ refsRail(p RefsPage) {
}
// State is a 404, 500 or empty-repository page inside the normal shell.
templ State(l Layout, p StatePage) {
@Shell(l, nil) {
{ p.Code } { p.Title }
for _, line := range p.Lines {
{ line }
}
if p.Clone != nil {
@CloneBlock(*p.Clone)
}
for _, b := range p.Back {
{ b.Label }
}
}
}