Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions styles/components/issues/issue_conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
100 changes: 95 additions & 5 deletions styles/components/issues/pull_review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand Down Expand Up @@ -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;
Expand All @@ -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),
Expand Down Expand Up @@ -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);
Expand All @@ -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};
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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%;
Expand Down
20 changes: 13 additions & 7 deletions templates/repo/issue/view_content/pull.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"CommitStatuses" .LatestCommitStatuses
"MissingRequiredChecks" .MissingRequiredChecks
"is_context_required" .is_context_required
"Conflicted" .IsPullFilesConflicted
)}}
</div>
{{end}}
Expand All @@ -48,7 +49,7 @@
{{ctx.Locale.Tr "repo.pulls.merged_success"}}
</h3>
<div class="merge-section-info">
{{ctx.Locale.Tr "repo.pulls.merged_info_text" (HTMLFormat "<code>%s</code>" .HeadTarget)}}
{{template "theme/phrase" dict "Key" "pulls.merged.description" "Branch" (HTMLFormat "<code>%s</code>" .HeadTarget) "Fallback" (ctx.Locale.Tr "repo.pulls.merged_info_text" (HTMLFormat "<code>%s</code>" .HeadTarget))}}
</div>
</div>
<div>
Expand All @@ -60,10 +61,14 @@
{{else if .Issue.IsClosed}}
<div class="item item-section text tw-flex-1">
<div>
<h3 class="tw-mb-2">{{ctx.Locale.Tr "repo.pulls.closed"}}</h3>
{{/* GitHub names a closed pull request's branch while it can still be deleted. */}}
{{$branchLeft := and .IsPullBranchDeletable (not .IsPullRequestBroken)}}
<h3 class="tw-mb-2">{{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}}</h3>
<div class="merge-section-info">
{{if .IsPullRequestBroken}}
{{ctx.Locale.Tr "repo.pulls.cant_reopen_deleted_branch"}}
{{else if $branchLeft}}
{{template "theme/phrase" dict "Key" "pulls.closed.description" "Branch" (HTMLFormat "<code>%s</code>" .HeadTarget) "Fallback" (ctx.Locale.Tr "repo.pulls.reopen_to_merge")}}
{{else}}
{{ctx.Locale.Tr "repo.pulls.reopen_to_merge"}}
{{end}}
Expand All @@ -80,8 +85,8 @@
<div class="item pull-merge-row">
{{svg "octicon-alert-fill"}}
<div>
<h3>{{ctx.Locale.Tr "repo.pulls.files_conflicted"}}</h3>
<p>{{ctx.Locale.Tr "repo.pulls.cannot_auto_merge_helper"}}</p>
<h3>{{template "theme/phrase" dict "Key" "pulls.merge.conflict_title" "Fallback" (ctx.Locale.Tr "repo.pulls.files_conflicted")}}</h3>
<p>{{template "theme/phrase" dict "Key" "pulls.merge.conflict_description" "Fallback" (ctx.Locale.Tr "repo.pulls.cannot_auto_merge_helper")}}</p>
<ul class="pull-merge-files">
{{range .ConflictedFiles}}
<li>{{svg "octicon-file"}}<code>{{.}}</code></li>
Expand All @@ -102,7 +107,8 @@
<div class="item pull-merge-row toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}" data-update-url="{{.Issue.Link}}/title">
{{svg "octicon-git-pull-request-draft"}}
<div>
<h3>{{ctx.Locale.Tr "repo.pulls.cannot_merge_work_in_progress"}}</h3>
<h3>{{template "theme/phrase" dict "Key" "pulls.merge.draft_title" "Fallback" (ctx.Locale.Tr "repo.pulls.cannot_merge_work_in_progress")}}</h3>
<p>{{template "theme/phrase" dict "Key" "pulls.merge.draft_description" "Fallback" (ctx.Locale.Tr "repo.pulls.no_merge_wip")}}</p>
</div>
{{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}}
<button class="ui compact button">{{ctx.Locale.Tr "repo.pulls.remove_prefix" .WorkInProgressPrefix}}</button>
Expand Down Expand Up @@ -417,8 +423,8 @@
{{else if and $showMergeInstructions .AllowMerge (not .IsPullRequestBroken) (or .IsPullWorkInProgress .IsPullFilesConflicted)}}
{{/* GitHub keeps the merge button in place, disabled, until the draft or the conflict is resolved. */}}
<div class="pull-merge-actions">
<div class="ui buttons">
<button class="ui button" disabled>{{svg "octicon-git-merge"}}{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</button>
<div class="ui buttons merge-button">
<button class="ui button" disabled>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</button>
<button class="ui icon button" disabled aria-label="{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}">{{svg "octicon-triangle-down" 14}}</button>
</div>
{{template "repo/issue/view_content/pull_merge_instruction" dict "PullRequest" .Issue.PullRequest "ShowMergeInstructions" .ShowMergeInstructions "AutodetectManualMerge" .AutodetectManualMerge "DefaultMergeMessage" .DefaultMergeMessage "DefaultMergeBody" .DefaultMergeBody "IsPullFilesConflicted" .IsPullFilesConflicted "NoDivider" true}}
Expand Down
12 changes: 12 additions & 0 deletions templates/repo/issue/view_content/pull_merge_check_icon.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{/* A check's state in the merge box, as GitHub draws it there: failing checks get a filled circle. */}}
{{if or (eq .State "failure") (eq .State "error")}}
{{svg "octicon-x-circle-fill" 16 "commit-status icon text red"}}
{{else if eq .State "warning"}}
{{svg "octicon-alert-fill" 16 "commit-status icon text yellow"}}
{{else if eq .State "pending"}}
{{svg "octicon-dot-fill" 16 "commit-status icon text yellow"}}
{{else if eq .State "skipped"}}
{{svg "octicon-skip" 16 "commit-status icon text grey"}}
{{else}}
{{svg "octicon-check" 16 "commit-status icon text green"}}
{{end}}
11 changes: 11 additions & 0 deletions templates/repo/issue/view_content/pull_merge_check_row.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{/* One check in the merge box: its state, name and description, and whether branch protection requires it. Takes Status and is_context_required. */}}
<div class="commit-status-item">
{{template "repo/issue/view_content/pull_merge_check_icon" .Status}}
<div class="status-context gt-ellipsis">{{.Status.Context}} <span class="text light-2">{{.Status.Description}}</span></div>
<div class="ui status-details">
{{if .is_context_required}}
{{if (call .is_context_required .Status.Context)}}<div class="ui label">{{ctx.Locale.Tr "repo.pulls.status_checks_requested"}}</div>{{end}}
{{end}}
<span>{{if .Status.TargetURL}}<a href="{{.Status.TargetURL}}">{{ctx.Locale.Tr "repo.pulls.status_checks_details"}}</a>{{end}}</span>
</div>
</div>
Loading
Loading