From 99b9e3bf6f575a2b4c263daace3272e7032e7574 Mon Sep 17 00:00:00 2001 From: whereareiam Date: Sat, 14 Nov 2026 12:32:01 +0100 Subject: [PATCH] fix(pulls): match GitHub's classic merge box and timeline commit rows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compared against GitHub's classic conversation page at the same scale, with failing, pending and passing checks, a conflict, a draft, merged, closed and commits with and without a body: - GitHub's wording, from the theme's phrases: "Checks awaiting conflict resolution", "1 failing, 1 successful checks", "No conflicts with base branch", the draft, conflict, merged and closed sentences and "You can also merge this with the command line." A language without theme phrases keeps Forgejo's text. - Checks are grouped as on GitHub, failing first, then in progress, skipped and successful, each under a heading such as "1 failing check" that folds it, with a rule between checks of a group. The list scrolls past 300px. - Check rows are 37px with 16px icons; a failing check shows GitHub's filled red circle, and a description is set off with a dash. The status ring is 32px. - The merge button shows only its label, with GitHub's 12px padding; the disabled one of a draft or conflict keeps its dropdown arrow. - A row's button is level with its title when the row has a second line, and centred on a one-line title. - A merged or closed pull request's branch name is GitHub's blue chip. - In the timeline, the first commit of a push sits in a filled circle on a taller row, the others on 36px rows with full-size icons. A commit with a body shows GitHub's small "…" pill right after its message, and the unfolded body is muted 12px monospace under the avatar. Co-Authored-By: Claude Opus 5.5 --- .../components/issues/issue_conversation.ts | 69 ++++++++++++ styles/components/issues/pull_review.ts | 100 +++++++++++++++++- templates/repo/issue/view_content/pull.tmpl | 20 ++-- .../view_content/pull_merge_check_icon.tmpl | 12 +++ .../view_content/pull_merge_check_row.tmpl | 11 ++ .../issue/view_content/pull_merge_checks.tmpl | 83 ++++++++++----- .../issue/view_content/pull_merge_clean.tmpl | 12 +-- .../view_content/pull_merge_instruction.tmpl | 2 +- 8 files changed, 263 insertions(+), 46 deletions(-) create mode 100644 templates/repo/issue/view_content/pull_merge_check_icon.tmpl create mode 100644 templates/repo/issue/view_content/pull_merge_check_row.tmpl diff --git a/styles/components/issues/issue_conversation.ts b/styles/components/issues/issue_conversation.ts index 76c70bad..d4ef4465 100644 --- a/styles/components/issues/issue_conversation.ts +++ b/styles/components/issues/issue_conversation.ts @@ -604,6 +604,75 @@ export default css` & .comment .markup p { line-height: inherit; } + /* A commit with a body: GitHub's small "…" pill right after the message, not a full button by the hash. */ + & .comment-list .timeline-item.commits-list .singular-commit { + min-height: 36px; + & > .badge.badge-commit { + display: flex; + align-items: center; + justify-content: center; + & > svg { + width: 16px; + height: 16px; + padding: 0; + } + } + /* GitHub sets the first commit of a push apart: a taller row and its icon in a filled circle. */ + &:first-child { + min-height: 64px; + /* An unfolded body stays right under the title, inside the row's padding. */ + &:has(+ .commit-body:not(.tw-hidden)) { + min-height: 48px; + padding-top: 16px; + } + & > .badge.badge-commit { + box-sizing: border-box; + width: 32px; + height: 32px !important; + /* Forgejo's -33px offset for its 34px badge, kept centred on the timeline line. */ + margin: 0 9px 0 -32px; + border: 2px solid ${themeVars.color.body}; + border-radius: 50%; + background: ${themeVars.github.control.bgColor.rest}; + } + } + /* Forgejo's utilities are !important. */ + & > .gt-ellipsis.tw-flex-1 { + flex: 0 1 auto !important; + } + & > .shabox { + margin-left: auto; + } + & > .ellipsis-button.ui.button { + flex: none; + min-width: 0; + min-height: 0; + height: 12px; + margin: 0 0 0 5px; + padding: 0 5px; + border: 0; + border-radius: 1px; + background: color-mix(in srgb, ${themeVars.github.bgColor.neutral.emphasis} 20%, transparent); + box-shadow: none; + color: ${themeVars.color.text.self}; + font-size: 12px; + font-weight: 600; + line-height: 6px; + &:hover { + background: ${themeVars.github.control.transparent.bgColor.active}; + } + } + } + /* The unfolded body: muted 12px monospace under the avatar. */ + & .comment-list .timeline-item.commits-list > .commit-body { + margin: 0 0 8px 9px !important; + color: ${themeVars.color.text.light.num1}; + font-size: 12px; + line-height: 18px; + } + & .comment-list .timeline-item.commits-list > .singular-commit:first-child + .commit-body { + margin-bottom: 16px !important; + } /* Commits listed in the timeline: a plain, muted seven-character hash. */ & .comment-list .timeline-item.commits-list .shabox .sha.label { min-height: 0; diff --git a/styles/components/issues/pull_review.ts b/styles/components/issues/pull_review.ts index 364a18d2..b906fe8a 100644 --- a/styles/components/issues/pull_review.ts +++ b/styles/components/issues/pull_review.ts @@ -452,10 +452,14 @@ export default css` flex: 1 1 200px; min-width: 0; } + /* GitHub centres a row's button on a one-line title and tops it with a two-line one. */ & > .ui.button { flex: none; align-self: center; } + &:has(> div > p) > .ui.button { + align-self: flex-start; + } & h3 { margin: 0; font-size: 16px; @@ -470,17 +474,33 @@ export default css` line-height: 21px; } } - /* Merged and closed: the same title and muted sentence, with "Delete branch" beside them. */ + /* Merged and closed: the same title and muted sentence, with "Delete branch" beside them, level with the title. */ + & > .item.item-section:has(.merge-section-info) { + align-items: flex-start; + } & > .item.item-section > div > h3 { margin: 0 !important; font-size: 16px; font-weight: 600; line-height: 24px; } + & > .item p:empty { + display: none; + } & > .item.item-section .merge-section-info { color: ${themeVars.color.text.light.num1}; font-size: 14px; line-height: 21px; + /* The branch name: GitHub's blue branch chip. */ + & code { + padding: 2px 6px; + border: 0; + border-radius: 6px; + background: ${themeVars.github.bgColor.accent.muted}; + color: ${themeVars.github.fgColor.accent}; + font-size: 12px; + line-height: 18px; + } } & > .item.pull-merge-status > svg { background: ${themeVars.github.bgColor.success.emphasis}; @@ -534,6 +554,11 @@ export default css` min-width: 0; } /* The counts per state: an icon and a number each, labelled with Forgejo's name for the state. */ + /* GitHub's sentence of counts where the theme has it in the reader's language, else the icons with numbers. */ + & .pull-merge-checks-counts:empty, + & .pull-merge-checks-counts:not(:empty) + .pull-merge-checks-icons { + display: none; + } & .pull-merge-checks-counts { display: flex; flex-wrap: wrap; @@ -550,9 +575,9 @@ export default css` } & .pull-merge-checks-ring { flex: none; - width: 28px; - height: 28px; - margin: 2px; + width: 32px; + height: 32px; + margin: 0; border-radius: 50%; background: conic-gradient( ${themeVars.github.fgColor.success} 0 var(--checks-passing), @@ -584,6 +609,8 @@ export default css` transform: rotate(-90deg); } & > .commit-status-list { + /* GitHub scrolls the checks past 300px. */ + max-height: 300px; overflow: hidden auto; padding: 8px 0; border-top: 1px solid var(--merge-section-divider); @@ -593,13 +620,55 @@ export default css` border-top: 0; } } + /* GitHub's rows have no rules between them and 16px icons. */ + /* A group of checks in one state, folded by its heading, as GitHub's "1 failing check". */ + & .pull-merge-check-group > summary { + display: inline-flex; + align-items: center; + gap: 4px; + height: 28px; + padding: 0 8px; + border-radius: ${otherThemeVars.border.radius}; + color: ${themeVars.color.text.light.num1}; + font-size: 12px; + font-weight: 500; + line-height: 18px; + list-style: none; + cursor: pointer; + &::-webkit-details-marker { + display: none; + } + &:hover { + background: ${themeVars.github.control.transparent.bgColor.hover}; + } + & > svg { + transition: transform 0.15s ease; + } + } + & .pull-merge-check-group:not([open]) > summary > svg { + transform: rotate(-90deg); + } & .commit-status-item { display: flex; align-items: center; gap: 8px; + height: auto; min-height: 37px; margin: 0 8px; - padding: 2px 8px; + padding: 2px 6px; + border: 0; + /* GitHub rules off the checks within one group. */ + & + .commit-status-item { + border-top: 1px solid ${themeVars.color.light.border}; + border-radius: 0; + } + & > .commit-status.icon { + flex: none; + width: 16px; + min-width: 16px; + height: 16px; + margin: 0; + } border-radius: ${otherThemeVars.border.radius}; &:hover { background: ${themeVars.github.control.transparent.bgColor.hover}; @@ -612,6 +681,10 @@ export default css` margin-left: 4px; font-size: 12px; } + /* GitHub sets a status's description off with a dash. */ + & .status-context > span:not(:empty)::before { + content: "— "; + } & .status-details a { color: ${themeVars.color.text.light.num1}; font-size: 12px; @@ -636,6 +709,16 @@ export default css` & summary { ${mergeInstructionsLink} } + /* GitHub's "You can also merge this with the command line." before the link, muted and not underlined. */ + & summary > .pull-merge-cli-hint { + display: inline-block; + margin-right: 4px; + color: ${themeVars.color.text.light.num1}; + text-decoration: none; + &:empty { + display: none; + } + } & .ui.button { ${mergeButton} margin: 0; @@ -667,6 +750,13 @@ export default css` padding: 0; justify-content: center; } + /* GitHub's merge button is only its label. */ + & .merge-button > .ui.button:not(.dropdown, .icon) { + padding-inline: 12px; + & > svg { + display: none; + } + } /* The expanded form takes the whole row: title, message, then the buttons. */ & > #pull-request-merge-form:has(form .field) { flex: 0 0 100%; diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 8cd1be9a..7d04ba37 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -35,6 +35,7 @@ "CommitStatuses" .LatestCommitStatuses "MissingRequiredChecks" .MissingRequiredChecks "is_context_required" .is_context_required + "Conflicted" .IsPullFilesConflicted )}} {{end}} @@ -48,7 +49,7 @@ {{ctx.Locale.Tr "repo.pulls.merged_success"}}
@@ -60,10 +61,14 @@ {{else if .Issue.IsClosed}}
-

{{ctx.Locale.Tr "repo.pulls.closed"}}

+ {{/* GitHub names a closed pull request's branch while it can still be deleted. */}} + {{$branchLeft := and .IsPullBranchDeletable (not .IsPullRequestBroken)}} +

{{if $branchLeft}}{{template "theme/phrase" dict "Key" "pulls.closed.title" "Fallback" (ctx.Locale.Tr "repo.pulls.closed")}}{{else}}{{ctx.Locale.Tr "repo.pulls.closed"}}{{end}}