Skip to content

Commit 6d90d8f

Browse files
author
Gusted
committed
Improve code comment review on mobile
- Fix placement of avatar image, this was not placed in the `comment-header-left` and add CSS to cover the limiting of width+height of avatar for code-review comment on "Files changed" page. This fixes the big noticeable avatar issue. - Apply `margin-bottom` to the "next" button, so it's consistent with the "previous" button. - Make sure the "next"/"previous" start at `flex-start` on mobile and not off-screen at `flex-end`. - Add `flex: 1` to the text, so the browser will nicely wrap the "XXX commented XXX ago" text besides the avatar and make the header a bit more compact, still not ideal. - Resolves #20074
1 parent 94d6d93 commit 6d90d8f

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

templates/repo/diff/comments.tmpl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22

33
{{$createdStr:= TimeSinceUnix .CreatedUnix $.root.locale}}
44
<div class="comment" id="{{.HashTag}}">
5-
{{if .OriginalAuthor}}
6-
<span class="avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
7-
{{else}}
8-
{{template "shared/user/avatarlink" .Poster}}
9-
{{end}}
105
<div class="content comment-container">
116
<div class="ui top attached header comment-header df ac sb">
127
<div class="comment-header-left df ac">
138
{{if .OriginalAuthor}}
9+
<span class="avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
1410
<span class="text black mr-2">
1511
{{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}}
1612
{{.OriginalAuthor}}
@@ -24,6 +20,7 @@
2420
{{end}}
2521
</span>
2622
{{else}}
23+
{{template "shared/user/avatarlink" .Poster}}
2724
<span class="text grey">
2825
{{template "shared/user/namelink" .Poster}}
2926
{{$.root.locale.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}}

templates/repo/diff/conversation.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{{template "repo/diff/comments" dict "root" $ "comments" .comments}}
2727
</ui>
2828
</div>
29-
<div class="df je ac fw mt-3">
29+
<div class="df je js-small ac fw mt-3">
3030
<div class="ui buttons mr-2">
3131
<button class="ui icon tiny basic button previous-conversation">
3232
{{svg "octicon-arrow-up" 12 "icon"}} {{$.locale.Tr "repo.issues.previous"}}

web_src/less/_repository.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,10 @@
11261126
.comment-content {
11271127
margin-left: 36px;
11281128
}
1129+
}
11291130

1131+
.code-comment,
1132+
.comment {
11301133
img.avatar {
11311134
width: 28px;
11321135
height: 28px;

web_src/less/_review.less

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,7 @@
166166
.button {
167167
width: 100%;
168168
margin: 0 !important;
169-
170-
&:not(:last-child) {
171-
margin-bottom: .75rem !important;
172-
}
169+
margin-bottom: .75rem !important;
173170
}
174171
}
175172
}
@@ -295,3 +292,9 @@ a.blob-excerpt:hover {
295292
width: 72px;
296293
height: 10px;
297294
}
295+
296+
@media @mediaSm {
297+
.comment-code-cloud .ui.comments .comment .text {
298+
flex: 1;
299+
}
300+
}

web_src/less/helpers.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,5 @@
175175
@media @mediaSm {
176176
.db-small { display: block !important; }
177177
.w-100-small { width: 100% !important; }
178+
.js-small { justify-content: flex-start !important; }
178179
}

0 commit comments

Comments
 (0)