From 15d741ff66358f61af71b43b6d96be0bd1949561 Mon Sep 17 00:00:00 2001 From: lutinglt Date: Fri, 28 Nov 2025 11:51:42 +0800 Subject: [PATCH] optimize latest commit style --- gitea/{ => templates}/repo/view_content.tmpl | 0 gitea/{ => templates}/repo/view_list.tmpl | 0 styles/components/commit.ts | 6 +----- styles/templates/repo/view_list.ts | 3 ++- templates/repo/view_content.tmpl | 5 ----- templates/repo/view_list.tmpl | 19 ++++++++++++++++--- 6 files changed, 19 insertions(+), 14 deletions(-) rename gitea/{ => templates}/repo/view_content.tmpl (100%) rename gitea/{ => templates}/repo/view_list.tmpl (100%) diff --git a/gitea/repo/view_content.tmpl b/gitea/templates/repo/view_content.tmpl similarity index 100% rename from gitea/repo/view_content.tmpl rename to gitea/templates/repo/view_content.tmpl diff --git a/gitea/repo/view_list.tmpl b/gitea/templates/repo/view_list.tmpl similarity index 100% rename from gitea/repo/view_list.tmpl rename to gitea/templates/repo/view_list.tmpl diff --git a/styles/components/commit.ts b/styles/components/commit.ts index b4c53c8..c3c2b87 100644 --- a/styles/components/commit.ts +++ b/styles/components/commit.ts @@ -36,12 +36,8 @@ export const commit = css` } // 提交信息右侧 .tw-text-right { - // 时间标签 relative-time, - // 复制 SHA 按钮 - .btn.copy-commit-id, - // 查看提交路径按钮 - .btn.view-commit-path { + svg { color: ${themeVars.color.text.light.num1}; } } diff --git a/styles/templates/repo/view_list.ts b/styles/templates/repo/view_list.ts index 89a7685..d7ae465 100644 --- a/styles/templates/repo/view_list.ts +++ b/styles/templates/repo/view_list.ts @@ -1,11 +1,12 @@ import { css, otherThemeVars, themeVars } from "src/types/vars"; export const repoFileLastCommit = css` - // 仓库页的最后一次提交 + // 仓库页和文件列表文件夹页的最后一次提交 .repository.file.list #repo-files-table .github-theme-templates.repo-file-line.repo-file-last-commit { padding-right: 10px; // 提交时间 .github-latest-time { + color: ${themeVars.color.text.light.num1}; font-size: 12px; } // 提交历史按钮 diff --git a/templates/repo/view_content.tmpl b/templates/repo/view_content.tmpl index cdf7825..970c3f0 100644 --- a/templates/repo/view_content.tmpl +++ b/templates/repo/view_content.tmpl @@ -89,11 +89,6 @@ {{if $isTreePathRoot}} {{template "repo/clone_panel" .}} {{end}} - {{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} - - {{svg "octicon-history" 16}}{{ctx.Locale.Tr "repo.file_history"}} - - {{end}} {{if .IsViewFile}} diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index f8701c9..25a71d3 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -1,13 +1,26 @@ {{/* use grid layout, still use the old ID because there are many other CSS styles depending on this ID */}}
-
+
{{template "repo/latest_commit" .}} -
{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}
+
+ {{if and .LatestCommit .LatestCommit.Committer}} + + {{- ShortSha .LatestCommit.ID.String -}} + + · + {{DateUtils.TimeSince .LatestCommit.Committer.When}} + {{end}} +
{{if and (not .TreeNames) (.Permission.CanRead ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} - {{svg "octicon-history"}} {{ctx.Locale.PrettyNumber .CommitsCount}} {{ctx.Locale.TrN .CommitsCount "repo.commit" "repo.commits"}} + {{svg "octicon-history" 16}} {{ctx.Locale.PrettyNumber .CommitsCount}} {{ctx.Locale.TrN .CommitsCount "repo.commit" "repo.commits"}} {{end}} + {{if and .TreeNames (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} + + {{svg "octicon-history" 16}}{{ctx.Locale.Tr "repo.file_history"}} + + {{end}}
{{$.FileIconPoolHTML}} {{if .HasParentPath}}