From 86e488aafb23eb973d3b77fea61f738e753b2f65 Mon Sep 17 00:00:00 2001 From: lutinglt Date: Tue, 2 Dec 2025 13:43:36 +0800 Subject: [PATCH] fix issue/pr element styles --- .github/workflows/release.yml | 2 +- CHANGELOG.md | 3 ++ options/locale/locale_zh-CN.ini | 4 ++ styles/components/issue.ts | 63 ++++++++++++++++++++++----- styles/public/label.ts | 2 +- templates/repo/commit_sign_badge.tmpl | 22 ++++++++-- 6 files changed, 79 insertions(+), 17 deletions(-) create mode 100644 options/locale/locale_zh-CN.ini diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d2db5f..4e5514f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: tar -zcf dist/theme-github-extra-pink.tar.gz --remove-files \ dist/theme-github-pink-auto.css dist/theme-github-pink-light.css dist/theme-github-pink-dark.css dist/theme-github-pink-soft-dark.css - tar -zcf dist/theme-github-templates.tar.gz templates + tar -zcf dist/theme-github-templates.tar.gz templates options TAG="v$(npm run -s version)" gh release create "$TAG" dist/* --notes-file CHANGELOG.md --draft -t $TAG env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7bfbd..a04bfbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Optimize the selection style of items in the menu. - Optimize code block styles. +- Optimize some element styles on Issue/PR page ##### Template File @@ -15,3 +16,5 @@ - Fixed extra lines under heatmap. - Supplement the PR operation panel status style in PR. +- Fixed avatar size for approving users in PR +- Fixed bot label styles in Issue/PR \ No newline at end of file diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini new file mode 100644 index 0000000..8e6160c --- /dev/null +++ b/options/locale/locale_zh-CN.ini @@ -0,0 +1,4 @@ +[github-theme] +verifed=已验证 +partially_verifed=部分验证 +unverifed=未验证 \ No newline at end of file diff --git a/styles/components/issue.ts b/styles/components/issue.ts index 684643b..1ea5811 100644 --- a/styles/components/issue.ts +++ b/styles/components/issue.ts @@ -275,6 +275,11 @@ export const prBranch = css` } `; +const botLabelStyle = { + height: "20px", + padding: "0 6px!important", + marginLeft: "4px", +}; // 评论 export const comment = css` .comment .comment-container { @@ -299,6 +304,26 @@ export const comment = css` .comment-header { padding: 4px 4px 4px 16px; min-height: 38px; + .comment-header-left { + // bot 标签 + .ui.basic.label { + ${botLabelStyle} + } + a:has(relative-time){ + text-decoration: underline; + } + // 已编辑按钮 + .content-history-menu { + color: ${themeVars.color.text.light.num1} !important; + .menu .item { + font-size: 12px; + .ui.avatar { + height: 20px; + width: 20px; + } + } + } + } } .comment-header-right { > .item, @@ -311,12 +336,6 @@ export const comment = css` height: 20px; padding: 0 6px; } - // 隐藏顶部菜单的表情按钮 - // 无法使用此样式, 评论无表情时底部的表情按钮元素不会渲染, 这是一个先有鸡还是先有蛋的问题 - // 很蛋疼, 希望 Gitea 早日使用 Github 的样式, 因为 Github 的更合理, 无论是操作的方便程度还是按钮的冗余度 - // .ui.dropdown.action.select-reaction { - // display: none; - // } .context-dropdown { height: 28px; padding: 0 6px; @@ -526,11 +545,9 @@ export const prMerge = css` padding: 16px; display: grid; gap: 8px; - &.no-header { - &::before, - &::after { - display: none; - } + &::before, + &::after { + display: none; } } } @@ -555,10 +572,20 @@ export const timeline = css` &.event { // 修复覆盖后的位置问题 padding-left: 15px; - .avatar { + // 避免锚中批准的头像 + .avatar-with-link .avatar { width: 20px; height: 20px; } + // 批准时间的头像 + // 头部居中偏移量(头像高度 - 标准行信息高度) / 2: (40px - 32px) / 2 = 4px + .timeline-avatar { + top: -4px; + } + // bot 标签 + .comment-text-line .ui.basic.label { + ${botLabelStyle} + } .badge { border: 2px solid ${themeVars.color.body}; } @@ -659,6 +686,18 @@ export const issueSidebar = css` margin-top: 0 !important; margin-bottom: 0 !important; } + // 评审人 + .ui.relaxed.list { + .item { + // 操作图标按钮 + a.muted.icon { + color: ${themeVars.color.text.light.num1}; + &:hover { + color: ${themeVars.color.primary.self}; + } + } + } + } // 标签菜单项 .ui.dropdown > .menu > .scrolling.menu > .item:has(.item-secondary-info) { // 修复标签菜单中描述文本过长没有换行挤掉标签的问题 diff --git a/styles/public/label.ts b/styles/public/label.ts index 9d22c6d..3ca1acb 100644 --- a/styles/public/label.ts +++ b/styles/public/label.ts @@ -129,7 +129,7 @@ export const shaLabel = css` // 验证提交附带的图标 span.ui.label.commit-is-signed { height: 25px; - min-width: 50px; + min-width: 35px; justify-content: center; // 验证信任 &.sign-trusted { diff --git a/templates/repo/commit_sign_badge.tmpl b/templates/repo/commit_sign_badge.tmpl index d029827..f9d177f 100644 --- a/templates/repo/commit_sign_badge.tmpl +++ b/templates/repo/commit_sign_badge.tmpl @@ -55,6 +55,13 @@ so this template should be kept as small as possible, DO NOT put large component {{- end -}} {{- end -}} +{{- $github_verifed := "github-theme.verifed" -}} +{{- $ctx_github_verifed := ctx.Locale.Tr $github_verifed -}} +{{- $github_partially_verifed := "github-theme.partially_verifed" -}} +{{- $ctx_github_partially_verifed := ctx.Locale.Tr $github_partially_verifed -}} +{{- $github_unverifed := "github-theme.unverifed" -}} +{{- $ctx_github_unverifed := ctx.Locale.Tr $github_unverifed -}} + {{- if $commit -}} {{- end -}} @@ -62,14 +69,23 @@ so this template should be kept as small as possible, DO NOT put large component {{- if $verified -}} {{- if and $signingUser $signingUser.ID -}} - Verified + + {{if eq $ctx_github_verifed $github_verifed }}Verified + {{else}}{{$ctx_github_verifed}}{{end}} + {{ctx.AvatarUtils.Avatar $signingUser 16}} {{- else -}} - Partially verified + + {{if eq $ctx_github_partially_verifed $github_partially_verifed }}Partially verified + {{else}}{{$ctx_github_partially_verifed}}{{end}} + {{ctx.AvatarUtils.AvatarByEmail $signingEmail "" 16}} {{- end -}} {{- else -}} - Unverified + + {{if eq $ctx_github_unverifed $github_unverifed }}Unverified + {{else}}{{$ctx_github_unverifed}}{{end}} + {{- end -}} {{- end -}}