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

Optimize profile layout to enhance visual experience #31278

Merged
merged 11 commits into from
Jun 12, 2024

Conversation

kerwin612
Copy link
Member

before:
1717721386311

after:
1717721383533

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 7, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 7, 2024
@github-actions github-actions bot added the modifies/templates This PR modifies the template files label Jun 7, 2024
@silverwind silverwind added backport/v1.22 This PR should be backported to Gitea 1.22 and removed backport/v1.22 This PR should be backported to Gitea 1.22 labels Jun 7, 2024
@silverwind
Copy link
Member

Hmm I can't reproduce your "before", it already looks good to me:

image

If it really is an issue, I think this one may be better solved with some CSS because there is already CSS targeting these <li> elements.

@kerwin612
Copy link
Member Author

Hmm I can't reproduce your "before", it already looks good to me:

image If it really is an issue, I think this one may be better solved with some CSS because there is already CSS targeting these `
  • ` elements.
  • bug

    @kerwin612
    Copy link
    Member Author

    The reason for this problem is that fixed-size svg is not centered between its two parent containers;

    @silverwind
    Copy link
    Member

    Looks fine for me in latest Firefox and Chrome:

    Which browser are you using?

    @kerwin612
    Copy link
    Member Author

    image
    My solution is to add flex&center to both parent containers. Having a fixed style ensures that it is centered.

    @kerwin612 kerwin612 requested review from delvh and lunny June 7, 2024 08:17
    @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 Jun 7, 2024
    @lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 7, 2024
    @silverwind
    Copy link
    Member

    @lunny why set that label when there is only 1 review and we aren't even sure whether this is valid at all?

    @silverwind silverwind removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 7, 2024
    @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 Jun 7, 2024
    @lunny
    Copy link
    Member

    lunny commented Jun 8, 2024

    @lunny why set that label when there is only 1 review and we aren't even sure whether this is valid at all?

    Sorry, made a mistake.

    @kerwin612
    Copy link
    Member Author

    @lunny why set that label when there is only 1 review and we aren't even sure whether this is valid at all?

    Sorry, made a mistake.

    Upon careful review of our previous communications, it can be seen that:

    Firstly, I encountered this issue on my Edge browser: the icons and their corresponding text are not horizontally centered;

    Subsequently, I pinpointed the cause by tracing back: there are two parent containers above the icon, neither of which had the display property set, resulting in their child elements not being centered. The height of the parent is 20, the child's height is 19, and the icon's height is 16;

    Finally, I resolved this issue by applying flex and center styles to both parent containers; As a result, I naturally proceeded to submit this pull request (PR).

    As for @silverwind , he states that the issue does not exist on his Firefox and Chrome browsers, but his evidence does not negate the problem I've raised! The issue I've brought up at least proves that there is indeed a style anomaly here!

    Moreover, my modifications have indeed resolved the issue I raised, and have not introduced any new problems. So, what else do I need to do?

    @lunny

    @yp05327
    Copy link
    Contributor

    yp05327 commented Jun 9, 2024

    I can reproduce this in Windows's Chrome and Edge.
    And I also checked this in macOS's Chrome, the behaviour is different:

    edited: maybe not correct in Windows's Chrome:

    image

    in macOS's Chrome:

    50A94D4A-F1B5-41F8-BD45-30966FAD2781

    edit:
    maybe this is because of the screen size and the scaling, not sure about it.
    but what I want to say is that, this may be caused by different OS

    Copy link
    Member

    @silverwind silverwind left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Will check later whether there is a better way.

    Copy link

    @MrSuddenJoy MrSuddenJoy left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    This code looks good to me. Well done 👍🏻

    @kerwin612
    Copy link
    Member Author

    Okay, even if I can not reproduce on MacOS, I think there must be a better way than littering the code with flex-text-inline, and even nesting it.

    I have identified the issue and resolved it; thus, at the very least, this issue indeed needed to be addressed. If you believe my modification is not reasonable enough, please state your thoughts, and I will cooperate to make corrections, rather than outright rejecting the modification.

    @kerwin612 kerwin612 removed the request for review from silverwind June 11, 2024 00:52
    @kerwin612 kerwin612 added reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged labels Jun 11, 2024
    @GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Jun 11, 2024
    @lunny
    Copy link
    Member

    lunny commented Jun 11, 2024

    Will check later whether there is a better way.

    @kerwin612 Please wait for silverwind's review.

    @lunny lunny removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 11, 2024
    @pull-request-size pull-request-size bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 11, 2024
    @silverwind
    Copy link
    Member

    silverwind commented Jun 11, 2024

    Pushed a fix that removed the unnecessary and unsemantic <i> element altogether and with that, the nesting of flex-text-inline is gone.

    @GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged labels Jun 11, 2024
    {{svg "octicon-lock"}}
    </i>
    {{end}}
    <a class="flex-text-inline" href="{{AppSubUrl}}/user/settings#privacy-user-settings" data-tooltip-content="{{ctx.Locale.Tr (Iif .ShowUserEmail "user.email_visibility.limited" "user.email_visibility.private")}}">
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Hmm, it looks like an abuse.

    The flex and align items should be on the parent element <li> to align the svg mail / mailto / svg private.

    No idea why it is only on the svg private .....

    Copy link
    Member Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    image
    As in the screenshot, the li element has already been styled appropriately. The current Pull Request resolves the issue where the svg element inside the a element is not centered.

    Copy link
    Member

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Yes I agree flex-text-inline is likely not ideal, but it's aiming at this specific alignment problem that for some reason only shows on Windows, it does not reproduce on any MacOS browser for me.

    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    I guess the root problem is the "spaces" between elements, which make the height different.

    I guess using {{- svg ... -}} would make the height correct and no need to use "flex" on "a". Just a guess and using "flex" is still acceptable.

    Copy link
    Member

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Yes, likely it is whitespace-related because the display: flex removes the whitespace rendering.

    @wxiaoguang wxiaoguang enabled auto-merge (squash) June 12, 2024 03:38
    @wxiaoguang wxiaoguang merged commit a975ce8 into go-gitea:main Jun 12, 2024
    26 checks passed
    @GiteaBot GiteaBot added this to the 1.23.0 milestone Jun 12, 2024
    zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 13, 2024
    * giteaofficial/main:
      Fixed incorrect localization `explorer.go` (go-gitea#31348)
      Improve detecting empty files (go-gitea#31332)
      Fix hash render end with colon (go-gitea#31319)
      Fix line number widths (go-gitea#31341)
      Fix navbar `+` menu flashing on page load (go-gitea#31281)
      Reduce memory usage for chunked artifact uploads to MinIO (go-gitea#31325)
      Fix dates displaying in a wrong manner when we're close to the end of the month (go-gitea#31331)
      Fix adopt repository has empty object name in database (go-gitea#31333)
      Optimize profile layout to enhance visual experience (go-gitea#31278)
    @go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 10, 2024
    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. modifies/templates This PR modifies the template files size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    8 participants