diff --git a/ui/src/components/ContributionGraph.tsx b/ui/src/components/ContributionGraph.tsx
index c70482e..44763ce 100644
--- a/ui/src/components/ContributionGraph.tsx
+++ b/ui/src/components/ContributionGraph.tsx
@@ -2,12 +2,12 @@ import { useMemo } from 'react';
import { useQuery } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
-import { fetchDailyCounts } from '../api/client';
+import { fetchDailyCounts, fetchSources } from '../api/client';
const CELL_SIZE = 12;
const GAP = 3;
const RADIUS = CELL_SIZE / 2;
-const ROWS = 7; // days per week
+const ROWS = 7;
const LEFT_LABEL_WIDTH = 28;
const TOP_LABEL_HEIGHT = 16;
@@ -15,13 +15,14 @@ const DAY_LABELS = ['', 'mon', '', 'wed', '', 'fri', ''];
const MONTH_LABELS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
const COLORS = [
- 'rgba(255,255,255,0.05)', // 0: empty
- '#0e4429', // 1: low
- '#006d32', // 2: medium-low
- '#26a641', // 3: medium
- '#39d353', // 4: high
+ 'rgba(255,255,255,0.05)',
+ '#0e4429',
+ '#006d32',
+ '#26a641',
+ '#39d353',
];
+/** Daily contribution graph — last 1 year, one circle per day. */
export function ContributionGraph() {
const to = new Date();
const from = new Date(to);
@@ -42,7 +43,6 @@ export function ContributionGraph() {
const counts = dailyQ.data ?? [];
const countMap = new Map(counts.map((d) => [d.date, d.count]));
- // Start from the Sunday before `from`
const start = new Date(from);
start.setDate(start.getDate() - start.getDay());
@@ -58,8 +58,6 @@ export function ContributionGraph() {
const dateStr = fmt(cursor);
const count = countMap.get(dateStr) ?? 0;
week.push({ date: dateStr, count, col, row });
-
- // Track month transitions (on the first day of each week)
if (row === 0) {
const m = cursor.getMonth();
if (m !== prevMonth) {
@@ -73,7 +71,6 @@ export function ContributionGraph() {
col++;
}
- // Compute quantile thresholds from non-zero counts
const nonZero = counts.map((d) => d.count).filter((c) => c > 0).sort((a, b) => a - b);
const thresholds = computeThresholds(nonZero);
const totalCount = counts.reduce((sum, d) => sum + d.count, 0);
@@ -89,13 +86,12 @@ export function ContributionGraph() {
if (dailyQ.isError) return null;
return (
-
+
{totalCount} contributions in the last year