package components
import (
"searchix/internal/nix"
)
func licenseName(l nix.License) string {
if l.FullName != "" {
return l.FullName
} else {
return l.Name
}
}
templ PackageDetail(pkg nix.Package) {
if pkg.Broken {
{ pkg.Attribute }
} else {
{ pkg.Attribute }
}
if pkg.LongDescription != "" {
@markdown(pkg.LongDescription)
} else {
{ pkg.Description }
}
if pkg.MainProgram != "" {
- Main Program
-
{ pkg.MainProgram }
}
if len(pkg.Homepages) > 0 {
- Homepage
-
for _, u := range pkg.Homepages {
-
{ u }
}
}
if pkg.Version != "" {
- Version
- { pkg.Version }
}
if len(pkg.Licenses) > 0 {
- License
-
for _, l := range pkg.Licenses {
-
if l.URL != "" {
{ licenseName(l) }
} else {
{ licenseName(l) }
}
if l.AppendixURL != "" {
Appendix
}
}
}
if len(pkg.Maintainers) > 0 {
- Maintainers
-
for _, m := range pkg.Maintainers {
-
if m.Github != "" {
{ m.Name }
} else {
{ m.Name }
}
}
}
if pkg.Definition != "" {
- Defined
-
Source
}
}
templ PackageDetailPage(tdata TemplateData, pkg nix.Package) {
@Page(tdata) {
@PackageDetail(pkg)
}
}