From bcf658bcaa6a123efe31ddfe7459b34a69d9f2a6 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 May 2024 19:38:59 +0800 Subject: [PATCH 1/9] fix --- web_src/js/components/ActivityHeatmap.vue | 18 ++++++++++++++---- web_src/js/features/heatmap.js | 17 ++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index 9592a0df3c520..b07a692667bd4 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -55,15 +55,25 @@ export default { + diff --git a/web_src/js/features/heatmap.js b/web_src/js/features/heatmap.js index b6f06d0cfb08f..753a923361c3e 100644 --- a/web_src/js/features/heatmap.js +++ b/web_src/js/features/heatmap.js @@ -20,13 +20,16 @@ export function initHeatmap() { // last heatmap tooltip localization attempt https://github.com/go-gitea/gitea/pull/24131/commits/a83761cbbae3c2e3b4bced71e680f44432073ac8 const locale = { - months: new Array(12).fill().map((_, idx) => translateMonth(idx)), - days: new Array(7).fill().map((_, idx) => translateDay(idx)), - contributions: 'contributions', - contributions_in_the_last_12_months: el.getAttribute('data-locale-total-contributions'), - no_contributions: el.getAttribute('data-locale-no-contributions'), - more: el.getAttribute('data-locale-more'), - less: el.getAttribute('data-locale-less'), + heatMapLocale: { + months: new Array(12).fill().map((_, idx) => translateMonth(idx)), + days: new Array(7).fill().map((_, idx) => translateDay(idx)), + on: 'on', + more: el.getAttribute('data-locale-more'), + less: el.getAttribute('data-locale-less'), + }, + tooltipUnit: 'contributions', + textTotalContributions: el.getAttribute('data-locale-total-contributions'), + noDataText: el.getAttribute('data-locale-no-contributions'), }; const View = createApp(ActivityHeatmap, {values, locale}); From 867662a5ff8f4a5bc9d4f03e456d3c39fc91c19d Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 May 2024 20:14:38 +0800 Subject: [PATCH 2/9] fix styles --- web_src/js/components/ActivityHeatmap.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index b07a692667bd4..d7eaed403b8c3 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -68,12 +68,16 @@ export default { /> From 83ab83bc57774b0d21edb308234dc1f86d248180 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 May 2024 20:15:47 +0800 Subject: [PATCH 3/9] add border radius --- web_src/js/components/ActivityHeatmap.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index d7eaed403b8c3..9aec05b608b90 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -79,5 +79,6 @@ This selector should be replaced by a more specific one if the library adds a CS background-color: var(--color-tooltip-bg); color: var(--color-tooltip-text); border: none; + border-radius: var(--border-radius); } From fbb75990f00d1aad8894e0bda392850b1539f60a Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 May 2024 20:19:49 +0800 Subject: [PATCH 4/9] do not use "on" because it is untranslatable. --- web_src/js/features/heatmap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/heatmap.js b/web_src/js/features/heatmap.js index 753a923361c3e..719eeb75fb567 100644 --- a/web_src/js/features/heatmap.js +++ b/web_src/js/features/heatmap.js @@ -23,7 +23,7 @@ export function initHeatmap() { heatMapLocale: { months: new Array(12).fill().map((_, idx) => translateMonth(idx)), days: new Array(7).fill().map((_, idx) => translateDay(idx)), - on: 'on', + on: ' - ', // no correct locale support for it, because in many languages the sentence is not "something on someday" more: el.getAttribute('data-locale-more'), less: el.getAttribute('data-locale-less'), }, From d6c81ba5f064593b2ecc711d9ed5a7bf2c2b0acd Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 May 2024 20:35:41 +0800 Subject: [PATCH 5/9] fix border style --- web_src/js/components/ActivityHeatmap.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index 9aec05b608b90..0ebc7c950355a 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -73,12 +73,15 @@ At the moment we could only identify the tooltip by its transition property. https://github.com/razorness/vue3-calendar-heatmap/blob/955626176cb5dc3d3ead8120475c2e5e753cc392/src/components/CalendarHeatmap.vue#L202 This selector should be replaced by a more specific one if the library adds a CSS class. */ +[data-tippy-root][style*="transition: transform 0.1s ease-out"] .tippy-box { + border: none; +} +/* some styles are put on the tippy-content intentionally, otherwise there will be strange animations */ [data-tippy-root][style*="transition: transform 0.1s ease-out"] .tippy-box .tippy-content { transition: none !important; padding: 0.5rem 1rem; background-color: var(--color-tooltip-bg); color: var(--color-tooltip-text); - border: none; border-radius: var(--border-radius); } From ca4844a3e71b3d02a89804c1c086aa56a1df5567 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 May 2024 20:57:50 +0800 Subject: [PATCH 6/9] Update web_src/js/components/ActivityHeatmap.vue Co-authored-by: silverwind --- web_src/js/components/ActivityHeatmap.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index 0ebc7c950355a..cf475abe069f0 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -72,6 +72,7 @@ export default { At the moment we could only identify the tooltip by its transition property. https://github.com/razorness/vue3-calendar-heatmap/blob/955626176cb5dc3d3ead8120475c2e5e753cc392/src/components/CalendarHeatmap.vue#L202 This selector should be replaced by a more specific one if the library adds a CSS class. +TODO: Remove this after https://github.com/razorness/vue3-calendar-heatmap/pull/34 is merged and released. */ [data-tippy-root][style*="transition: transform 0.1s ease-out"] .tippy-box { border: none; From a33947780bc0bcabbce7388cb542bd3c51bb8271 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 May 2024 21:04:49 +0800 Subject: [PATCH 7/9] add more comments --- web_src/js/components/ActivityHeatmap.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index cf475abe069f0..5de6b8f1ef829 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -72,7 +72,8 @@ export default { At the moment we could only identify the tooltip by its transition property. https://github.com/razorness/vue3-calendar-heatmap/blob/955626176cb5dc3d3ead8120475c2e5e753cc392/src/components/CalendarHeatmap.vue#L202 This selector should be replaced by a more specific one if the library adds a CSS class. -TODO: Remove this after https://github.com/razorness/vue3-calendar-heatmap/pull/34 is merged and released. +TODO: Remove this after https://github.com/razorness/vue3-calendar-heatmap/pull/34 is merged and released, +and then all styles could be merged into `.tippy-box` selector. */ [data-tippy-root][style*="transition: transform 0.1s ease-out"] .tippy-box { border: none; From d2bafe2d2d06e7a01390ba451e7a61fbebc0475c Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 2 May 2024 21:10:02 +0800 Subject: [PATCH 8/9] use .tippy-box:not([data-theme]) --- web_src/js/components/ActivityHeatmap.vue | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index 5de6b8f1ef829..ebf0b95d4a87f 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -68,19 +68,14 @@ export default { />