Skip to content

Commit 49dddd8

Browse files
Improve PR diff view on mobile (#27883)
1. Show diff stats only on large screens these are already shown in tabs, so no need for this duplicate information on small screens ![image](https://github.com/go-gitea/gitea/assets/1135157/1287839d-7490-42eb-a17e-d526dc0bfd9e) ![image](https://github.com/go-gitea/gitea/assets/1135157/e9dcd89d-ed4d-4945-a7aa-4e6fc6d9c3a2) 2. Hide viewed files information on small screens Github does the same and this gives us more free space on small screens ![image](https://github.com/go-gitea/gitea/assets/1135157/e90b042f-fffb-4f79-a5ae-cd480c9d8334) ![image](https://github.com/go-gitea/gitea/assets/1135157/d2480ffe-58f2-4694-8ae1-a2ab0aae14d4) 3. Review bar now doesn't wrap so we don't need the 77px even on very small screens (the sticky headers are still working) ![image](https://github.com/go-gitea/gitea/assets/1135157/42b19b2b-73ef-4b88-8680-c555879b363b)
1 parent 79394b3 commit 49dddd8

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

templates/repo/diff/box.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</div>
2626
<div class="diff-detail-actions">
2727
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (not .DiffNotAvailable)}}
28-
<div class="gt-df gt-ac gt-fc gt-whitespace-nowrap gt-mr-2">
28+
<div class="not-mobile gt-df gt-ac gt-fc gt-whitespace-nowrap gt-mr-2">
2929
<label for="viewed-files-summary" id="viewed-files-summary-label" data-text-changed-template="{{ctx.Locale.Tr "repo.pulls.viewed_files_label"}}">
3030
{{ctx.Locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .Diff.NumFiles}}
3131
</label>

web_src/css/repo.css

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,6 @@
15061506
@media (max-width: 991.98px) {
15071507
.repository .diff-detail-box {
15081508
flex-direction: row;
1509-
height: 77px; /* this height should match sticky-2nd-row */
15101509
}
15111510
}
15121511

@@ -1534,13 +1533,9 @@
15341533
color: var(--color-red);
15351534
}
15361535

1537-
@media (max-width: 480px) {
1536+
@media (max-width: 991.98px) {
15381537
.repository .diff-detail-box .diff-detail-stats {
1539-
font-size: 0;
1540-
line-height: 1.6rem;
1541-
}
1542-
.repository .diff-detail-box .diff-detail-stats strong {
1543-
font-size: 1rem;
1538+
display: none !important;
15441539
}
15451540
}
15461541

@@ -1735,12 +1730,6 @@
17351730
border: none;
17361731
}
17371732

1738-
@media (max-width: 991.98px) {
1739-
.diff-file-box {
1740-
scroll-margin-top: 77px; /* match .repository .diff-detail-box */
1741-
}
1742-
}
1743-
17441733
/* TODO: this can potentially be made "global" by removing the class prefix */
17451734
.diff-file-box .ui.attached.header,
17461735
.diff-file-box .ui.attached.table {
@@ -2826,18 +2815,6 @@ tbody.commit-list {
28262815
z-index: 7;
28272816
}
28282817

2829-
@media (max-width: 991.98px) {
2830-
.ui.attached.header.diff-file-header.sticky-2nd-row {
2831-
top: 77px; /* match .repository .diff-detail-box */
2832-
}
2833-
}
2834-
2835-
@media (max-width: 480px) {
2836-
.ui.attached.header.diff-file-header.sticky-2nd-row {
2837-
position: static;
2838-
}
2839-
}
2840-
28412818
.diff-file-name {
28422819
flex: auto;
28432820
min-width: 100px;

0 commit comments

Comments
 (0)