From 3763c2ae28ebfa539cefb7ce0830cf5ee6c6f1df Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 8 Jul 2025 16:59:31 +0800 Subject: [PATCH] Refactor time tracker UI (#34983) Although we decided to "reduce the button amount" on the side bar, not only one user reported that the "time tracker dropdown" is not easy to use. So the best we can do at the moment is: move the buttons to the sidebar again. Fix #34979 --- templates/devtest/fomantic-modal.tmpl | 16 ++-- templates/devtest/gitea-ui.tmpl | 14 ++-- .../issue/sidebar/stopwatch_timetracker.tmpl | 77 ++++++++----------- web_src/css/modules/button.css | 2 +- web_src/js/index-domready.ts | 2 + web_src/js/standalone/devtest.ts | 1 + 6 files changed, 54 insertions(+), 58 deletions(-) diff --git a/templates/devtest/fomantic-modal.tmpl b/templates/devtest/fomantic-modal.tmpl index 838c6893a4..8e769790b2 100644 --- a/templates/devtest/fomantic-modal.tmpl +++ b/templates/devtest/fomantic-modal.tmpl @@ -2,13 +2,15 @@
{{template "base/alert" .}} - -
diff --git a/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl index ab8600b068..6168b06e17 100644 --- a/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl +++ b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl @@ -2,35 +2,28 @@ {{if and .CanUseTimetracker (not .Repository.IsArchived)}}
- {{end}} {{if .WorkingUsers}} -
+
{{ctx.Locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Hour)}} -
- {{range $user, $trackedtime := .WorkingUsers}} -
- - {{ctx.AvatarUtils.Avatar $user}} - -
- {{template "shared/user/authorlink" $user}} -
- {{$trackedtime|Sec2Hour}} -
-
+
+
+ {{range $user, $trackedtime := .WorkingUsers}} +
+ {{template "shared/user/avatarlink" dict "user" $user}} +
+ {{template "shared/user/authorlink" $user}} +
{{$trackedtime|Sec2Hour}}
- {{end}} -
+
+ {{end}}
{{end}} {{end}} diff --git a/web_src/css/modules/button.css b/web_src/css/modules/button.css index b105bb5de2..8e3309474b 100644 --- a/web_src/css/modules/button.css +++ b/web_src/css/modules/button.css @@ -366,8 +366,8 @@ It needs some tricks to tweak the left/right borders with active state */ .ui.buttons .button { border-right: none; - flex: 1 0 auto; border-radius: 0; + flex-shrink: 0; margin: 0; } .ui.buttons .button:first-child { diff --git a/web_src/js/index-domready.ts b/web_src/js/index-domready.ts index 4d7ab98db0..ca18d1e828 100644 --- a/web_src/js/index-domready.ts +++ b/web_src/js/index-domready.ts @@ -175,3 +175,5 @@ const initDur = performance.now() - initStartTime; if (initDur > 500) { console.error(`slow init functions took ${initDur.toFixed(3)}ms`); } + +document.dispatchEvent(new CustomEvent('gitea:index-ready')); diff --git a/web_src/js/standalone/devtest.ts b/web_src/js/standalone/devtest.ts index e6baf6c9ce..faa38dc467 100644 --- a/web_src/js/standalone/devtest.ts +++ b/web_src/js/standalone/devtest.ts @@ -11,4 +11,5 @@ function initDevtestToast() { } } +// NOTICE: keep in mind that this file is not in "index.js", they do not share the same module system. initDevtestToast();