{{define "repo"}}{{if .Error}}

{{.Query.Get "repo"}}

{{template "alert" .Error}}
{{else}}{{$repo := asMap .Event}}{{$view := repoView .Query}}{{if eq $view "home"}}
{{if .Readme}}{{.Readme}}{{else}}

{{str (index $repo "identifier")}}

This repository has no README at its default branch.

{{end}}
{{else if or (eq $view "tree") (eq $view "file")}}
{{str (index $repo "identifier")}}/{{range $index, $crumb := repoBreadcrumbs .Query}}{{if $index}}{{if $crumb.URL}}{{$crumb.Label}}{{else}}{{$crumb.Label}}{{end}}/{{end}}{{end}}
{{template "repoTree" .}}
{{if eq $view "file"}}
{{.Query.Get "path"}} raw
{{if index $repo "binary"}}

This is a binary file. Download it to view its contents.

{{else if index $repo "content"}}{{sourceHTML .Event}} {{else}}

This file is empty.

{{end}}{{else}}

select a file to preview

{{end}}
{{else if eq $view "history"}}
{{range index $repo "commits"}}{{$commit := asMap .}} {{else}} {{end}}
{{str (index $commit "author")}}{{str (index $commit "subject")}}{{shortID (index $commit "oid")}} {{short (index $commit "time")}}
No commits.

{{if .Query.Get "offset"}}first page {{end}}{{if hasNextOffset (index $repo "next_offset")}}next page{{end}}

{{else if eq $view "commit"}}

Commit {{shortID (index $repo "commit")}}

browse files at this commit | history

{{diffHTML .Event}} {{else if eq $view "activity"}}
{{with index $repo "events"}}
    {{range .}}
  1. {{template "nostrEvent" .}}
  2. {{end}}
{{else}}

No repository activity.

{{end}}
{{else if or (eq $view "issues") (eq $view "prs") (eq $view "issue") (eq $view "pr")}}{{template "collaboration" .}} {{end}}{{end}}{{end}} {{define "repoTree"}}{{$repo := asMap .Event}}{{$entries := index $repo "entries"}}{{if .Tree}}{{$entries = .Tree}}{{end}}

{{if .Query.Get "offset"}}first page {{end}}{{if hasNextOffset (index $repo "next_offset")}}more{{end}}

{{end}}