Skip to content

Commit 9b6d064

Browse files
committed
Contribution heatmap improvements
1 parent 23a37b4 commit 9b6d064

File tree

4 files changed

+21
-34
lines changed

4 files changed

+21
-34
lines changed

web_src/css/features/heatmap.css

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,28 @@
44
position: relative;
55
}
66

7-
/* before the Vue component is mounted, show a loading indicator with dummy size */
8-
/* the ratio is guesswork, see https://github.com/razorness/vue3-calendar-heatmap/issues/26 */
9-
#user-heatmap.is-loading {
10-
aspect-ratio: 5.415; /* the size is about 790 x 145 */
11-
}
12-
.user.profile #user-heatmap.is-loading {
13-
aspect-ratio: 5.645; /* the size is about 953 x 169 */
7+
@container (width > 0) {
8+
#user-heatmap {
9+
/* Set element to fixed size so that it does not resize after load. The calculation is complex
10+
because the element does not scale with a fixed aspect ratio. */
11+
height: calc((100cqw / 5) - (100cqw / 25) + 20px);
12+
}
1413
}
1514

1615
#user-heatmap text {
1716
fill: currentcolor !important;
1817
}
1918

19+
/* root legend */
20+
#user-heatmap .vch__container > .vch__legend {
21+
display: flex;
22+
font-size: 11px;
23+
justify-content: space-between;
24+
}
25+
2026
/* for the "Less" and "More" legend */
2127
#user-heatmap .vch__legend .vch__legend {
2228
display: flex;
23-
font-size: 11px;
2429
align-items: center;
2530
justify-content: right;
2631
}
@@ -34,25 +39,3 @@
3439
#user-heatmap .vch__day__square:hover {
3540
outline: 1.5px solid var(--color-text);
3641
}
37-
38-
/* move the "? contributions in the last ? months" text from top to bottom */
39-
#user-heatmap .total-contributions {
40-
font-size: 11px;
41-
position: absolute;
42-
bottom: 0;
43-
left: 25px;
44-
}
45-
46-
@media (max-width: 1200px) {
47-
#user-heatmap .total-contributions {
48-
left: 21px;
49-
}
50-
}
51-
52-
@media (max-width: 1000px) {
53-
#user-heatmap .total-contributions {
54-
font-size: 10px;
55-
left: 17px;
56-
bottom: -4px;
57-
}
58-
}

web_src/css/modules/flexcontainer.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
.flex-container-main {
2020
flex: 1;
2121
min-width: 0; /* make the "text truncate" work, otherwise the flex axis is not limited and the text just overflows */
22+
container: main / inline-size;
2223
}
2324

2425
@media (max-width: 767.98px) {

web_src/css/modules/grid.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@
135135
}
136136
}
137137

138+
.ui.grid .column {
139+
container: column / inline-size;
140+
}
141+
138142
.ui.grid > .column:only-child,
139143
.ui.grid > .row > .column:only-child {
140144
width: 100%;

web_src/js/components/ActivityHeatmap.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ function handleDayClick(e: Event & {date: Date}) {
5353
}
5454
</script>
5555
<template>
56-
<div class="total-contributions">
57-
{{ locale.textTotalContributions }}
58-
</div>
5956
<calendar-heatmap
6057
:locale="locale.heatMapLocale"
6158
:no-data-text="locale.noDataText"
@@ -65,5 +62,7 @@ function handleDayClick(e: Event & {date: Date}) {
6562
:range-color="colorRange"
6663
@day-click="handleDayClick($event)"
6764
:tippy-props="{theme: 'tooltip'}"
68-
/>
65+
>
66+
<template #vch__legend-left>{{ locale.textTotalContributions }}</template>
67+
</calendar-heatmap>
6968
</template>

0 commit comments

Comments
 (0)