Skip to content

Commit eb8bb82

Browse files
Fix activity heat map padding & locale (#30823)
Fix #30808 --------- Co-authored-by: silverwind <me@silverwind.io>
1 parent 6ff2acc commit eb8bb82

File tree

4 files changed

+31
-26
lines changed

4 files changed

+31
-26
lines changed

package-lock.json

+13-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@github/text-expander-element": "2.6.1",
1414
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
1515
"@primer/octicons": "19.9.0",
16+
"@silverwind/vue3-calendar-heatmap": "2.0.6",
1617
"add-asset-webpack-plugin": "2.0.1",
1718
"ansi_up": "6.0.2",
1819
"asciinema-player": "3.7.1",
@@ -56,7 +57,6 @@
5657
"vue-bar-graph": "2.0.0",
5758
"vue-chartjs": "5.3.1",
5859
"vue-loader": "17.4.2",
59-
"vue3-calendar-heatmap": "2.0.5",
6060
"webpack": "5.91.0",
6161
"webpack-cli": "5.1.4",
6262
"wrap-ansi": "9.0.0"

web_src/js/components/ActivityHeatmap.vue

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script>
2-
import {CalendarHeatmap} from 'vue3-calendar-heatmap';
2+
// TODO: Switch to upstream after https://github.com/razorness/vue3-calendar-heatmap/pull/34 is merged
3+
import {CalendarHeatmap} from '@silverwind/vue3-calendar-heatmap';
34
45
export default {
56
components: {CalendarHeatmap},
@@ -55,15 +56,16 @@ export default {
5556
</script>
5657
<template>
5758
<div class="total-contributions">
58-
{{ locale.contributions_in_the_last_12_months }}
59+
{{ locale.textTotalContributions }}
5960
</div>
6061
<calendar-heatmap
61-
:locale="locale"
62-
:no-data-text="locale.no_contributions"
63-
:tooltip-unit="locale.contributions"
62+
:locale="locale.heatMapLocale"
63+
:no-data-text="locale.noDataText"
64+
:tooltip-unit="locale.tooltipUnit"
6465
:end-date="endDate"
6566
:values="values"
6667
:range-color="colorRange"
6768
@day-click="handleDayClick($event)"
69+
:tippy-props="{theme: 'tooltip'}"
6870
/>
6971
</template>

web_src/js/features/heatmap.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ export function initHeatmap() {
2020

2121
// last heatmap tooltip localization attempt https://github.com/go-gitea/gitea/pull/24131/commits/a83761cbbae3c2e3b4bced71e680f44432073ac8
2222
const locale = {
23-
months: new Array(12).fill().map((_, idx) => translateMonth(idx)),
24-
days: new Array(7).fill().map((_, idx) => translateDay(idx)),
25-
contributions: 'contributions',
26-
contributions_in_the_last_12_months: el.getAttribute('data-locale-total-contributions'),
27-
no_contributions: el.getAttribute('data-locale-no-contributions'),
28-
more: el.getAttribute('data-locale-more'),
29-
less: el.getAttribute('data-locale-less'),
23+
heatMapLocale: {
24+
months: new Array(12).fill().map((_, idx) => translateMonth(idx)),
25+
days: new Array(7).fill().map((_, idx) => translateDay(idx)),
26+
on: ' - ', // no correct locale support for it, because in many languages the sentence is not "something on someday"
27+
more: el.getAttribute('data-locale-more'),
28+
less: el.getAttribute('data-locale-less'),
29+
},
30+
tooltipUnit: 'contributions',
31+
textTotalContributions: el.getAttribute('data-locale-total-contributions'),
32+
noDataText: el.getAttribute('data-locale-no-contributions'),
3033
};
3134

3235
const View = createApp(ActivityHeatmap, {values, locale});

0 commit comments

Comments
 (0)