diff options
author | wxiaoguang | 2023-02-21 21:36:53 +0800 |
---|---|---|
committer | GitHub | 2023-02-21 21:36:53 +0800 |
commit | 1fcf96ad0166420cbdb013365ecae42e3537b42a (patch) | |
tree | 98ffceb52a082da7985f97dee42462a1805898f3 /templates | |
parent | 9ebf6424eedce94b1f5ab3ff34b41198e51e36f8 (diff) |
Improve PR Review Box UI (#22986)
This PR follows:
* #22950
### Before
The Review Box has many problems:
* It doesn't work for small screens.
* It has an anonying animation which makes the UI laggy.
* It uses "custom dropdown menu" which is very difficult to fine tune.
* `$().toggle('visible')` is not a correct call
* jQuery just accepts any invalid `duration` argument:
`$().toggle('anyting')`
* The button is not a button.
<details>
![image](https://user-images.githubusercontent.com/2114189/219948865-6da3f39c-6fde-4c86-9e42-da5020f3d0c3.png)
</details>
### After
These problems are fixed, and eliminate many `!important` games.
<details>
![image](https://user-images.githubusercontent.com/2114189/219952744-8862fe1a-7ef1-49e4-bf92-2d0c1f104ee4.png)
![image](https://user-images.githubusercontent.com/2114189/219952771-be169a76-45fd-47a8-8f9c-b447d064f4ca.png)
![image](https://user-images.githubusercontent.com/2114189/219952784-3f52e9b7-64ce-4ad1-9553-64c33fb83042.png)
</details>
And most dropdown icons still looks good:
<details>
![image](https://user-images.githubusercontent.com/2114189/219952942-52866a00-e0f9-4af7-8fb5-eb1a8cad1ff3.png)
![image](https://user-images.githubusercontent.com/2114189/219948909-b3bfb844-f84e-4b79-ab1f-382ec66dec31.png)
</details>
Co-authored-by: delvh <leon@kske.dev>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/diff/box.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/diff/new_review.tmpl | 10 | ||||
-rw-r--r-- | templates/repo/home.tmpl | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 1e7982435..4e6879650 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -24,10 +24,10 @@ {{svg "octicon-diff" 16 "gt-mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} </div> </div> - <div class="diff-detail-actions gt-df gt-ac"> + <div class="diff-detail-actions gt-df gt-ac gt-w-100"> {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}} <progress id="viewed-files-summary" class="gt-mr-2" value="{{.Diff.NumViewedFiles}}" max="{{.Diff.NumFiles}}"></progress> - <label for="viewed-files-summary" id="viewed-files-summary-label" class="gt-mr-3" data-text-changed-template="{{.locale.Tr "repo.pulls.viewed_files_label"}}"> + <label for="viewed-files-summary" id="viewed-files-summary-label" class="gt-mr-3 gt-f1" data-text-changed-template="{{.locale.Tr "repo.pulls.viewed_files_label"}}"> {{.locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .Diff.NumFiles}} </label> {{end}} diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl index 8586cd6a5..52aff10e2 100644 --- a/templates/repo/diff/new_review.tmpl +++ b/templates/repo/diff/new_review.tmpl @@ -1,11 +1,11 @@ -<div class="ui top right pointing dropdown custom" id="review-box"> - <div class="ui tiny green button btn-review gt-ml-2 gt-mr-0"> +<div id="review-box"> + <button class="ui tiny green button gt-ml-2 gt-mr-0 js-btn-review"> {{.locale.Tr "repo.diff.review"}} <span class="ui small label review-comments-counter" data-pending-comment-number="{{.PendingCodeCommentNumber}}">{{.PendingCodeCommentNumber}}</span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} - </div> - <div class="menu review-box"> - <div class="ui clearing segment"> + </button> + <div class="review-box-panel gt-hidden"> + <div class="ui segment"> <form class="ui form" action="{{.Link}}/reviews/submit" method="post"> {{.CsrfTokenHtml}} <input type="hidden" name="commit_id" value="{{.AfterCommitID}}"/> diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 075b859a0..2a79c51dd 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -77,7 +77,7 @@ <a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{.locale.Tr "repo.find_file.go_to_file"}}</a> {{end}} {{if or .CanAddFile .CanUploadFile}} - <button class="ui basic small compact dropdown jump icon button gt-mr-2"{{if not .Repository.CanEnableEditor}} disabled{{end}}> + <button class="ui basic compact dropdown jump icon button gt-mr-2"{{if not .Repository.CanEnableEditor}} disabled{{end}}> <span class="text">{{.locale.Tr "repo.editor.add_file"}}</span> <div class="menu"> {{if .CanAddFile}} |