Skip to content

Commit 9dc264a

Browse files
Diff file tree tweaks (#21446)
- Left-align the diff stat line again like previously. - Default the file tree to collapsed view, which means the tree will rendered initially collapsed and it may "pop in" via JS if enabled. I think this is more desirable than having the empty space for the tree "pop out" like it currently does. - Mute the icon, removing color unless hovered. - Increase icon size and vertically center it. Before: <img width="1271" alt="image" src="https://user-images.githubusercontent.com/115237/195666451-55771595-0525-42b8-be1b-d03cc1cb2961.png"> After: <img width="1280" alt="image" src="https://user-images.githubusercontent.com/115237/195666385-c91fd0de-6dcc-4d9c-89ff-7581828fcf14.png"> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent 4de48d5 commit 9dc264a

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Diff for: templates/repo/diff/box.tmpl

+10-8
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414
{{else}}
1515
<div>
1616
<div class="diff-detail-box diff-box sticky df sb ac fw">
17-
<a class="diff-toggle-file-tree-button">
18-
{{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}}
19-
{{svg "octicon-sidebar-collapse" 16 "icon hide"}}
20-
{{svg "octicon-sidebar-expand" 16 "icon"}}
21-
</a>
22-
<div class="diff-detail-stats df ac">
23-
{{svg "octicon-diff" 16 "mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
17+
<div class="df ac fw">
18+
<a class="diff-toggle-file-tree-button muted df ac">
19+
{{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}}
20+
{{svg "octicon-sidebar-collapse" 20 "icon hide"}}
21+
{{svg "octicon-sidebar-expand" 20 "icon"}}
22+
</a>
23+
<div class="diff-detail-stats df ac ml-3">
24+
{{svg "octicon-diff" 16 "mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
25+
</div>
2426
</div>
2527
<div class="diff-detail-actions df ac">
2628
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}}
@@ -65,7 +67,7 @@
6567
</script>
6668
<div id="diff-file-list"></div>
6769
<div id="diff-container">
68-
<div id="diff-file-tree"></div>
70+
<div id="diff-file-tree" class="hide"></div>
6971
<div id="diff-file-boxes" class="sixteen wide column">
7072
{{range $i, $file := .Diff.Files}}
7173
{{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}}

Diff for: web_src/less/_repository.less

+2-2
Original file line numberDiff line numberDiff line change
@@ -3099,11 +3099,11 @@ td.blob-excerpt {
30993099

31003100
@media @mediaMdAndDown {
31013101
#diff-file-tree {
3102-
display: none;
3102+
display: none !important;
31033103
}
31043104

31053105
.diff-toggle-file-tree-button {
3106-
display: none;
3106+
display: none !important;
31073107
}
31083108
}
31093109

0 commit comments

Comments
 (0)