Skip to content

Even more repo rework #15005

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

Closed
wants to merge 39 commits into from
Closed

Conversation

CL-Jeremy
Copy link
Contributor

@CL-Jeremy CL-Jeremy commented Mar 16, 2021

The previous rework marks only the beginning of a big rework towards mobile friendliness. The main change is that tables are now unstackable on mobile: no more overly long page scrolling (figure 1).

This PR includes many more stuff I'd like to fix urgently. #14704 was focusing on the tabular menu, but I went on to include language statistics as well as it is related in design concept (finger-scrollable with an auto-hiding scrollbar). Further changes would make that PR impossible to be reviewed.

This PR includes but is not limited to the following changes as of now (As this is just a draft, I'd like to let it settle a bit and summarize the changes more thoroughly during that time):

  • Repo home

    • Table header now uses a flexbox (I believe this is a prerequisite for correct handling of the buggy commit message wrapper, that part is a WIP as of now, so this still overflows on mobile)
    • Table rows now automatically hides commit messages on mobile portrait mode like GitHub, but shows them in landscape mode
    • Secondary menu (buttons above the table) now wraps and aligns much better on mobile, with the upload buttons centered on desktop and right-floating on mobile
    • (This touches multiple files) Topic editing gets repositioned (figure 2) in presence of repo search bar, correctly uses octicon instead of Font Awesome supplied by semantic dropdown (overridden in index.js) for newly created labels, and correctly shows a different red color (figure 3; I invented the colors - need to be formalized) for invalid labels (previously it was impossible to tell which labels are actually invalid, since all subordinate labels to a semantic multiple search bar in error state are dyed red, and that red theme is exactly the same red as the defined accent red), and valid labels get better colors with both arc-green and gitea themes
  • Repo commit list (history)

    • Table header: wraps correctly on various resolutions
    • Table rows: hides short SHA on very mobile portrait mode, just like repo home; age is fixed at 120px, just like repo home
    • Commit message wrapper: correctly expands downward without affecting other cells, like with vertical-align: middle, the button is shorter in height, uses octicon, and aligns properly with other commits without such a button (think of floating layout - right margin is aligned with surrounding texts, which used to extend only to its left margin, wasting some space) - most of these changes are reflected in the same wrapper on file list table header (ported over to save some layout effort, even using display: table-cell for neighboring elements)
  • Repo branches

    • Table rows: hides PR and commit comparison rows on mobile (portrait and landscape) mode - I'll see if this touches more stuff than needed
  • Git graph (new)

    • SHA label aesthetics match others now
  • Global

    • Short SHA label now uses 12px 14px icon instead of previous 16px, which was way too big and made signed labels much taller than unsigned labels, creating many problems
    • Explore: topic labels gets smaller top margin
    • Misc: various alignment/overflow issues are fixed with flexboxes / min-width: max-content (expect better compatibility than fix-content)
  • Bug (partially fixed): overflowing file list table header (now hard truncated without proper ellipsis - detail expansion button is hidden when commit message is too long)

Suggestions and comments are highly appreciated as always.

Figure 1:
Bildschirmfoto von 2021-03-16 13-06-02

Figure 2:
Bildschirmfoto von 2021-03-16 12-45-04

Figure 3:
Bildschirmfoto von 2021-03-16 12-52-47

close #15283

@CL-Jeremy
Copy link
Contributor Author

Sorry I forgot to highlight that repo home page still overflows, but solely due to the message wrapper. The overflow will be solved once that is solved. That's why I didn't screenshot that as figure 1.

Bildschirmfoto von 2021-03-16 13-10-29

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 16, 2021
@CL-Jeremy
Copy link
Contributor Author

One more screenshot to demonstrate signed and unsigned SHA labels in a list:

Bildschirmfoto von 2021-03-16 13-13-54

@lafriks lafriks added the topic/ui Change the appearance of the Gitea UI label Mar 16, 2021
@lafriks lafriks added this to the 1.15.0 milestone Mar 16, 2021
@@ -555,7 +555,8 @@ func SVG(icon string, others ...interface{}) template.HTML {
svgStr = heightRe.ReplaceAllString(svgStr, fmt.Sprintf(`height="%d"`, size))
}
if class != "" {
svgStr = strings.Replace(svgStr, `class="`, fmt.Sprintf(`class="%s `, class), 1)
matches := regexp.MustCompile(`class="(.*?)"`).FindStringSubmatch(svgStr)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is personal taste: I don't want to have <svg> elements generated by svg.js and helper.go to have different order of class names. I originally planned to deduplicate the class names (like in svg.js) but that would add unnecessary costs with no added benefit.

Copy link
Member

@silverwind silverwind Mar 21, 2021

Choose a reason for hiding this comment

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

You should move regexp.MustCompile out of the function to not compile the regex every function call.

@CL-Jeremy
Copy link
Contributor Author

Forgot to test avatar. Found the culprit of that misalignment: #10425 (comment). Fix is coming.

@CL-Jeremy CL-Jeremy force-pushed the mobile-repo-rework branch 2 times, most recently from 960b66e to 548b7d2 Compare March 16, 2021 15:35
@CL-Jeremy CL-Jeremy force-pushed the mobile-repo-rework branch from 548b7d2 to 7828478 Compare March 16, 2021 15:45
@@ -9,21 +9,21 @@
</h4>

<div class="ui attached table segment">
<table class="ui very basic striped fixed table single line">
<table class="ui very basic striped fixed table single line unstackable table">
Copy link
Member

Choose a reason for hiding this comment

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

There are two tables now.

@CL-Jeremy CL-Jeremy force-pushed the mobile-repo-rework branch from 87c804c to 74c9c4e Compare March 16, 2021 18:28
@@ -37,7 +37,7 @@
{{end}}
</div>
<div class="ui bottom attached header">
<p class="team-meta">{{.NumMembers}} {{$.i18n.Tr "org.lower_members"}} · {{.NumRepos}} {{$.i18n.Tr "org.lower_repositories"}}</p>
<p class="team-meta">{{.NumMembers}} {{$.i18n.Tr "org.lower_members"}}&nbsp;·&nbsp;{{.NumRepos}} {{$.i18n.Tr "org.lower_repositories"}}</p>
Copy link
Member

Choose a reason for hiding this comment

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

Width of &nbsp; will not be consistent across different fonts and I generally despise using whitespace for layout purposes, better to use something like

<span class="mx-2">·</span>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This goes without saying for me, but I was more focused on other stuff. I might revert this change in exchange to better solutions. white-space: pre exists at other places as well - I really can't see the use of that apart from supporting this type of weird layout technique with breakable spaces - ugh!

margin-left: 0;
margin-right: 0;
&.flex-wrappable {
margin-bottom: 0;
Copy link
Member

Choose a reason for hiding this comment

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

Why not use the mb-0 helper instead of adding this class? Also mb-1 for .item.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be a helper class like those it replaces: it applies recustively so I don't have to add mb-1 to every single .item in case I forget one. Didn't you create those classes (forgive me if I'm wrong)?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I guess that usage is fine. Yes it was me who added the helpers.

@CL-Jeremy CL-Jeremy force-pushed the mobile-repo-rework branch from 4d2c25f to e4bd476 Compare March 17, 2021 14:50
@CL-Jeremy CL-Jeremy force-pushed the mobile-repo-rework branch from ee03601 to d906f8d Compare March 17, 2021 17:33
@CL-Jeremy
Copy link
Contributor Author

Damn, I have too many local branches and did a force push without actually changing the content of the commit... Sorry for wasting CPU power of CI...

@jolheiser
Copy link
Member

Damn, I have too many local branches and did a force push without actually changing the content of the commit... Sorry for wasting CPU power of CI...

I've cancelled the job, no worries. 🙂

@silverwind
Copy link
Member

Those have to be resolved with proper theming

Actually I was planning on this as part of the ongoing CSS variable rework. In the final result, arc-green should only consist of variables.

{{if .IsProtected}}
{{svg "octicon-shield-lock"}}
{{end}}
<a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a>
<p class="info df ac my-2">{{svg "octicon-git-commit" 16 "mr-2"}}<a href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}">{{ShortSha .Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
<p class="info df ac my-2" title="{{$renderedCommitMessage}}">
{{- svg "octicon-git-commit" 16 "mr-2"}}{{/* p */ -}}
Copy link
Member

Choose a reason for hiding this comment

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

What does this /* p */ do?

--color-yellow-sha-bg: rgba(251, 189, 8, .1);
--color-yellow-sha-hover: rgba(251, 189, 8, .3);
--color-green-sha-bg: rgba(33, 186, 69, .1);
--color-green-sha-hover: rgba(33, 186, 69, .3);
Copy link
Member

Choose a reason for hiding this comment

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

  1. Could you convert to #rrggbbaa syntax? Just for consistency basically.
  2. Can we use error (red), warning (orange), info (blue) and success (green) states please?
  3. Based on previous point, please remove color names from these variable names, e.g. --color-red-err-bg -> --color-error-bg, --color-green-ok-bg -> --color-success-bg.

}
}
}

