diff --git a/pages/repo.go b/pages/repo.go index 205aaec..4bc26b1 100644 --- a/pages/repo.go +++ b/pages/repo.go @@ -38,6 +38,8 @@ type Repo struct { type RepoFiles struct { Name string Path string + Commit string + Date string Type string Username string Reponame string @@ -120,9 +122,15 @@ func HandleRepo(c *fiber.Ctx) error { } else { FileType = "file" } + tstring := strings.ReplaceAll(el.ChildAttr("relative-time", "datetime"), "T", "、") + tstring = strings.Split(tstring, "+")[0] + tstrings := strings.Split(tstring, "-") + tstring = tstrings[0] + "-" + tstrings[1] + "-" + tstrings[2] repoFilesArray = append(repoFilesArray, RepoFiles{ Name: el.ChildText("div.flex-auto span.d-block a.js-navigation-open"), Path: el.ChildText("div.flex-auto span.d-block a.js-navigation-open"), + Commit: el.ChildText("div.flex-auto span.d-block a.Link--secondary"), + Date: tstring, Type: FileType, Username: Scrape.Username, Reponame: Scrape.Reponame, diff --git a/public/css/global.css b/public/css/global.css index 360c94c..15290e3 100644 --- a/public/css/global.css +++ b/public/css/global.css @@ -5,6 +5,7 @@ --background-darker: #2f1b2e; --accent: #00b7c3; --yellow: #8B8000; + --repo-hover: #b762b7; color-scheme: dark; } @@ -190,6 +191,10 @@ a:hover { margin-top: 0; } +.file-table { + width: 100%; +} + .social-links { display: flex; flex-direction: column; @@ -255,6 +260,10 @@ a:hover { list-style-type: none; } +.file-u-list:hover { + background-color: var(--repo-hover); +} + /* URI: /file/:user/:repo/:file */ .user-readme pre { padding: 8px; diff --git a/views/repo.html b/views/repo.html index ad4b416..66185b7 100644 --- a/views/repo.html +++ b/views/repo.html @@ -42,21 +42,31 @@ {{end}} {{ if .files}}

Files

-
- -
+ + + {{ range $key, $value := .files}} + + {{ if eq .Type "dir" }} + + {{ else }} + + {{ end }} + + + + {{ end }} + +
+ 📁 + {{.Path}} + + 🗒️ + {{.Path}} + + {{.Commit}} + + {{.Date}} +
{{ end }} {{ if .readme}}