Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code comment review on mobile #21461

Merged
merged 13 commits into from
Oct 25, 2022

Conversation

Gusted
Copy link
Contributor

@Gusted Gusted commented Oct 14, 2022

  • 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. As well force them to have flex: 1 so they won't overflow on x-asis. This also requires the width: 100% for the .ui.buttons div.
  • Resolves Avatar Fills Width On Small Screen Resolution in Code Comment #20074

Before

After

- 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 go-gitea#20074
@Gusted Gusted added type/bug topic/ui Change the appearance of the Gitea UI topic/mobile backport/v1.17 labels Oct 14, 2022
@Gusted Gusted added this to the 1.18.0 milestone Oct 14, 2022
web_src/less/helpers.less Show resolved Hide resolved
web_src/less/_review.less Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 14, 2022
@silverwind
Copy link
Member

image

I'd say avatar should be left side, otherwise the "speech bubble" effect is pointless.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 15, 2022
@Gusted
Copy link
Contributor Author

Gusted commented Oct 15, 2022

I'd say avatar should be left side, otherwise the "speech bubble" effect is pointless.

Never noticed it was a speech bubble.

@Gusted
Copy link
Contributor Author

Gusted commented Oct 15, 2022

Would be an option to remove the "speech bubble icon"?, it's the only comment form that still has this, all other ones are already in the header.

@silverwind
Copy link
Member

silverwind commented Oct 18, 2022

speech bubble icon

You mean removing the triangle? I think we want to keep these as the speech bubble effect is still present during regular issue comments.

@Gusted
Copy link
Contributor Author

Gusted commented Oct 22, 2022

af142d3 keeps the speech bubble effect as well fix the overflowing "previous/next" buttons. "After" screenshot also updated.

@lunny
Copy link
Member

lunny commented Oct 23, 2022

CI failure is related

@silverwind
Copy link
Member

Ideally avatar should move into empty space on the left, but I'm afraid that's not easily possible with that table layout in place.

@silverwind
Copy link
Member

silverwind commented Oct 24, 2022

Try this patch:

diff --git a/web_src/less/_review.less b/web_src/less/_review.less
index 52f10a4daa..c2f85fff62 100644
--- a/web_src/less/_review.less
+++ b/web_src/less/_review.less
@@ -47,8 +47,21 @@
     margin-bottom: .5em;
   }
 }
 
+tr.add-comment {
+  position: relative;
+  left: -90px;
+}
+
+tr.add-comment .comment-code-cloud {
+  width: calc(100% + 90px);
+}
+
+tr.add-comment .comment-code-cloud .comment-container {
+  width: calc(100% - 50px);
+}
+
 .show-outdated,
 .hide-outdated {
   &:extend(.unselectable);
   display: block !important;
@@ -75,20 +88,20 @@
     }
 
     .ui.buttons {
       width: 100%;
+      margin: 0 !important;
 
       .button {
         flex: 1;
       }
     }
   }
 
   .comments .comment {
-    margin: 0;
+    padding: 0;
 
     @media @mediaSm {
-      padding: 0;
       display: flex;
 
       .comment-header-right.actions .ui.basic.label {
         display: none;

image

@Gusted
Copy link
Contributor Author

Gusted commented Oct 24, 2022

Looks good for mobile, but... for larger screens this looks like a full-width hack 😅 I'm not really sure if we want that.

image

@silverwind
Copy link
Member

I don't mind it as much even on desktop, but yes, I can probably increase right side margin a bit.

@Gusted
Copy link
Contributor Author

Gusted commented Oct 24, 2022

I don't mind it as much even on desktop, but yes, I can probably increase right side margin a bit.

If we break such "user are used to this" it should be minimal, so adding right-side margin(on non-mobile) is fine with me.

@Gusted
Copy link
Contributor Author

Gusted commented Oct 24, 2022

And it's breaking on split diff
image

@silverwind
Copy link
Member

This should be better (and simpler). Full width on mobile only, on desktop, align comment left side with line numbers:

diff --git a/web_src/less/_review.less b/web_src/less/_review.less
index 52f10a4daa..93c7ecab81 100644
--- a/web_src/less/_review.less
+++ b/web_src/less/_review.less
@@ -61,10 +61,13 @@
 .comment-code-cloud {
   padding: .5rem !important;
   position: relative;
   margin: 0 auto;
+  left: -56px;

   @media @mediaSm {
+    left: -90px;
+    width: calc(100% + 80px);
     padding: .75rem !important;

     .code-comment-buttons {
       margin: .5rem 0 .25rem !important;
@@ -75,20 +78,20 @@
     }

     .ui.buttons {
       width: 100%;
+      margin: 0 !important;

       .button {
         flex: 1;
       }
     }
   }

   .comments .comment {
-    margin: 0;
+    padding: 0;

     @media @mediaSm {
-      padding: 0;
       display: flex;

       .comment-header-right.actions .ui.basic.label {
         display: none;

Screen Shot 2022-10-24 at 22 51 35

Screen Shot 2022-10-24 at 22 52 10

@silverwind
Copy link
Member

Indeed, split diff is a problem because line numbers are not as wide.

@Gusted
Copy link
Contributor Author

Gusted commented Oct 24, 2022

Eh.... Try simulating 375x667

Pull page:
image

File page:
image

@silverwind
Copy link
Member

I give up, there is no clean way via CSS. the <td> for line numbers would need to be removed from HTML rendering to be able to efficiently use that space.

Pushed a few small margin/padding changes that are non-destructive.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Oct 24, 2022
@silverwind
Copy link
Member

Actually, I think I found something that works.

@silverwind
Copy link
Member

silverwind commented Oct 24, 2022

New version uses colspan and display: none to use all available space. It should work flawlessly as it does not alter HTML structure. I limited the width on large viewports to 1000px, feel free to adjust.

Screen Shot 2022-10-24 at 22 52 10

image

@lunny
Copy link
Member

lunny commented Oct 25, 2022

make L-G-T-M work

@silverwind
Copy link
Member

@Gusted can you review once more?

@Gusted
Copy link
Contributor Author

Gusted commented Oct 25, 2022

Alright, this looks good to me as well.

@lunny lunny merged commit 29c00eb into go-gitea:main Oct 25, 2022
zjjhot added a commit to zjjhot/gitea that referenced this pull request Oct 25, 2022
* upstream/main:
  Fix issues count bug (go-gitea#21557)
  Improve code comment review on mobile (go-gitea#21461)
  Consolidate remaining colors into variables (go-gitea#21582)
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/mobile topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avatar Fills Width On Small Screen Resolution in Code Comment
5 participants