Copy link
Member

Choose a reason for hiding this comment

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

Can we maybe not use nested syntax to override fomantic? I prefer plain selectors in this case because it's easiert to search exact selector strings in fomantic source and just copy from there. Nested syntax would break this searching.

.octicon-tiny > .svg {
margin-top: -2px;
margin-bottom: -2px;
vertical-align: -2px;
}
Copy link
Member

@silverwind silverwind Apr 9, 2021

Choose a reason for hiding this comment

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

This is only used in two places, suggest to remove the class and use helper classes if possible. Also, the previous font-size does nothing on SVG.

text-align: center;
.sha.mono {
font-size: 1em !important;
width: calc(9ch + 82px); // 60px + 11px * 2
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need explicit width on this? I prefer to avoid that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is necessary since the table is fixed, i. e. the width of the columns are have predefined starting values (can be incremented but not decreased). I basically copied the logic from the commits table to the repo file table for consistency.

Copy link
Member

Choose a reason for hiding this comment

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

So essentially you are stretching the column with this width? Can we be sure it will not cut off for example if we add more content in the hash label?

Can you maybe convert to min-width?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So essentially you are stretching the column with this width? Can we be sure it will not cut off for example if we add more content in the hash label?

I'm pretty sure it will cut off if more content is added.

Can you maybe convert to min-width?

It won't work. If I recall correctly, when the width of a fixed table decreases, only explicit width (either as percentage in explicit numbers) could have an effect on column widths. No actual content width would be taken in to consideration. It's common practice though and ensures the fastest layout possible for large tables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To make it clear again: the commits table has always been fixed, and there wasn't any measure taken to ensure that the SHA label would fit (the Fomantic UI classes define the percentage width of the columns, just like the flex-based grid (but does not support that many layout strategies). It basically gives up at lower resolution and wraps the table in three rows - that design may find its use elsewhere, but the UE is awful in this case. I thus use media queries to hide the less-important elements explicitly, but otherwise keep the design same as before (it has the advantage of always getting the overflow-text: ellipsis right for commit messages embedded in flexboxes, so I also ported that to the repo file table by using a complex table header with a zero-height borderless top row, used just to set the width of the columns - I'm yet to find anything more elegant than that based on what's already there).

Ideally, we could copy GitHub's idea of using a bunch of nested flexboxes (with helper classes based on media queries) given their versatility, but those are pretty hard to tame...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, thanks for all the reviews. I've read all of them and have them on my checklist. Have other things to do...

padding-bottom: 3px;
}
display: flex;
height: 21.6px; // 14px + 2.8px * 2 + 1px * 2
Copy link
Member

