Skip to content

Commit 7b2da0c

Browse files
Bhuvanesh SBhuvanesh S
authored andcommitted
fix: address PR feedback for heatmap and widget components
Signed-off-by: Bhuvanesh S <YOUR_GITHUB_EMAIL>
1 parent 94b149d commit 7b2da0c

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

apps/web/src/lib/components/ActivityHeatmap.svelte

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
1111
onMount(() => {
1212
const today = new Date();
13+
const generatedData = [];
1314
for (let w = 0; w < weeks; w++) {
1415
let weekData = [];
1516
for (let d = 0; d < daysPerWeek; d++) {
1617
const date = new Date(today);
1718
date.setDate(date.getDate() - ((weeks - 1 - w) * 7 + (6 - d)));
18-
// Random intensity between 0 and 4, weighted towards 0
1919
const random = Math.random();
2020
let intensity = 0;
2121
if (random > 0.85) intensity = 4;
@@ -25,9 +25,9 @@
2525
2626
weekData.push({ intensity, date });
2727
}
28-
heatmapData.push(weekData);
28+
generatedData.push(weekData);
2929
}
30-
heatmapData = heatmapData; // trigger reactivity
30+
heatmapData = generatedData;
3131
});
3232
3333
function getIntensityColor(intensity: number): string {
@@ -56,6 +56,9 @@
5656
{#each week as day, dIndex}
5757
<div
5858
class="day"
59+
role="button"
60+
aria-label="Contribution activity on {day.date.toDateString()}"
61+
tabindex="0"
5962
style="background-color: {getIntensityColor(day.intensity)};"
6063
title="{day.date.toDateString()}: {day.intensity * 3} contributions"
6164
></div>

apps/web/src/lib/components/AnalyticsWidget.svelte

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { onMount } from 'svelte';
2+
33
let {
44
title,
55
value,
@@ -13,11 +13,9 @@
1313
isPositive?: boolean;
1414
icon?: string;
1515
}>();
16-
17-
let widgetRef: HTMLDivElement;
1816
</script>
1917

20-
<div class="analytics-widget glass" bind:this={widgetRef}>
18+
<div class="analytics-widget glass">
2119
<div class="widget-header">
2220
<div class="icon-wrapper">
2321
<span class="icon">{icon}</span>

0 commit comments

Comments
 (0)