From 595e8abd686c7d555ff94668fb46604b92025956 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 28 May 2023 03:34:18 +0200 Subject: [PATCH] Improve and fix bugs surrounding reactions (#24760) - Slightly decrease size of reaction buttons - Remove tooltip inside menu, it's obvious by the picture alone - Fix top menu triangle - Use `display: grid` to align icons in menu - Use regular tooltip for reaction users - Fix bug that deleted the reaction bar on clicking already reacted reaction in dropdown Screenshot 2023-05-17 at 00 03 42 Screenshot 2023-05-17 at 00 11 14 Screenshot 2023-05-17 at 00 29 30 Screenshot 2023-05-17 at 00 29 54 Screenshot 2023-05-17 at 00 12 20 --------- Co-authored-by: wxiaoguang Co-authored-by: Giteabot --- options/locale/locale_en-US.ini | 1 - templates/repo/diff/comments.tmpl | 6 +- templates/repo/issue/view_content.tmpl | 8 +- .../repo/issue/view_content/add_reaction.tmpl | 8 +- .../repo/issue/view_content/comments.tmpl | 12 +-- .../repo/issue/view_content/context_menu.tmpl | 2 +- .../repo/issue/view_content/reactions.tmpl | 8 +- web_src/css/base.css | 19 ++++- web_src/css/repo.css | 69 ++++++++--------- web_src/css/themes/theme-arc-green.css | 7 +- web_src/js/features/comp/ReactionSelector.js | 75 +++++++++---------- web_src/js/features/repo-code.js | 4 +- web_src/js/features/repo-issue-content.js | 2 +- web_src/js/features/repo-legacy.js | 2 +- web_src/js/modules/tippy.js | 7 ++ 15 files changed, 117 insertions(+), 113 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 1026a13e3..16dbb0948 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -965,7 +965,6 @@ mirror_password_help = Change the username to erase a stored password. watchers = Watchers stargazers = Stargazers forks = Forks -pick_reaction = Pick your reaction reactions_more = and %d more unit_disabled = The site administrator has disabled this repository section. language_other = Other diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 50f0c903a..5b0b32cc9 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -15,7 +15,7 @@ {{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}} {{.OriginalAuthor}} - + {{$.root.locale.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}} @@ -24,7 +24,7 @@ {{end}} {{else}} - + {{template "shared/user/namelink" .Poster}} {{$.root.locale.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}} @@ -59,9 +59,7 @@ {{$reactions := .Reactions.GroupByType}} {{if $reactions}} -
{{template "repo/issue/view_content/reactions" dict "ctxData" $.root "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}} -
{{end}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 3c60eca67..77087e0a8 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -27,7 +27,7 @@ {{svg (MigrationIcon .Repository.GetOriginalURLHostname)}} {{.Issue.OriginalAuthor}}
- + {{.locale.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe}} @@ -37,7 +37,7 @@ {{avatar $.Context .Issue.Poster 24}} - + {{template "shared/user/authorlink" .Issue.Poster}} {{.locale.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe}} @@ -78,9 +78,7 @@ {{$reactions := .Issue.Reactions.GroupByType}} {{if $reactions}} -
- {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}} -
+ {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}} {{end}} diff --git a/templates/repo/issue/view_content/add_reaction.tmpl b/templates/repo/issue/view_content/add_reaction.tmpl index 1a908f1aa..37931f287 100644 --- a/templates/repo/issue/view_content/add_reaction.tmpl +++ b/templates/repo/issue/view_content/add_reaction.tmpl @@ -1,13 +1,11 @@ {{if .ctxData.IsSigned}} {{$reactions := .Reactions.GroupByType}} {{if $reactions}} -
- {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} -
+ {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} {{end}} @@ -471,9 +469,7 @@ {{$reactions := .Reactions.GroupByType}} {{if $reactions}} -
- {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} -
+ {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} {{end}} @@ -595,9 +591,7 @@ {{$reactions := .Reactions.GroupByType}} {{if $reactions}} -
- {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} -
+ {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} {{end}} diff --git a/templates/repo/issue/view_content/context_menu.tmpl b/templates/repo/issue/view_content/context_menu.tmpl index aa9d52b67..296668c9e 100644 --- a/templates/repo/issue/view_content/context_menu.tmpl +++ b/templates/repo/issue/view_content/context_menu.tmpl @@ -1,6 +1,6 @@ {{if .ctxData.IsSigned}}