From 48551ec762be8154fa4ffc8238bc049f898a549c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Tue, 6 Jun 2023 21:32:02 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AC=E3=83=9D=E3=82=B8=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=83=BC=E3=81=AF=E3=83=86=E3=83=BC=E3=83=96=E3=83=AB=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/repo.go | 8 ++++++++ public/css/global.css | 9 +++++++++ views/repo.html | 40 +++++++++++++++++++++++++--------------- 3 files changed, 42 insertions(+), 15 deletions(-) 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" }} -
  • - 📁 - {{.Path}} -
  • - {{ else }} -
  • - 🗒️ - {{.Path}} -
  • - {{ end }} {{ end }} -
-
+ + + {{ range $key, $value := .files}} + + {{ if eq .Type "dir" }} + + {{ else }} + + {{ end }} + + + + {{ end }} + +
+ 📁 + {{.Path}} + + 🗒️ + {{.Path}} + + {{.Commit}} + + {{.Date}} +
{{ end }} {{ if .readme}}