File tree Expand file tree Collapse file tree
apps/web/src/lib/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 ;
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 {
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 >
Original file line number Diff line number Diff line change 11<script lang =" ts" >
2- import { onMount } from ' svelte ' ;
2+
33 let {
44 title,
55 value,
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 >
You can’t perform that action at this time.
0 commit comments