optimize latest commit style

This commit is contained in:
lutinglt
2025-11-28 11:51:42 +08:00
parent 91ef8da69c
commit 15d741ff66
6 changed files with 19 additions and 14 deletions

View File

@@ -36,12 +36,8 @@ export const commit = css`
} }
// 提交信息右侧 // 提交信息右侧
.tw-text-right { .tw-text-right {
// 时间标签
relative-time, relative-time,
// 复制 SHA 按钮 svg {
.btn.copy-commit-id,
// 查看提交路径按钮
.btn.view-commit-path {
color: ${themeVars.color.text.light.num1}; color: ${themeVars.color.text.light.num1};
} }
} }

View File

@@ -1,11 +1,12 @@
import { css, otherThemeVars, themeVars } from "src/types/vars"; import { css, otherThemeVars, themeVars } from "src/types/vars";
export const repoFileLastCommit = css` export const repoFileLastCommit = css`
// 仓库页的最后一次提交 // 仓库页和文件列表文件夹页的最后一次提交
.repository.file.list #repo-files-table .github-theme-templates.repo-file-line.repo-file-last-commit { .repository.file.list #repo-files-table .github-theme-templates.repo-file-line.repo-file-last-commit {
padding-right: 10px; padding-right: 10px;
// 提交时间 // 提交时间
.github-latest-time { .github-latest-time {
color: ${themeVars.color.text.light.num1};
font-size: 12px; font-size: 12px;
} }
// 提交历史按钮 // 提交历史按钮

View File

@@ -89,11 +89,6 @@
{{if $isTreePathRoot}} {{if $isTreePathRoot}}
{{template "repo/clone_panel" .}} {{template "repo/clone_panel" .}}
{{end}} {{end}}
{{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}}
<a class="ui button" href="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/{{.TreePath | PathEscapeSegments}}">
{{svg "octicon-history" 16}}{{ctx.Locale.Tr "repo.file_history"}}
</a>
{{end}}
</div> </div>
</div> </div>
{{if .IsViewFile}} {{if .IsViewFile}}

View File

@@ -1,13 +1,26 @@
{{/* use grid layout, still use the old ID because there are many other CSS styles depending on this ID */}} {{/* use grid layout, still use the old ID because there are many other CSS styles depending on this ID */}}
<div id="repo-files-table" {{if .HasFilesWithoutLatestCommit}}hx-indicator="#repo-files-table .repo-file-cell.message" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}> <div id="repo-files-table" {{if .HasFilesWithoutLatestCommit}}hx-indicator="#repo-files-table .repo-file-cell.message" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}>
<div class="{{if not .TreeNames}}github-theme-templates{{end}} repo-file-line repo-file-last-commit"> <div class="github-theme-templates repo-file-line repo-file-last-commit">
{{template "repo/latest_commit" .}} {{template "repo/latest_commit" .}}
<div class="github-latest-time">{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div> <div class="github-latest-time">
{{if and .LatestCommit .LatestCommit.Committer}}
<a href="{{ (print .RepoLink "/commit") }}/{{.LatestCommit.ID}}" class="muted" rel="nofollow">
{{- ShortSha .LatestCommit.ID.String -}}
</a>
·
{{DateUtils.TimeSince .LatestCommit.Committer.When}}
{{end}}
</div>
{{if and (not .TreeNames) (.Permission.CanRead ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} {{if and (not .TreeNames) (.Permission.CanRead ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}}
<a class="github-latest-commit item muted" href="{{.RepoLink}}/commits/{{.RefFullName.RefWebLinkPath}}"> <a class="github-latest-commit item muted" href="{{.RepoLink}}/commits/{{.RefFullName.RefWebLinkPath}}">
{{svg "octicon-history"}} <b>{{ctx.Locale.PrettyNumber .CommitsCount}}</b> {{ctx.Locale.TrN .CommitsCount "repo.commit" "repo.commits"}} {{svg "octicon-history" 16}} <b>{{ctx.Locale.PrettyNumber .CommitsCount}}</b> {{ctx.Locale.TrN .CommitsCount "repo.commit" "repo.commits"}}
</a> </a>
{{end}} {{end}}
{{if and .TreeNames (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}}
<a class="github-latest-commit item muted" href="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/{{.TreePath | PathEscapeSegments}}">
{{svg "octicon-history" 16}}{{ctx.Locale.Tr "repo.file_history"}}
</a>
{{end}}
</div> </div>
{{$.FileIconPoolHTML}} {{$.FileIconPoolHTML}}
{{if .HasParentPath}} {{if .HasParentPath}}