Choose a reason for hiding this comment

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

Same question here, would like to avoid any explicit dimensions.

--color-yellow-sha-bg: rgba(251, 189, 8, .1);
--color-yellow-sha-hover: rgba(251, 189, 8, .3);
--color-green-sha-bg: rgba(33, 186, 69, .1);
--color-green-sha-hover: rgba(33, 186, 69, .3);
Copy link
Member

@silverwind silverwind Apr 9, 2021

Choose a reason for hiding this comment

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

Please copy the remaining vars from _base.less in here as well, I'd prefer this list to stay in sync, even if colors are the same.

border-color: #393d4a;
color: #dbdbdb;
}

.repository .ui.attached.message.isSigned.isVerified {
background-color: #394829;
color: var(--color-secondary-dark-6);
Copy link
Member

Choose a reason for hiding this comment

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

There might be more rules to remove in theme-arc-green.less for the SHA labels, please verify.

@zeripath zeripath modified the milestones: 1.15.0, 1.16.0 Jun 23, 2021
@lunny
Copy link
Member

lunny commented Nov 9, 2021

Please resolve the conflicts.

@stale
Copy link

stale bot commented May 2, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label May 2, 2022
@lunny
Copy link
Member

lunny commented May 2, 2022

If no one could pick up this one. I think we have to close it.

@stale stale bot removed the issue/stale label May 2, 2022
@wxiaoguang
Copy link
Contributor

It's a pity that this PR stales for so long time and can not be merged. Thank you, CL-Jeremy (I saw a lot of UI work from you before 👍)

Fortunately, a lot of problems has been resolved by some recent PRs separately.

I agree it's the time to close this one (if still no new progress) and move on to open new PRs to make UI better.

@6543
Copy link
Member

6543 commented May 7, 2022

oh no @CL-Jeremy it got some conflicts - do you need help resolving them - just ask :)

@wxiaoguang
Copy link
Contributor

OK, let me be the bad guy to close this PR, since it has been stale for quite a long time .... and a lot of problems has been resolved by some recent PRs separately.

Feel free to reopen it or pick it as a new one. 🙏

@wxiaoguang wxiaoguang closed this May 25, 2022
@wxiaoguang wxiaoguang removed this from the 1.17.0 milestone May 25, 2022
@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/need 2 This PR needs two approvals by maintainers to be considered for merging. topic/mobile topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UI] Bug on Fille List / View if commit message is to long