github-contributions-ui 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.mjs → index.cjs} +91 -58
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +200 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +63 -84
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -0
- package/package.json +35 -11
- package/readme.md +14 -0
- package/dist/index.mjs.map +0 -1
- /package/dist/{index.d.mts → index.d.cts} +0 -0
|
@@ -1,6 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
GithubActivity: () => GithubActivity_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
1
27
|
// src/GithubActivity.tsx
|
|
2
|
-
|
|
3
|
-
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
4
30
|
var MONTHS = [
|
|
5
31
|
"Jan",
|
|
6
32
|
"Feb",
|
|
@@ -38,6 +64,7 @@ function toLevel(count) {
|
|
|
38
64
|
return 4;
|
|
39
65
|
}
|
|
40
66
|
function buildGrid(dayMap, year) {
|
|
67
|
+
var _a;
|
|
41
68
|
let start;
|
|
42
69
|
let end;
|
|
43
70
|
if (year === "last") {
|
|
@@ -60,7 +87,7 @@ function buildGrid(dayMap, year) {
|
|
|
60
87
|
week.push(null);
|
|
61
88
|
} else {
|
|
62
89
|
week.push(
|
|
63
|
-
dayMap.get(iso)
|
|
90
|
+
(_a = dayMap.get(iso)) != null ? _a : {
|
|
64
91
|
date: iso,
|
|
65
92
|
count: 0,
|
|
66
93
|
level: 0
|
|
@@ -94,13 +121,13 @@ function Tooltip({ day, x, y }) {
|
|
|
94
121
|
month: "long",
|
|
95
122
|
day: "numeric"
|
|
96
123
|
});
|
|
97
|
-
return /* @__PURE__ */ jsxs(
|
|
124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
98
125
|
"div",
|
|
99
126
|
{
|
|
100
127
|
className: "fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white dark:bg-white dark:text-neutral-900",
|
|
101
128
|
style: { left: x, top: y - 8 },
|
|
102
129
|
children: [
|
|
103
|
-
/* @__PURE__ */ jsxs("b", { children: [
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("b", { children: [
|
|
104
131
|
day.count,
|
|
105
132
|
" contribution",
|
|
106
133
|
day.count !== 1 ? "s" : ""
|
|
@@ -113,7 +140,7 @@ function Tooltip({ day, x, y }) {
|
|
|
113
140
|
);
|
|
114
141
|
}
|
|
115
142
|
function Skeleton() {
|
|
116
|
-
return /* @__PURE__ */ jsx("div", { className: "flex gap-[3px] animate-pulse opacity-40", children: Array.from({ length: 53 }).map((_, w) => /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-[3px]", children: Array.from({ length: 7 }).map((_2, d) => /* @__PURE__ */ jsx(
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex gap-[3px] animate-pulse opacity-40", children: Array.from({ length: 53 }).map((_, w) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-[3px]", children: Array.from({ length: 7 }).map((_2, d) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
144
|
"div",
|
|
118
145
|
{
|
|
119
146
|
className: "w-[13px] h-[13px] rounded-[3px] bg-neutral-300 dark:bg-neutral-700"
|
|
@@ -126,7 +153,7 @@ function YearPill({
|
|
|
126
153
|
active,
|
|
127
154
|
onClick
|
|
128
155
|
}) {
|
|
129
|
-
return /* @__PURE__ */ jsx(
|
|
156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
157
|
"button",
|
|
131
158
|
{
|
|
132
159
|
onClick,
|
|
@@ -139,30 +166,32 @@ function YearPill({
|
|
|
139
166
|
);
|
|
140
167
|
}
|
|
141
168
|
function GithubActivity({ username, theme = "dark", className }) {
|
|
142
|
-
|
|
143
|
-
const [
|
|
144
|
-
const [
|
|
145
|
-
const [
|
|
146
|
-
const [
|
|
147
|
-
const [
|
|
148
|
-
const [
|
|
149
|
-
const [
|
|
169
|
+
var _a;
|
|
170
|
+
const [allDays, setAllDays] = (0, import_react.useState)(/* @__PURE__ */ new Map());
|
|
171
|
+
const [years, setYears] = (0, import_react.useState)([]);
|
|
172
|
+
const [selectedYear, setSelectedYear] = (0, import_react.useState)("last");
|
|
173
|
+
const [total, setTotal] = (0, import_react.useState)(null);
|
|
174
|
+
const [bestDay, setBestDay] = (0, import_react.useState)(null);
|
|
175
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
176
|
+
const [error, setError] = (0, import_react.useState)(false);
|
|
177
|
+
const [tip, setTip] = (0, import_react.useState)(
|
|
150
178
|
null
|
|
151
179
|
);
|
|
152
|
-
const colors = COLOR_MAP[theme]
|
|
153
|
-
useEffect(() => {
|
|
180
|
+
const colors = (_a = COLOR_MAP[theme]) != null ? _a : COLOR_MAP.dark;
|
|
181
|
+
(0, import_react.useEffect)(() => {
|
|
154
182
|
if (!username) return;
|
|
155
183
|
let mounted = true;
|
|
156
184
|
setLoading(true);
|
|
157
185
|
setError(false);
|
|
158
186
|
(async () => {
|
|
187
|
+
var _a2;
|
|
159
188
|
try {
|
|
160
189
|
const res = await fetch(
|
|
161
190
|
`https://github-contributions-api.jogruber.de/v4/${username}?y=all`
|
|
162
191
|
);
|
|
163
192
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
164
193
|
const json = await res.json();
|
|
165
|
-
const raw = json.contributions
|
|
194
|
+
const raw = (_a2 = json.contributions) != null ? _a2 : [];
|
|
166
195
|
if (!raw.length) throw new Error("empty data");
|
|
167
196
|
const map = /* @__PURE__ */ new Map();
|
|
168
197
|
const yearSet = /* @__PURE__ */ new Set();
|
|
@@ -191,7 +220,7 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
191
220
|
mounted = false;
|
|
192
221
|
};
|
|
193
222
|
}, [username]);
|
|
194
|
-
useEffect(() => {
|
|
223
|
+
(0, import_react.useEffect)(() => {
|
|
195
224
|
if (!allDays.size) return;
|
|
196
225
|
const entries = Array.from(allDays.values()).filter((d) => {
|
|
197
226
|
if (selectedYear === "last") {
|
|
@@ -209,11 +238,11 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
209
238
|
setTotal(sum);
|
|
210
239
|
setBestDay(best && best.count > 0 ? best : null);
|
|
211
240
|
}, [allDays, selectedYear]);
|
|
212
|
-
const grid = useMemo(
|
|
241
|
+
const grid = (0, import_react.useMemo)(
|
|
213
242
|
() => allDays.size ? buildGrid(allDays, selectedYear) : [],
|
|
214
243
|
[allDays, selectedYear]
|
|
215
244
|
);
|
|
216
|
-
const labels = useMemo(() => monthLabels(grid), [grid]);
|
|
245
|
+
const labels = (0, import_react.useMemo)(() => monthLabels(grid), [grid]);
|
|
217
246
|
const outlineColor = theme === "light" ? "#333" : "#f0f0f0";
|
|
218
247
|
const bestDateLabel = bestDay ? new Date(bestDay.date).toLocaleDateString("en-US", {
|
|
219
248
|
month: "short",
|
|
@@ -221,15 +250,15 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
221
250
|
year: "numeric"
|
|
222
251
|
}) : null;
|
|
223
252
|
const periodLabel = selectedYear === "last" ? " in the last year" : ` in ${selectedYear}`;
|
|
224
|
-
return /* @__PURE__ */ jsxs("section", { className: ["w-full font-mono", className].join(" ").trim(), children: [
|
|
225
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-500 dark:text-neutral-400", children: [
|
|
226
|
-
loading ? "Loading\u2026" : error ? "Unavailable" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
227
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold text-neutral-700 dark:text-neutral-200", children: total
|
|
253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: ["w-full font-mono", className].join(" ").trim(), children: [
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-500 dark:text-neutral-400", children: [
|
|
255
|
+
loading ? "Loading\u2026" : error ? "Unavailable" : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
256
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-semibold text-neutral-700 dark:text-neutral-200", children: total == null ? void 0 : total.toLocaleString() }),
|
|
228
257
|
" contributions",
|
|
229
258
|
periodLabel
|
|
230
259
|
] }),
|
|
231
|
-
bestDay && !loading && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
232
|
-
/* @__PURE__ */ jsx(
|
|
260
|
+
bestDay && !loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex items-center gap-1.5", children: [
|
|
261
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
233
262
|
"span",
|
|
234
263
|
{
|
|
235
264
|
className: "inline-block w-[10px] h-[10px] rounded-[2px]",
|
|
@@ -237,7 +266,7 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
237
266
|
}
|
|
238
267
|
),
|
|
239
268
|
"Best day:",
|
|
240
|
-
/* @__PURE__ */ jsxs("span", { className: "font-semibold text-neutral-700 dark:text-neutral-200", children: [
|
|
269
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "font-semibold text-neutral-700 dark:text-neutral-200", children: [
|
|
241
270
|
bestDay.count,
|
|
242
271
|
" contributions"
|
|
243
272
|
] }),
|
|
@@ -245,8 +274,8 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
245
274
|
bestDateLabel
|
|
246
275
|
] })
|
|
247
276
|
] }),
|
|
248
|
-
/* @__PURE__ */ jsx("div", { className: "border border-neutral-200 dark:border-neutral-800 rounded-xl p-4 bg-white dark:bg-neutral-950", children: error ? /* @__PURE__ */ jsx("p", { className: "text-sm italic text-neutral-400", children: "GitHub activity unavailable." }) : loading ? /* @__PURE__ */ jsx(Skeleton, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
249
|
-
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto overflow-y-visible pb-1", children: /* @__PURE__ */ jsxs(
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border border-neutral-200 dark:border-neutral-800 rounded-xl p-4 bg-white dark:bg-neutral-950", children: error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm italic text-neutral-400", children: "GitHub activity unavailable." }) : loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
278
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "overflow-x-auto overflow-y-visible pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
250
279
|
"div",
|
|
251
280
|
{
|
|
252
281
|
className: "relative",
|
|
@@ -254,12 +283,12 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
254
283
|
minWidth: grid.length * STEP + DAY_COL_W + 8
|
|
255
284
|
},
|
|
256
285
|
children: [
|
|
257
|
-
/* @__PURE__ */ jsx(
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
258
287
|
"div",
|
|
259
288
|
{
|
|
260
289
|
className: "relative h-[18px] mb-1",
|
|
261
290
|
style: { marginLeft: DAY_COL_W },
|
|
262
|
-
children: labels.map(({ label, col }) => /* @__PURE__ */ jsx(
|
|
291
|
+
children: labels.map(({ label, col }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
263
292
|
"span",
|
|
264
293
|
{
|
|
265
294
|
className: "absolute text-[11px] select-none text-neutral-500 dark:text-neutral-400",
|
|
@@ -270,30 +299,33 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
270
299
|
))
|
|
271
300
|
}
|
|
272
301
|
),
|
|
273
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-[3px]", children: [
|
|
274
|
-
/* @__PURE__ */ jsx(
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-[3px]", children: [
|
|
303
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
275
304
|
"div",
|
|
276
305
|
{
|
|
277
306
|
className: "flex flex-col gap-[3px] pt-px shrink-0",
|
|
278
307
|
style: { width: DAY_COL_W - GAP },
|
|
279
|
-
children: Array.from({ length: 7 }).map((_, i) =>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
308
|
+
children: Array.from({ length: 7 }).map((_, i) => {
|
|
309
|
+
var _a2;
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
311
|
+
"div",
|
|
312
|
+
{
|
|
313
|
+
className: "h-[13px] text-[10px] leading-[13px] text-right pr-1.5 select-none text-neutral-500 dark:text-neutral-400",
|
|
314
|
+
children: (_a2 = DAY_LABELS[i]) != null ? _a2 : ""
|
|
315
|
+
},
|
|
316
|
+
i
|
|
317
|
+
);
|
|
318
|
+
})
|
|
287
319
|
}
|
|
288
320
|
),
|
|
289
|
-
grid.map((week, wi) => /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-[3px]", children: week.map((day, di) => /* @__PURE__ */ jsx(
|
|
321
|
+
grid.map((week, wi) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-[3px]", children: week.map((day, di) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
290
322
|
"div",
|
|
291
323
|
{
|
|
292
324
|
className: "w-[13px] h-[13px] rounded-[3px] transition-transform duration-100 hover:scale-125",
|
|
293
325
|
style: {
|
|
294
326
|
backgroundColor: day ? colors[day.level] : "transparent",
|
|
295
327
|
cursor: day ? "pointer" : "default",
|
|
296
|
-
outline: bestDay && day
|
|
328
|
+
outline: bestDay && (day == null ? void 0 : day.date) === bestDay.date ? `2px solid ${outlineColor}` : "none",
|
|
297
329
|
outlineOffset: "1px"
|
|
298
330
|
},
|
|
299
331
|
onMouseEnter: (e) => {
|
|
@@ -313,9 +345,9 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
313
345
|
]
|
|
314
346
|
}
|
|
315
347
|
) }),
|
|
316
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-start gap-1 mt-3", children: [
|
|
317
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-neutral-500 dark:text-neutral-400 mr-1", children: "Less" }),
|
|
318
|
-
colors.map((c, i) => /* @__PURE__ */ jsx(
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-start gap-1 mt-3", children: [
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-[11px] text-neutral-500 dark:text-neutral-400 mr-1", children: "Less" }),
|
|
350
|
+
colors.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
319
351
|
"div",
|
|
320
352
|
{
|
|
321
353
|
className: "w-[13px] h-[13px] rounded-[3px]",
|
|
@@ -323,11 +355,11 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
323
355
|
},
|
|
324
356
|
i
|
|
325
357
|
)),
|
|
326
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-neutral-500 dark:text-neutral-400 ml-1", children: "More" })
|
|
358
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-[11px] text-neutral-500 dark:text-neutral-400 ml-1", children: "More" })
|
|
327
359
|
] }),
|
|
328
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-100 dark:border-neutral-800", children: [
|
|
329
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-neutral-400 mr-1", children: "Year:" }),
|
|
330
|
-
/* @__PURE__ */ jsx(
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-100 dark:border-neutral-800", children: [
|
|
361
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-[11px] text-neutral-400 mr-1", children: "Year:" }),
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
331
363
|
YearPill,
|
|
332
364
|
{
|
|
333
365
|
label: "Last year",
|
|
@@ -335,7 +367,7 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
335
367
|
onClick: () => setSelectedYear("last")
|
|
336
368
|
}
|
|
337
369
|
),
|
|
338
|
-
years.map((y) => /* @__PURE__ */ jsx(
|
|
370
|
+
years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
339
371
|
YearPill,
|
|
340
372
|
{
|
|
341
373
|
label: String(y),
|
|
@@ -346,11 +378,12 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
346
378
|
))
|
|
347
379
|
] })
|
|
348
380
|
] }) }),
|
|
349
|
-
tip && /* @__PURE__ */ jsx(Tooltip, { day: tip.day, x: tip.x, y: tip.y })
|
|
381
|
+
tip && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip, { day: tip.day, x: tip.x, y: tip.y })
|
|
350
382
|
] });
|
|
351
383
|
}
|
|
352
|
-
var GithubActivity_default = memo(GithubActivity);
|
|
353
|
-
export
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
384
|
+
var GithubActivity_default = (0, import_react.memo)(GithubActivity);
|
|
385
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
386
|
+
0 && (module.exports = {
|
|
387
|
+
GithubActivity
|
|
388
|
+
});
|
|
389
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/GithubActivity.tsx"],"sourcesContent":["import \"./styles.css\";\r\n\r\nexport { default as GithubActivity } from \"./GithubActivity\";","import { memo, useEffect, useState, useMemo } from \"react\";\r\n\r\ntype Theme = \"light\" | \"dark\" | \"blue\" | \"purple\";\r\n\r\ninterface Day {\r\n date: string;\r\n count: number;\r\n level: 0 | 1 | 2 | 3 | 4;\r\n}\r\n\r\ninterface Props {\r\n username: string;\r\n theme?: Theme;\r\n className?: string;\r\n}\r\n\r\n/* ---------- Constants ---------- */\r\n\r\nconst MONTHS = [\r\n \"Jan\",\r\n \"Feb\",\r\n \"Mar\",\r\n \"Apr\",\r\n \"May\",\r\n \"Jun\",\r\n \"Jul\",\r\n \"Aug\",\r\n \"Sep\",\r\n \"Oct\",\r\n \"Nov\",\r\n \"Dec\",\r\n];\r\nconst DAY_LABELS: Record<number, string> = { 1: \"Mon\", 3: \"Wed\", 5: \"Fri\" };\r\n\r\nconst CELL = 13;\r\nconst GAP = 3;\r\nconst STEP = CELL + GAP;\r\nconst DAY_COL_W = 30;\r\n\r\n/* ---------- Color Themes ---------- */\r\n\r\nconst LIGHT = [\"#ebedf0\", \"#9be9a8\", \"#40c463\", \"#30a14e\", \"#216e39\"];\r\nconst DARK = [\"#21262d\", \"#0e4429\", \"#006d32\", \"#26a641\", \"#39d353\"];\r\nconst BLUE = [\"#21262d\", \"#a3c9ff\", \"#5fa3ff\", \"#2f7bff\", \"#0b5cff\"];\r\nconst PURPLE = [\"#21262d\", \"#d8b4ff\", \"#c084fc\", \"#a855f7\", \"#7e22ce\"];\r\n\r\nconst COLOR_MAP: Record<Theme, string[]> = {\r\n light: LIGHT,\r\n dark: DARK,\r\n blue: BLUE,\r\n purple: PURPLE,\r\n};\r\n\r\n/* ---------- Utilities ---------- */\r\n\r\nfunction toLevel(count: number): 0 | 1 | 2 | 3 | 4 {\r\n if (count === 0) return 0;\r\n if (count <= 3) return 1;\r\n if (count <= 6) return 2;\r\n if (count <= 9) return 3;\r\n return 4;\r\n}\r\n\r\nfunction buildGrid(\r\n dayMap: Map<string, Day>,\r\n year: number | \"last\",\r\n): (Day | null)[][] {\r\n let start: Date;\r\n let end: Date;\r\n\r\n if (year === \"last\") {\r\n end = new Date();\r\n start = new Date(end);\r\n start.setFullYear(start.getFullYear() - 1);\r\n start.setDate(start.getDate() + 1);\r\n } else {\r\n start = new Date(year, 0, 1);\r\n end =\r\n year === new Date().getFullYear() ? new Date() : new Date(year, 11, 31);\r\n }\r\n\r\n start.setDate(start.getDate() - start.getDay());\r\n\r\n const weeks: (Day | null)[][] = [];\r\n const cur = new Date(start);\r\n\r\n while (cur <= end) {\r\n const week: (Day | null)[] = [];\r\n\r\n for (let d = 0; d < 7; d++) {\r\n const iso = cur.toISOString().slice(0, 10);\r\n\r\n if (cur > end) {\r\n week.push(null);\r\n } else {\r\n week.push(\r\n dayMap.get(iso) ?? {\r\n date: iso,\r\n count: 0,\r\n level: 0,\r\n },\r\n );\r\n }\r\n\r\n cur.setDate(cur.getDate() + 1);\r\n }\r\n\r\n weeks.push(week);\r\n }\r\n\r\n return weeks;\r\n}\r\n\r\nfunction monthLabels(grid: (Day | null)[][]) {\r\n const out: { label: string; col: number }[] = [];\r\n let last = -1;\r\n\r\n grid.forEach((week, i) => {\r\n const first = week.find(Boolean);\r\n if (!first) return;\r\n\r\n const m = new Date(first.date).getMonth();\r\n\r\n if (m !== last) {\r\n out.push({ label: MONTHS[m], col: i });\r\n last = m;\r\n }\r\n });\r\n\r\n return out;\r\n}\r\n\r\n/* ---------- UI Components ---------- */\r\n\r\nfunction Tooltip({ day, x, y }: { day: Day; x: number; y: number }) {\r\n const label = new Date(day.date).toLocaleDateString(\"en-US\", {\r\n weekday: \"long\",\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n });\r\n\r\n return (\r\n <div\r\n className=\"fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white dark:bg-white dark:text-neutral-900\"\r\n style={{ left: x, top: y - 8 }}\r\n >\r\n <b>\r\n {day.count} contribution{day.count !== 1 ? \"s\" : \"\"}\r\n </b>{\" \"}\r\n · {label}\r\n </div>\r\n );\r\n}\r\n\r\nfunction Skeleton() {\r\n return (\r\n <div className=\"flex gap-[3px] animate-pulse opacity-40\">\r\n {Array.from({ length: 53 }).map((_, w) => (\r\n <div key={w} className=\"flex flex-col gap-[3px]\">\r\n {Array.from({ length: 7 }).map((_, d) => (\r\n <div\r\n key={d}\r\n className=\"w-[13px] h-[13px] rounded-[3px] bg-neutral-300 dark:bg-neutral-700\"\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\nfunction YearPill({\r\n label,\r\n active,\r\n onClick,\r\n}: {\r\n label: string;\r\n active: boolean;\r\n onClick: () => void;\r\n}) {\r\n return (\r\n <button\r\n onClick={onClick}\r\n className={[\r\n \"px-2.5 py-0.5 rounded-full text-[11px] font-medium transition-colors duration-150\",\r\n active\r\n ? \"bg-neutral-900 text-white dark:bg-white dark:text-neutral-900\"\r\n : \"bg-neutral-100 text-neutral-600 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-400 dark:hover:bg-neutral-700\",\r\n ].join(\" \")}\r\n >\r\n {label}\r\n </button>\r\n );\r\n}\r\n\r\n/* ---------- Main Component ---------- */\r\n\r\nfunction GithubActivity({ username, theme = \"dark\", className }: Props) {\r\n const [allDays, setAllDays] = useState<Map<string, Day>>(new Map());\r\n const [years, setYears] = useState<number[]>([]);\r\n const [selectedYear, setSelectedYear] = useState<number | \"last\">(\"last\");\r\n const [total, setTotal] = useState<number | null>(null);\r\n const [bestDay, setBestDay] = useState<Day | null>(null);\r\n const [loading, setLoading] = useState(true);\r\n const [error, setError] = useState(false);\r\n const [tip, setTip] = useState<{ day: Day; x: number; y: number } | null>(\r\n null,\r\n );\r\n\r\n const colors = COLOR_MAP[theme] ?? COLOR_MAP.dark;\r\n\r\n /* Fetch Contributions */\r\n\r\n useEffect(() => {\r\n if (!username) return;\r\n\r\n let mounted = true;\r\n setLoading(true);\r\n setError(false);\r\n\r\n (async () => {\r\n try {\r\n const res = await fetch(\r\n `https://github-contributions-api.jogruber.de/v4/${username}?y=all`,\r\n );\r\n\r\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\r\n\r\n const json = await res.json();\r\n const raw: { date: string; count: number }[] = json.contributions ?? [];\r\n\r\n if (!raw.length) throw new Error(\"empty data\");\r\n\r\n const map = new Map<string, Day>();\r\n const yearSet = new Set<number>();\r\n\r\n raw.forEach((c) => {\r\n map.set(c.date, {\r\n date: c.date,\r\n count: c.count,\r\n level: toLevel(c.count),\r\n });\r\n\r\n yearSet.add(new Date(c.date).getFullYear());\r\n });\r\n\r\n if (mounted) {\r\n setAllDays(map);\r\n setYears(Array.from(yearSet).sort((a, b) => b - a));\r\n setLoading(false);\r\n }\r\n } catch (err) {\r\n console.warn(\"GithubActivity fetch error:\", err);\r\n\r\n if (mounted) {\r\n setError(true);\r\n setLoading(false);\r\n }\r\n }\r\n })();\r\n\r\n return () => {\r\n mounted = false;\r\n };\r\n }, [username]);\r\n\r\n /* Stats Calculation */\r\n\r\n useEffect(() => {\r\n if (!allDays.size) return;\r\n\r\n const entries = Array.from(allDays.values()).filter((d) => {\r\n if (selectedYear === \"last\") {\r\n const oneYearAgo = new Date();\r\n oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);\r\n return new Date(d.date) >= oneYearAgo;\r\n }\r\n\r\n return new Date(d.date).getFullYear() === selectedYear;\r\n });\r\n\r\n const sum = entries.reduce((s, d) => s + d.count, 0);\r\n\r\n const best = entries.reduce<Day | null>(\r\n (b, d) => (!b || d.count > b.count ? d : b),\r\n null,\r\n );\r\n\r\n setTotal(sum);\r\n setBestDay(best && best.count > 0 ? best : null);\r\n }, [allDays, selectedYear]);\r\n\r\n /* Rendering Helpers */\r\n\r\n const grid = useMemo(\r\n () => (allDays.size ? buildGrid(allDays, selectedYear) : []),\r\n [allDays, selectedYear],\r\n );\r\n\r\n const labels = useMemo(() => monthLabels(grid), [grid]);\r\n\r\n const outlineColor = theme === \"light\" ? \"#333\" : \"#f0f0f0\";\r\n\r\n const bestDateLabel = bestDay\r\n ? new Date(bestDay.date).toLocaleDateString(\"en-US\", {\r\n month: \"short\",\r\n day: \"numeric\",\r\n year: \"numeric\",\r\n })\r\n : null;\r\n\r\n const periodLabel =\r\n selectedYear === \"last\" ? \" in the last year\" : ` in ${selectedYear}`;\r\n\r\n return (\r\n <section className={[\"w-full font-mono\", className].join(\" \").trim()}>\r\n <div className=\"flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-500 dark:text-neutral-400\">\r\n {loading ? (\r\n \"Loading…\"\r\n ) : error ? (\r\n \"Unavailable\"\r\n ) : (\r\n <>\r\n <span className=\"font-semibold text-neutral-700 dark:text-neutral-200\">\r\n {total?.toLocaleString()}\r\n </span>\r\n {\" contributions\"}\r\n {periodLabel}\r\n </>\r\n )}\r\n\r\n {bestDay && !loading && (\r\n <span className=\"flex items-center gap-1.5\">\r\n <span\r\n className=\"inline-block w-[10px] h-[10px] rounded-[2px]\"\r\n style={{ backgroundColor: colors[4] }}\r\n />\r\n Best day:\r\n <span className=\"font-semibold text-neutral-700 dark:text-neutral-200\">\r\n {bestDay.count} contributions\r\n </span>\r\n on {bestDateLabel}\r\n </span>\r\n )}\r\n </div>\r\n\r\n <div className=\"border border-neutral-200 dark:border-neutral-800 rounded-xl p-4 bg-white dark:bg-neutral-950\">\r\n {error ? (\r\n <p className=\"text-sm italic text-neutral-400\">\r\n GitHub activity unavailable.\r\n </p>\r\n ) : loading ? (\r\n <Skeleton />\r\n ) : (\r\n <>\r\n <div className=\"overflow-x-auto overflow-y-visible pb-1\">\r\n <div\r\n className=\"relative\"\r\n style={{\r\n minWidth: grid.length * STEP + DAY_COL_W + 8,\r\n }}\r\n >\r\n <div\r\n className=\"relative h-[18px] mb-1\"\r\n style={{ marginLeft: DAY_COL_W }}\r\n >\r\n {labels.map(({ label, col }) => (\r\n <span\r\n key={`${label}-${col}`}\r\n className=\"absolute text-[11px] select-none text-neutral-500 dark:text-neutral-400\"\r\n style={{ left: col * STEP }}\r\n >\r\n {label}\r\n </span>\r\n ))}\r\n </div>\r\n\r\n <div className=\"flex gap-[3px]\">\r\n <div\r\n className=\"flex flex-col gap-[3px] pt-px shrink-0\"\r\n style={{ width: DAY_COL_W - GAP }}\r\n >\r\n {Array.from({ length: 7 }).map((_, i) => (\r\n <div\r\n key={i}\r\n className=\"h-[13px] text-[10px] leading-[13px] text-right pr-1.5 select-none text-neutral-500 dark:text-neutral-400\"\r\n >\r\n {DAY_LABELS[i] ?? \"\"}\r\n </div>\r\n ))}\r\n </div>\r\n\r\n {grid.map((week, wi) => (\r\n <div key={wi} className=\"flex flex-col gap-[3px]\">\r\n {week.map((day, di) => (\r\n <div\r\n key={di}\r\n className=\"w-[13px] h-[13px] rounded-[3px] transition-transform duration-100 hover:scale-125\"\r\n style={{\r\n backgroundColor: day\r\n ? colors[day.level]\r\n : \"transparent\",\r\n cursor: day ? \"pointer\" : \"default\",\r\n outline:\r\n bestDay && day?.date === bestDay.date\r\n ? `2px solid ${outlineColor}`\r\n : \"none\",\r\n outlineOffset: \"1px\",\r\n }}\r\n onMouseEnter={(e) => {\r\n if (!day) return;\r\n\r\n const r = e.currentTarget.getBoundingClientRect();\r\n\r\n setTip({\r\n day,\r\n x: r.left + r.width / 2,\r\n y: r.top,\r\n });\r\n }}\r\n onMouseLeave={() => setTip(null)}\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"flex items-center justify-start gap-1 mt-3\">\r\n <span className=\"text-[11px] text-neutral-500 dark:text-neutral-400 mr-1\">\r\n Less\r\n </span>\r\n\r\n {colors.map((c, i) => (\r\n <div\r\n key={i}\r\n className=\"w-[13px] h-[13px] rounded-[3px]\"\r\n style={{ backgroundColor: c }}\r\n />\r\n ))}\r\n\r\n <span className=\"text-[11px] text-neutral-500 dark:text-neutral-400 ml-1\">\r\n More\r\n </span>\r\n </div>\r\n\r\n <div className=\"flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-100 dark:border-neutral-800\">\r\n <span className=\"text-[11px] text-neutral-400 mr-1\">Year:</span>\r\n\r\n <YearPill\r\n label=\"Last year\"\r\n active={selectedYear === \"last\"}\r\n onClick={() => setSelectedYear(\"last\")}\r\n />\r\n\r\n {years.map((y) => (\r\n <YearPill\r\n key={y}\r\n label={String(y)}\r\n active={selectedYear === y}\r\n onClick={() => setSelectedYear(y)}\r\n />\r\n ))}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n\r\n {tip && <Tooltip day={tip.day} x={tip.x} y={tip.y} />}\r\n </section>\r\n );\r\n}\r\n\r\nexport default memo(GithubActivity);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAmD;AAmJ7C;AAjIN,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,aAAqC,EAAE,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM;AAE1E,IAAM,OAAO;AACb,IAAM,MAAM;AACZ,IAAM,OAAO,OAAO;AACpB,IAAM,YAAY;AAIlB,IAAM,QAAQ,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACpE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,SAAS,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AAErE,IAAM,YAAqC;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AACV;AAIA,SAAS,QAAQ,OAAkC;AACjD,MAAI,UAAU,EAAG,QAAO;AACxB,MAAI,SAAS,EAAG,QAAO;AACvB,MAAI,SAAS,EAAG,QAAO;AACvB,MAAI,SAAS,EAAG,QAAO;AACvB,SAAO;AACT;AAEA,SAAS,UACP,QACA,MACkB;AAlEpB;AAmEE,MAAI;AACJ,MAAI;AAEJ,MAAI,SAAS,QAAQ;AACnB,UAAM,oBAAI,KAAK;AACf,YAAQ,IAAI,KAAK,GAAG;AACpB,UAAM,YAAY,MAAM,YAAY,IAAI,CAAC;AACzC,UAAM,QAAQ,MAAM,QAAQ,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,WAAU,qGACb;AAAA,oDAAC,UAAK,WAAU,qCAAoC,mBAAK;AAAA,QAEzD;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,QAAQ,iBAAiB;AAAA,YACzB,SAAS,MAAM,gBAAgB,MAAM;AAAA;AAAA,QACvC;AAAA,QAEC,MAAM,IAAI,CAAC,MACV;AAAA,UAAC;AAAA;AAAA,YAEC,OAAO,OAAO,CAAC;AAAA,YACf,QAAQ,iBAAiB;AAAA,YACzB,SAAS,MAAM,gBAAgB,CAAC;AAAA;AAAA,UAH3B;AAAA,QAIP,CACD;AAAA,SACH;AAAA,OACF,GAEJ;AAAA,IAEC,OAAO,4CAAC,WAAQ,KAAK,IAAI,KAAK,GAAG,IAAI,GAAG,GAAG,IAAI,GAAG;AAAA,KACrD;AAEJ;AAEA,IAAO,6BAAQ,mBAAK,cAAc;","names":["_","_a"]}
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/* src/styles.css */
|
|
2
|
+
@layer properties;
|
|
3
|
+
.pointer-events-none {
|
|
4
|
+
pointer-events: none;
|
|
5
|
+
}
|
|
6
|
+
.absolute {
|
|
7
|
+
position: absolute;
|
|
8
|
+
}
|
|
9
|
+
.fixed {
|
|
10
|
+
position: fixed;
|
|
11
|
+
}
|
|
12
|
+
.relative {
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
.z-50 {
|
|
16
|
+
z-index: 50;
|
|
17
|
+
}
|
|
18
|
+
.flex {
|
|
19
|
+
display: flex;
|
|
20
|
+
}
|
|
21
|
+
.grid {
|
|
22
|
+
display: grid;
|
|
23
|
+
}
|
|
24
|
+
.inline-block {
|
|
25
|
+
display: inline-block;
|
|
26
|
+
}
|
|
27
|
+
.h-\[10px\] {
|
|
28
|
+
height: 10px;
|
|
29
|
+
}
|
|
30
|
+
.h-\[13px\] {
|
|
31
|
+
height: 13px;
|
|
32
|
+
}
|
|
33
|
+
.h-\[18px\] {
|
|
34
|
+
height: 18px;
|
|
35
|
+
}
|
|
36
|
+
.w-\[10px\] {
|
|
37
|
+
width: 10px;
|
|
38
|
+
}
|
|
39
|
+
.w-\[13px\] {
|
|
40
|
+
width: 13px;
|
|
41
|
+
}
|
|
42
|
+
.w-full {
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
.shrink-0 {
|
|
46
|
+
flex-shrink: 0;
|
|
47
|
+
}
|
|
48
|
+
.-translate-x-1\/2 {
|
|
49
|
+
--tw-translate-x: calc(calc(1 / 2 * 100%) * -1);
|
|
50
|
+
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
51
|
+
}
|
|
52
|
+
.-translate-y-full {
|
|
53
|
+
--tw-translate-y: -100%;
|
|
54
|
+
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
55
|
+
}
|
|
56
|
+
.flex-col {
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
}
|
|
59
|
+
.flex-wrap {
|
|
60
|
+
flex-wrap: wrap;
|
|
61
|
+
}
|
|
62
|
+
.items-center {
|
|
63
|
+
align-items: center;
|
|
64
|
+
}
|
|
65
|
+
.justify-start {
|
|
66
|
+
justify-content: flex-start;
|
|
67
|
+
}
|
|
68
|
+
.gap-\[3px\] {
|
|
69
|
+
gap: 3px;
|
|
70
|
+
}
|
|
71
|
+
.overflow-x-auto {
|
|
72
|
+
overflow-x: auto;
|
|
73
|
+
}
|
|
74
|
+
.overflow-y-visible {
|
|
75
|
+
overflow-y: visible;
|
|
76
|
+
}
|
|
77
|
+
.rounded-\[2px\] {
|
|
78
|
+
border-radius: 2px;
|
|
79
|
+
}
|
|
80
|
+
.rounded-\[3px\] {
|
|
81
|
+
border-radius: 3px;
|
|
82
|
+
}
|
|
83
|
+
.rounded-full {
|
|
84
|
+
border-radius: calc(infinity * 1px);
|
|
85
|
+
}
|
|
86
|
+
.border {
|
|
87
|
+
border-style: var(--tw-border-style);
|
|
88
|
+
border-width: 1px;
|
|
89
|
+
}
|
|
90
|
+
.border-t {
|
|
91
|
+
border-top-style: var(--tw-border-style);
|
|
92
|
+
border-top-width: 1px;
|
|
93
|
+
}
|
|
94
|
+
.pt-px {
|
|
95
|
+
padding-top: 1px;
|
|
96
|
+
}
|
|
97
|
+
.text-right {
|
|
98
|
+
text-align: right;
|
|
99
|
+
}
|
|
100
|
+
.text-\[10px\] {
|
|
101
|
+
font-size: 10px;
|
|
102
|
+
}
|
|
103
|
+
.text-\[11px\] {
|
|
104
|
+
font-size: 11px;
|
|
105
|
+
}
|
|
106
|
+
.leading-\[13px\] {
|
|
107
|
+
--tw-leading: 13px;
|
|
108
|
+
line-height: 13px;
|
|
109
|
+
}
|
|
110
|
+
.whitespace-nowrap {
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
}
|
|
113
|
+
.italic {
|
|
114
|
+
font-style: italic;
|
|
115
|
+
}
|
|
116
|
+
.opacity-40 {
|
|
117
|
+
opacity: 40%;
|
|
118
|
+
}
|
|
119
|
+
.outline {
|
|
120
|
+
outline-style: var(--tw-outline-style);
|
|
121
|
+
outline-width: 1px;
|
|
122
|
+
}
|
|
123
|
+
.transition-colors {
|
|
124
|
+
transition-property:
|
|
125
|
+
color,
|
|
126
|
+
background-color,
|
|
127
|
+
border-color,
|
|
128
|
+
outline-color,
|
|
129
|
+
text-decoration-color,
|
|
130
|
+
fill,
|
|
131
|
+
stroke,
|
|
132
|
+
--tw-gradient-from,
|
|
133
|
+
--tw-gradient-via,
|
|
134
|
+
--tw-gradient-to;
|
|
135
|
+
transition-timing-function: var(--tw-ease, ease);
|
|
136
|
+
transition-duration: var(--tw-duration, 0s);
|
|
137
|
+
}
|
|
138
|
+
.transition-transform {
|
|
139
|
+
transition-property:
|
|
140
|
+
transform,
|
|
141
|
+
translate,
|
|
142
|
+
scale,
|
|
143
|
+
rotate;
|
|
144
|
+
transition-timing-function: var(--tw-ease, ease);
|
|
145
|
+
transition-duration: var(--tw-duration, 0s);
|
|
146
|
+
}
|
|
147
|
+
.duration-100 {
|
|
148
|
+
--tw-duration: 100ms;
|
|
149
|
+
transition-duration: 100ms;
|
|
150
|
+
}
|
|
151
|
+
.duration-150 {
|
|
152
|
+
--tw-duration: 150ms;
|
|
153
|
+
transition-duration: 150ms;
|
|
154
|
+
}
|
|
155
|
+
.select-none {
|
|
156
|
+
-webkit-user-select: none;
|
|
157
|
+
-moz-user-select: none;
|
|
158
|
+
user-select: none;
|
|
159
|
+
}
|
|
160
|
+
.hover\:scale-125 {
|
|
161
|
+
&:hover {
|
|
162
|
+
@media (hover: hover) {
|
|
163
|
+
--tw-scale-x: 125%;
|
|
164
|
+
--tw-scale-y: 125%;
|
|
165
|
+
--tw-scale-z: 125%;
|
|
166
|
+
scale: var(--tw-scale-x) var(--tw-scale-y);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
@property --tw-translate-x { syntax: "*"; inherits: false; initial-value: 0; }
|
|
171
|
+
@property --tw-translate-y { syntax: "*"; inherits: false; initial-value: 0; }
|
|
172
|
+
@property --tw-translate-z { syntax: "*"; inherits: false; initial-value: 0; }
|
|
173
|
+
@property --tw-border-style { syntax: "*"; inherits: false; initial-value: solid; }
|
|
174
|
+
@property --tw-leading { syntax: "*"; inherits: false; }
|
|
175
|
+
@property --tw-outline-style { syntax: "*"; inherits: false; initial-value: solid; }
|
|
176
|
+
@property --tw-duration { syntax: "*"; inherits: false; }
|
|
177
|
+
@property --tw-scale-x { syntax: "*"; inherits: false; initial-value: 1; }
|
|
178
|
+
@property --tw-scale-y { syntax: "*"; inherits: false; initial-value: 1; }
|
|
179
|
+
@property --tw-scale-z { syntax: "*"; inherits: false; initial-value: 1; }
|
|
180
|
+
@layer properties {
|
|
181
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
182
|
+
*,
|
|
183
|
+
::before,
|
|
184
|
+
::after,
|
|
185
|
+
::backdrop {
|
|
186
|
+
--tw-translate-x: 0;
|
|
187
|
+
--tw-translate-y: 0;
|
|
188
|
+
--tw-translate-z: 0;
|
|
189
|
+
--tw-border-style: solid;
|
|
190
|
+
--tw-leading: initial;
|
|
191
|
+
--tw-outline-style: solid;
|
|
192
|
+
--tw-duration: initial;
|
|
193
|
+
--tw-scale-x: 1;
|
|
194
|
+
--tw-scale-y: 1;
|
|
195
|
+
--tw-scale-z: 1;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
|
|
200
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/styles.css"],"sourcesContent":["/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */\n@layer properties;\n.pointer-events-none {\n pointer-events: none;\n}\n.absolute {\n position: absolute;\n}\n.fixed {\n position: fixed;\n}\n.relative {\n position: relative;\n}\n.z-50 {\n z-index: 50;\n}\n.flex {\n display: flex;\n}\n.grid {\n display: grid;\n}\n.inline-block {\n display: inline-block;\n}\n.h-\\[10px\\] {\n height: 10px;\n}\n.h-\\[13px\\] {\n height: 13px;\n}\n.h-\\[18px\\] {\n height: 18px;\n}\n.w-\\[10px\\] {\n width: 10px;\n}\n.w-\\[13px\\] {\n width: 13px;\n}\n.w-full {\n width: 100%;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.-translate-x-1\\/2 {\n --tw-translate-x: calc(calc(1 / 2 * 100%) * -1);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n}\n.-translate-y-full {\n --tw-translate-y: -100%;\n translate: var(--tw-translate-x) var(--tw-translate-y);\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.gap-\\[3px\\] {\n gap: 3px;\n}\n.overflow-x-auto {\n overflow-x: auto;\n}\n.overflow-y-visible {\n overflow-y: visible;\n}\n.rounded-\\[2px\\] {\n border-radius: 2px;\n}\n.rounded-\\[3px\\] {\n border-radius: 3px;\n}\n.rounded-full {\n border-radius: calc(infinity * 1px);\n}\n.border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n}\n.border-t {\n border-top-style: var(--tw-border-style);\n border-top-width: 1px;\n}\n.pt-px {\n padding-top: 1px;\n}\n.text-right {\n text-align: right;\n}\n.text-\\[10px\\] {\n font-size: 10px;\n}\n.text-\\[11px\\] {\n font-size: 11px;\n}\n.leading-\\[13px\\] {\n --tw-leading: 13px;\n line-height: 13px;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.italic {\n font-style: italic;\n}\n.opacity-40 {\n opacity: 40%;\n}\n.outline {\n outline-style: var(--tw-outline-style);\n outline-width: 1px;\n}\n.transition-colors {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;\n transition-timing-function: var(--tw-ease, ease);\n transition-duration: var(--tw-duration, 0s);\n}\n.transition-transform {\n transition-property: transform, translate, scale, rotate;\n transition-timing-function: var(--tw-ease, ease);\n transition-duration: var(--tw-duration, 0s);\n}\n.duration-100 {\n --tw-duration: 100ms;\n transition-duration: 100ms;\n}\n.duration-150 {\n --tw-duration: 150ms;\n transition-duration: 150ms;\n}\n.select-none {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.hover\\:scale-125 {\n &:hover {\n @media (hover: hover) {\n --tw-scale-x: 125%;\n --tw-scale-y: 125%;\n --tw-scale-z: 125%;\n scale: var(--tw-scale-x) var(--tw-scale-y);\n }\n }\n}\n@property --tw-translate-x {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-y {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-z {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-border-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-leading {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-outline-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-duration {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-scale-x {\n syntax: \"*\";\n inherits: false;\n initial-value: 1;\n}\n@property --tw-scale-y {\n syntax: \"*\";\n inherits: false;\n initial-value: 1;\n}\n@property --tw-scale-z {\n syntax: \"*\";\n inherits: false;\n initial-value: 1;\n}\n@layer properties {\n @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {\n *, ::before, ::after, ::backdrop {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-border-style: solid;\n --tw-leading: initial;\n --tw-outline-style: solid;\n --tw-duration: initial;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-scale-z: 1;\n }\n }\n}"],"mappings":";AACA;AACA,CAAC;AACC,kBAAgB;AAClB;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAAC;AACC,WAAS;AACX;AACA,CAAC;AACC,WAAS;AACX;AACA,CAAC;AACC,WAAS;AACX;AACA,CAAC;AACC,WAAS;AACX;AACA,CAAC;AACC,UAAQ;AACV;AACA,CAAC;AACC,UAAQ;AACV;AACA,CAAC;AACC,UAAQ;AACV;AACA,CAAC;AACC,SAAO;AACT;AACA,CAAC;AACC,SAAO;AACT;AACA,CAAC;AACC,SAAO;AACT;AACA,CAAC;AACC,eAAa;AACf;AACA,CAAC;AACC,oBAAkB,KAAK,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;AAC5C,aAAW,IAAI,kBAAkB,IAAI;AACvC;AACA,CAAC;AACC,oBAAkB;AAClB,aAAW,IAAI,kBAAkB,IAAI;AACvC;AACA,CAAC;AACC,kBAAgB;AAClB;AACA,CAAC;AACC,aAAW;AACb;AACA,C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Ac;AACd,0BAAoB;AACpB,qBAAe;AACf,oBAAc;AACd,oBAAc;AACd,oBAAc;AAChB;AACF;AACF;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
GithubActivity: () => GithubActivity_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(index_exports);
|
|
26
|
-
|
|
27
1
|
// src/GithubActivity.tsx
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
import { memo, useEffect, useState, useMemo } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
30
4
|
var MONTHS = [
|
|
31
5
|
"Jan",
|
|
32
6
|
"Feb",
|
|
@@ -64,6 +38,7 @@ function toLevel(count) {
|
|
|
64
38
|
return 4;
|
|
65
39
|
}
|
|
66
40
|
function buildGrid(dayMap, year) {
|
|
41
|
+
var _a;
|
|
67
42
|
let start;
|
|
68
43
|
let end;
|
|
69
44
|
if (year === "last") {
|
|
@@ -86,7 +61,7 @@ function buildGrid(dayMap, year) {
|
|
|
86
61
|
week.push(null);
|
|
87
62
|
} else {
|
|
88
63
|
week.push(
|
|
89
|
-
dayMap.get(iso)
|
|
64
|
+
(_a = dayMap.get(iso)) != null ? _a : {
|
|
90
65
|
date: iso,
|
|
91
66
|
count: 0,
|
|
92
67
|
level: 0
|
|
@@ -120,13 +95,13 @@ function Tooltip({ day, x, y }) {
|
|
|
120
95
|
month: "long",
|
|
121
96
|
day: "numeric"
|
|
122
97
|
});
|
|
123
|
-
return /* @__PURE__ */
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
124
99
|
"div",
|
|
125
100
|
{
|
|
126
101
|
className: "fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white dark:bg-white dark:text-neutral-900",
|
|
127
102
|
style: { left: x, top: y - 8 },
|
|
128
103
|
children: [
|
|
129
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
|
130
105
|
day.count,
|
|
131
106
|
" contribution",
|
|
132
107
|
day.count !== 1 ? "s" : ""
|
|
@@ -139,7 +114,7 @@ function Tooltip({ day, x, y }) {
|
|
|
139
114
|
);
|
|
140
115
|
}
|
|
141
116
|
function Skeleton() {
|
|
142
|
-
return /* @__PURE__ */
|
|
117
|
+
return /* @__PURE__ */ jsx("div", { className: "flex gap-[3px] animate-pulse opacity-40", children: Array.from({ length: 53 }).map((_, w) => /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-[3px]", children: Array.from({ length: 7 }).map((_2, d) => /* @__PURE__ */ jsx(
|
|
143
118
|
"div",
|
|
144
119
|
{
|
|
145
120
|
className: "w-[13px] h-[13px] rounded-[3px] bg-neutral-300 dark:bg-neutral-700"
|
|
@@ -152,7 +127,7 @@ function YearPill({
|
|
|
152
127
|
active,
|
|
153
128
|
onClick
|
|
154
129
|
}) {
|
|
155
|
-
return /* @__PURE__ */
|
|
130
|
+
return /* @__PURE__ */ jsx(
|
|
156
131
|
"button",
|
|
157
132
|
{
|
|
158
133
|
onClick,
|
|
@@ -165,30 +140,32 @@ function YearPill({
|
|
|
165
140
|
);
|
|
166
141
|
}
|
|
167
142
|
function GithubActivity({ username, theme = "dark", className }) {
|
|
168
|
-
|
|
169
|
-
const [
|
|
170
|
-
const [
|
|
171
|
-
const [
|
|
172
|
-
const [
|
|
173
|
-
const [
|
|
174
|
-
const [
|
|
175
|
-
const [
|
|
143
|
+
var _a;
|
|
144
|
+
const [allDays, setAllDays] = useState(/* @__PURE__ */ new Map());
|
|
145
|
+
const [years, setYears] = useState([]);
|
|
146
|
+
const [selectedYear, setSelectedYear] = useState("last");
|
|
147
|
+
const [total, setTotal] = useState(null);
|
|
148
|
+
const [bestDay, setBestDay] = useState(null);
|
|
149
|
+
const [loading, setLoading] = useState(true);
|
|
150
|
+
const [error, setError] = useState(false);
|
|
151
|
+
const [tip, setTip] = useState(
|
|
176
152
|
null
|
|
177
153
|
);
|
|
178
|
-
const colors = COLOR_MAP[theme]
|
|
179
|
-
|
|
154
|
+
const colors = (_a = COLOR_MAP[theme]) != null ? _a : COLOR_MAP.dark;
|
|
155
|
+
useEffect(() => {
|
|
180
156
|
if (!username) return;
|
|
181
157
|
let mounted = true;
|
|
182
158
|
setLoading(true);
|
|
183
159
|
setError(false);
|
|
184
160
|
(async () => {
|
|
161
|
+
var _a2;
|
|
185
162
|
try {
|
|
186
163
|
const res = await fetch(
|
|
187
164
|
`https://github-contributions-api.jogruber.de/v4/${username}?y=all`
|
|
188
165
|
);
|
|
189
166
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
190
167
|
const json = await res.json();
|
|
191
|
-
const raw = json.contributions
|
|
168
|
+
const raw = (_a2 = json.contributions) != null ? _a2 : [];
|
|
192
169
|
if (!raw.length) throw new Error("empty data");
|
|
193
170
|
const map = /* @__PURE__ */ new Map();
|
|
194
171
|
const yearSet = /* @__PURE__ */ new Set();
|
|
@@ -217,7 +194,7 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
217
194
|
mounted = false;
|
|
218
195
|
};
|
|
219
196
|
}, [username]);
|
|
220
|
-
|
|
197
|
+
useEffect(() => {
|
|
221
198
|
if (!allDays.size) return;
|
|
222
199
|
const entries = Array.from(allDays.values()).filter((d) => {
|
|
223
200
|
if (selectedYear === "last") {
|
|
@@ -235,11 +212,11 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
235
212
|
setTotal(sum);
|
|
236
213
|
setBestDay(best && best.count > 0 ? best : null);
|
|
237
214
|
}, [allDays, selectedYear]);
|
|
238
|
-
const grid =
|
|
215
|
+
const grid = useMemo(
|
|
239
216
|
() => allDays.size ? buildGrid(allDays, selectedYear) : [],
|
|
240
217
|
[allDays, selectedYear]
|
|
241
218
|
);
|
|
242
|
-
const labels =
|
|
219
|
+
const labels = useMemo(() => monthLabels(grid), [grid]);
|
|
243
220
|
const outlineColor = theme === "light" ? "#333" : "#f0f0f0";
|
|
244
221
|
const bestDateLabel = bestDay ? new Date(bestDay.date).toLocaleDateString("en-US", {
|
|
245
222
|
month: "short",
|
|
@@ -247,15 +224,15 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
247
224
|
year: "numeric"
|
|
248
225
|
}) : null;
|
|
249
226
|
const periodLabel = selectedYear === "last" ? " in the last year" : ` in ${selectedYear}`;
|
|
250
|
-
return /* @__PURE__ */
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
loading ? "Loading\u2026" : error ? "Unavailable" : /* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */
|
|
227
|
+
return /* @__PURE__ */ jsxs("section", { className: ["w-full font-mono", className].join(" ").trim(), children: [
|
|
228
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-500 dark:text-neutral-400", children: [
|
|
229
|
+
loading ? "Loading\u2026" : error ? "Unavailable" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
230
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-neutral-700 dark:text-neutral-200", children: total == null ? void 0 : total.toLocaleString() }),
|
|
254
231
|
" contributions",
|
|
255
232
|
periodLabel
|
|
256
233
|
] }),
|
|
257
|
-
bestDay && !loading && /* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
234
|
+
bestDay && !loading && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
259
236
|
"span",
|
|
260
237
|
{
|
|
261
238
|
className: "inline-block w-[10px] h-[10px] rounded-[2px]",
|
|
@@ -263,7 +240,7 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
263
240
|
}
|
|
264
241
|
),
|
|
265
242
|
"Best day:",
|
|
266
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold text-neutral-700 dark:text-neutral-200", children: [
|
|
267
244
|
bestDay.count,
|
|
268
245
|
" contributions"
|
|
269
246
|
] }),
|
|
@@ -271,8 +248,8 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
271
248
|
bestDateLabel
|
|
272
249
|
] })
|
|
273
250
|
] }),
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ jsx("div", { className: "border border-neutral-200 dark:border-neutral-800 rounded-xl p-4 bg-white dark:bg-neutral-950", children: error ? /* @__PURE__ */ jsx("p", { className: "text-sm italic text-neutral-400", children: "GitHub activity unavailable." }) : loading ? /* @__PURE__ */ jsx(Skeleton, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
252
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto overflow-y-visible pb-1", children: /* @__PURE__ */ jsxs(
|
|
276
253
|
"div",
|
|
277
254
|
{
|
|
278
255
|
className: "relative",
|
|
@@ -280,12 +257,12 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
280
257
|
minWidth: grid.length * STEP + DAY_COL_W + 8
|
|
281
258
|
},
|
|
282
259
|
children: [
|
|
283
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ jsx(
|
|
284
261
|
"div",
|
|
285
262
|
{
|
|
286
263
|
className: "relative h-[18px] mb-1",
|
|
287
264
|
style: { marginLeft: DAY_COL_W },
|
|
288
|
-
children: labels.map(({ label, col }) => /* @__PURE__ */
|
|
265
|
+
children: labels.map(({ label, col }) => /* @__PURE__ */ jsx(
|
|
289
266
|
"span",
|
|
290
267
|
{
|
|
291
268
|
className: "absolute text-[11px] select-none text-neutral-500 dark:text-neutral-400",
|
|
@@ -296,30 +273,33 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
296
273
|
))
|
|
297
274
|
}
|
|
298
275
|
),
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
276
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-[3px]", children: [
|
|
277
|
+
/* @__PURE__ */ jsx(
|
|
301
278
|
"div",
|
|
302
279
|
{
|
|
303
280
|
className: "flex flex-col gap-[3px] pt-px shrink-0",
|
|
304
281
|
style: { width: DAY_COL_W - GAP },
|
|
305
|
-
children: Array.from({ length: 7 }).map((_, i) =>
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
282
|
+
children: Array.from({ length: 7 }).map((_, i) => {
|
|
283
|
+
var _a2;
|
|
284
|
+
return /* @__PURE__ */ jsx(
|
|
285
|
+
"div",
|
|
286
|
+
{
|
|
287
|
+
className: "h-[13px] text-[10px] leading-[13px] text-right pr-1.5 select-none text-neutral-500 dark:text-neutral-400",
|
|
288
|
+
children: (_a2 = DAY_LABELS[i]) != null ? _a2 : ""
|
|
289
|
+
},
|
|
290
|
+
i
|
|
291
|
+
);
|
|
292
|
+
})
|
|
313
293
|
}
|
|
314
294
|
),
|
|
315
|
-
grid.map((week, wi) => /* @__PURE__ */
|
|
295
|
+
grid.map((week, wi) => /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-[3px]", children: week.map((day, di) => /* @__PURE__ */ jsx(
|
|
316
296
|
"div",
|
|
317
297
|
{
|
|
318
298
|
className: "w-[13px] h-[13px] rounded-[3px] transition-transform duration-100 hover:scale-125",
|
|
319
299
|
style: {
|
|
320
300
|
backgroundColor: day ? colors[day.level] : "transparent",
|
|
321
301
|
cursor: day ? "pointer" : "default",
|
|
322
|
-
outline: bestDay && day
|
|
302
|
+
outline: bestDay && (day == null ? void 0 : day.date) === bestDay.date ? `2px solid ${outlineColor}` : "none",
|
|
323
303
|
outlineOffset: "1px"
|
|
324
304
|
},
|
|
325
305
|
onMouseEnter: (e) => {
|
|
@@ -339,9 +319,9 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
339
319
|
]
|
|
340
320
|
}
|
|
341
321
|
) }),
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
colors.map((c, i) => /* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-start gap-1 mt-3", children: [
|
|
323
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-neutral-500 dark:text-neutral-400 mr-1", children: "Less" }),
|
|
324
|
+
colors.map((c, i) => /* @__PURE__ */ jsx(
|
|
345
325
|
"div",
|
|
346
326
|
{
|
|
347
327
|
className: "w-[13px] h-[13px] rounded-[3px]",
|
|
@@ -349,11 +329,11 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
349
329
|
},
|
|
350
330
|
i
|
|
351
331
|
)),
|
|
352
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-neutral-500 dark:text-neutral-400 ml-1", children: "More" })
|
|
353
333
|
] }),
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-100 dark:border-neutral-800", children: [
|
|
335
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-neutral-400 mr-1", children: "Year:" }),
|
|
336
|
+
/* @__PURE__ */ jsx(
|
|
357
337
|
YearPill,
|
|
358
338
|
{
|
|
359
339
|
label: "Last year",
|
|
@@ -361,7 +341,7 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
361
341
|
onClick: () => setSelectedYear("last")
|
|
362
342
|
}
|
|
363
343
|
),
|
|
364
|
-
years.map((y) => /* @__PURE__ */
|
|
344
|
+
years.map((y) => /* @__PURE__ */ jsx(
|
|
365
345
|
YearPill,
|
|
366
346
|
{
|
|
367
347
|
label: String(y),
|
|
@@ -372,12 +352,11 @@ function GithubActivity({ username, theme = "dark", className }) {
|
|
|
372
352
|
))
|
|
373
353
|
] })
|
|
374
354
|
] }) }),
|
|
375
|
-
tip && /* @__PURE__ */
|
|
355
|
+
tip && /* @__PURE__ */ jsx(Tooltip, { day: tip.day, x: tip.x, y: tip.y })
|
|
376
356
|
] });
|
|
377
357
|
}
|
|
378
|
-
var GithubActivity_default =
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
});
|
|
358
|
+
var GithubActivity_default = memo(GithubActivity);
|
|
359
|
+
export {
|
|
360
|
+
GithubActivity_default as GithubActivity
|
|
361
|
+
};
|
|
383
362
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/GithubActivity.tsx"],"sourcesContent":["export { default as GithubActivity } from \"./GithubActivity\";","import { memo, useEffect, useState, useMemo } from \"react\";\r\n\r\ntype Theme = \"light\" | \"dark\" | \"blue\" | \"purple\";\r\n\r\ninterface Day {\r\n date: string;\r\n count: number;\r\n level: 0 | 1 | 2 | 3 | 4;\r\n}\r\n\r\ninterface Props {\r\n username: string;\r\n theme?: Theme;\r\n className?: string;\r\n}\r\n\r\n/* ---------- Constants ---------- */\r\n\r\nconst MONTHS = [\r\n \"Jan\",\r\n \"Feb\",\r\n \"Mar\",\r\n \"Apr\",\r\n \"May\",\r\n \"Jun\",\r\n \"Jul\",\r\n \"Aug\",\r\n \"Sep\",\r\n \"Oct\",\r\n \"Nov\",\r\n \"Dec\",\r\n];\r\nconst DAY_LABELS: Record<number, string> = { 1: \"Mon\", 3: \"Wed\", 5: \"Fri\" };\r\n\r\nconst CELL = 13;\r\nconst GAP = 3;\r\nconst STEP = CELL + GAP;\r\nconst DAY_COL_W = 30;\r\n\r\n/* ---------- Color Themes ---------- */\r\n\r\nconst LIGHT = [\"#ebedf0\", \"#9be9a8\", \"#40c463\", \"#30a14e\", \"#216e39\"];\r\nconst DARK = [\"#21262d\", \"#0e4429\", \"#006d32\", \"#26a641\", \"#39d353\"];\r\nconst BLUE = [\"#21262d\", \"#a3c9ff\", \"#5fa3ff\", \"#2f7bff\", \"#0b5cff\"];\r\nconst PURPLE = [\"#21262d\", \"#d8b4ff\", \"#c084fc\", \"#a855f7\", \"#7e22ce\"];\r\n\r\nconst COLOR_MAP: Record<Theme, string[]> = {\r\n light: LIGHT,\r\n dark: DARK,\r\n blue: BLUE,\r\n purple: PURPLE,\r\n};\r\n\r\n/* ---------- Utilities ---------- */\r\n\r\nfunction toLevel(count: number): 0 | 1 | 2 | 3 | 4 {\r\n if (count === 0) return 0;\r\n if (count <= 3) return 1;\r\n if (count <= 6) return 2;\r\n if (count <= 9) return 3;\r\n return 4;\r\n}\r\n\r\nfunction buildGrid(\r\n dayMap: Map<string, Day>,\r\n year: number | \"last\",\r\n): (Day | null)[][] {\r\n let start: Date;\r\n let end: Date;\r\n\r\n if (year === \"last\") {\r\n end = new Date();\r\n start = new Date(end);\r\n start.setFullYear(start.getFullYear() - 1);\r\n start.setDate(start.getDate() + 1);\r\n } else {\r\n start = new Date(year, 0, 1);\r\n end =\r\n year === new Date().getFullYear() ? new Date() : new Date(year, 11, 31);\r\n }\r\n\r\n start.setDate(start.getDate() - start.getDay());\r\n\r\n const weeks: (Day | null)[][] = [];\r\n const cur = new Date(start);\r\n\r\n while (cur <= end) {\r\n const week: (Day | null)[] = [];\r\n\r\n for (let d = 0; d < 7; d++) {\r\n const iso = cur.toISOString().slice(0, 10);\r\n\r\n if (cur > end) {\r\n week.push(null);\r\n } else {\r\n week.push(\r\n dayMap.get(iso) ?? {\r\n date: iso,\r\n count: 0,\r\n level: 0,\r\n },\r\n );\r\n }\r\n\r\n cur.setDate(cur.getDate() + 1);\r\n }\r\n\r\n weeks.push(week);\r\n }\r\n\r\n return weeks;\r\n}\r\n\r\nfunction monthLabels(grid: (Day | null)[][]) {\r\n const out: { label: string; col: number }[] = [];\r\n let last = -1;\r\n\r\n grid.forEach((week, i) => {\r\n const first = week.find(Boolean);\r\n if (!first) return;\r\n\r\n const m = new Date(first.date).getMonth();\r\n\r\n if (m !== last) {\r\n out.push({ label: MONTHS[m], col: i });\r\n last = m;\r\n }\r\n });\r\n\r\n return out;\r\n}\r\n\r\n/* ---------- UI Components ---------- */\r\n\r\nfunction Tooltip({ day, x, y }: { day: Day; x: number; y: number }) {\r\n const label = new Date(day.date).toLocaleDateString(\"en-US\", {\r\n weekday: \"long\",\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n });\r\n\r\n return (\r\n <div\r\n className=\"fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white dark:bg-white dark:text-neutral-900\"\r\n style={{ left: x, top: y - 8 }}\r\n >\r\n <b>\r\n {day.count} contribution{day.count !== 1 ? \"s\" : \"\"}\r\n </b>{\" \"}\r\n · {label}\r\n </div>\r\n );\r\n}\r\n\r\nfunction Skeleton() {\r\n return (\r\n <div className=\"flex gap-[3px] animate-pulse opacity-40\">\r\n {Array.from({ length: 53 }).map((_, w) => (\r\n <div key={w} className=\"flex flex-col gap-[3px]\">\r\n {Array.from({ length: 7 }).map((_, d) => (\r\n <div\r\n key={d}\r\n className=\"w-[13px] h-[13px] rounded-[3px] bg-neutral-300 dark:bg-neutral-700\"\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\nfunction YearPill({\r\n label,\r\n active,\r\n onClick,\r\n}: {\r\n label: string;\r\n active: boolean;\r\n onClick: () => void;\r\n}) {\r\n return (\r\n <button\r\n onClick={onClick}\r\n className={[\r\n \"px-2.5 py-0.5 rounded-full text-[11px] font-medium transition-colors duration-150\",\r\n active\r\n ? \"bg-neutral-900 text-white dark:bg-white dark:text-neutral-900\"\r\n : \"bg-neutral-100 text-neutral-600 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-400 dark:hover:bg-neutral-700\",\r\n ].join(\" \")}\r\n >\r\n {label}\r\n </button>\r\n );\r\n}\r\n\r\n/* ---------- Main Component ---------- */\r\n\r\nfunction GithubActivity({ username, theme = \"dark\", className }: Props) {\r\n const [allDays, setAllDays] = useState<Map<string, Day>>(new Map());\r\n const [years, setYears] = useState<number[]>([]);\r\n const [selectedYear, setSelectedYear] = useState<number | \"last\">(\"last\");\r\n const [total, setTotal] = useState<number | null>(null);\r\n const [bestDay, setBestDay] = useState<Day | null>(null);\r\n const [loading, setLoading] = useState(true);\r\n const [error, setError] = useState(false);\r\n const [tip, setTip] = useState<{ day: Day; x: number; y: number } | null>(\r\n null,\r\n );\r\n\r\n const colors = COLOR_MAP[theme] ?? COLOR_MAP.dark;\r\n\r\n /* Fetch Contributions */\r\n\r\n useEffect(() => {\r\n if (!username) return;\r\n\r\n let mounted = true;\r\n setLoading(true);\r\n setError(false);\r\n\r\n (async () => {\r\n try {\r\n const res = await fetch(\r\n `https://github-contributions-api.jogruber.de/v4/${username}?y=all`,\r\n );\r\n\r\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\r\n\r\n const json = await res.json();\r\n const raw: { date: string; count: number }[] = json.contributions ?? [];\r\n\r\n if (!raw.length) throw new Error(\"empty data\");\r\n\r\n const map = new Map<string, Day>();\r\n const yearSet = new Set<number>();\r\n\r\n raw.forEach((c) => {\r\n map.set(c.date, {\r\n date: c.date,\r\n count: c.count,\r\n level: toLevel(c.count),\r\n });\r\n\r\n yearSet.add(new Date(c.date).getFullYear());\r\n });\r\n\r\n if (mounted) {\r\n setAllDays(map);\r\n setYears(Array.from(yearSet).sort((a, b) => b - a));\r\n setLoading(false);\r\n }\r\n } catch (err) {\r\n console.warn(\"GithubActivity fetch error:\", err);\r\n\r\n if (mounted) {\r\n setError(true);\r\n setLoading(false);\r\n }\r\n }\r\n })();\r\n\r\n return () => {\r\n mounted = false;\r\n };\r\n }, [username]);\r\n\r\n /* Stats Calculation */\r\n\r\n useEffect(() => {\r\n if (!allDays.size) return;\r\n\r\n const entries = Array.from(allDays.values()).filter((d) => {\r\n if (selectedYear === \"last\") {\r\n const oneYearAgo = new Date();\r\n oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);\r\n return new Date(d.date) >= oneYearAgo;\r\n }\r\n\r\n return new Date(d.date).getFullYear() === selectedYear;\r\n });\r\n\r\n const sum = entries.reduce((s, d) => s + d.count, 0);\r\n\r\n const best = entries.reduce<Day | null>(\r\n (b, d) => (!b || d.count > b.count ? d : b),\r\n null,\r\n );\r\n\r\n setTotal(sum);\r\n setBestDay(best && best.count > 0 ? best : null);\r\n }, [allDays, selectedYear]);\r\n\r\n /* Rendering Helpers */\r\n\r\n const grid = useMemo(\r\n () => (allDays.size ? buildGrid(allDays, selectedYear) : []),\r\n [allDays, selectedYear],\r\n );\r\n\r\n const labels = useMemo(() => monthLabels(grid), [grid]);\r\n\r\n const outlineColor = theme === \"light\" ? \"#333\" : \"#f0f0f0\";\r\n\r\n const bestDateLabel = bestDay\r\n ? new Date(bestDay.date).toLocaleDateString(\"en-US\", {\r\n month: \"short\",\r\n day: \"numeric\",\r\n year: \"numeric\",\r\n })\r\n : null;\r\n\r\n const periodLabel =\r\n selectedYear === \"last\" ? \" in the last year\" : ` in ${selectedYear}`;\r\n\r\n return (\r\n <section className={[\"w-full font-mono\", className].join(\" \").trim()}>\r\n <div className=\"flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-500 dark:text-neutral-400\">\r\n {loading ? (\r\n \"Loading…\"\r\n ) : error ? (\r\n \"Unavailable\"\r\n ) : (\r\n <>\r\n <span className=\"font-semibold text-neutral-700 dark:text-neutral-200\">\r\n {total?.toLocaleString()}\r\n </span>\r\n {\" contributions\"}\r\n {periodLabel}\r\n </>\r\n )}\r\n\r\n {bestDay && !loading && (\r\n <span className=\"flex items-center gap-1.5\">\r\n <span\r\n className=\"inline-block w-[10px] h-[10px] rounded-[2px]\"\r\n style={{ backgroundColor: colors[4] }}\r\n />\r\n Best day:\r\n <span className=\"font-semibold text-neutral-700 dark:text-neutral-200\">\r\n {bestDay.count} contributions\r\n </span>\r\n on {bestDateLabel}\r\n </span>\r\n )}\r\n </div>\r\n\r\n <div className=\"border border-neutral-200 dark:border-neutral-800 rounded-xl p-4 bg-white dark:bg-neutral-950\">\r\n {error ? (\r\n <p className=\"text-sm italic text-neutral-400\">\r\n GitHub activity unavailable.\r\n </p>\r\n ) : loading ? (\r\n <Skeleton />\r\n ) : (\r\n <>\r\n <div className=\"overflow-x-auto overflow-y-visible pb-1\">\r\n <div\r\n className=\"relative\"\r\n style={{\r\n minWidth: grid.length * STEP + DAY_COL_W + 8,\r\n }}\r\n >\r\n <div\r\n className=\"relative h-[18px] mb-1\"\r\n style={{ marginLeft: DAY_COL_W }}\r\n >\r\n {labels.map(({ label, col }) => (\r\n <span\r\n key={`${label}-${col}`}\r\n className=\"absolute text-[11px] select-none text-neutral-500 dark:text-neutral-400\"\r\n style={{ left: col * STEP }}\r\n >\r\n {label}\r\n </span>\r\n ))}\r\n </div>\r\n\r\n <div className=\"flex gap-[3px]\">\r\n <div\r\n className=\"flex flex-col gap-[3px] pt-px shrink-0\"\r\n style={{ width: DAY_COL_W - GAP }}\r\n >\r\n {Array.from({ length: 7 }).map((_, i) => (\r\n <div\r\n key={i}\r\n className=\"h-[13px] text-[10px] leading-[13px] text-right pr-1.5 select-none text-neutral-500 dark:text-neutral-400\"\r\n >\r\n {DAY_LABELS[i] ?? \"\"}\r\n </div>\r\n ))}\r\n </div>\r\n\r\n {grid.map((week, wi) => (\r\n <div key={wi} className=\"flex flex-col gap-[3px]\">\r\n {week.map((day, di) => (\r\n <div\r\n key={di}\r\n className=\"w-[13px] h-[13px] rounded-[3px] transition-transform duration-100 hover:scale-125\"\r\n style={{\r\n backgroundColor: day\r\n ? colors[day.level]\r\n : \"transparent\",\r\n cursor: day ? \"pointer\" : \"default\",\r\n outline:\r\n bestDay && day?.date === bestDay.date\r\n ? `2px solid ${outlineColor}`\r\n : \"none\",\r\n outlineOffset: \"1px\",\r\n }}\r\n onMouseEnter={(e) => {\r\n if (!day) return;\r\n\r\n const r = e.currentTarget.getBoundingClientRect();\r\n\r\n setTip({\r\n day,\r\n x: r.left + r.width / 2,\r\n y: r.top,\r\n });\r\n }}\r\n onMouseLeave={() => setTip(null)}\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"flex items-center justify-start gap-1 mt-3\">\r\n <span className=\"text-[11px] text-neutral-500 dark:text-neutral-400 mr-1\">\r\n Less\r\n </span>\r\n\r\n {colors.map((c, i) => (\r\n <div\r\n key={i}\r\n className=\"w-[13px] h-[13px] rounded-[3px]\"\r\n style={{ backgroundColor: c }}\r\n />\r\n ))}\r\n\r\n <span className=\"text-[11px] text-neutral-500 dark:text-neutral-400 ml-1\">\r\n More\r\n </span>\r\n </div>\r\n\r\n <div className=\"flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-100 dark:border-neutral-800\">\r\n <span className=\"text-[11px] text-neutral-400 mr-1\">Year:</span>\r\n\r\n <YearPill\r\n label=\"Last year\"\r\n active={selectedYear === \"last\"}\r\n onClick={() => setSelectedYear(\"last\")}\r\n />\r\n\r\n {years.map((y) => (\r\n <YearPill\r\n key={y}\r\n label={String(y)}\r\n active={selectedYear === y}\r\n onClick={() => setSelectedYear(y)}\r\n />\r\n ))}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n\r\n {tip && <Tooltip day={tip.day} x={tip.x} y={tip.y} />}\r\n </section>\r\n );\r\n}\r\n\r\nexport default memo(GithubActivity);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAmD;AAmJ7C;AAjIN,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,aAAqC,EAAE,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM;AAE1E,IAAM,OAAO;AACb,IAAM,MAAM;AACZ,IAAM,OAAO,OAAO;AACpB,IAAM,YAAY;AAIlB,IAAM,QAAQ,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACpE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,SAAS,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AAErE,IAAM,YAAqC;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AACV;AAIA,SAAS,QAAQ,OAAkC;AACjD,MAAI,UAAU,EAAG,QAAO;AACxB,MAAI,SAAS,EAAG,QAAO;AACvB,MAAI,SAAS,EAAG,QAAO;AACvB,MAAI,SAAS,EAAG,QAA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AAA,UAFvB;AAAA,QAGP,CACD;AAAA,QAED,4CAAC,UAAK,WAAU,2DAA0D,kBAE1E;AAAA,SACF;AAAA,MAEA,6CAAC,SAAI,WAAU,qGACb;AAAA,oDAAC,UAAK,WAAU,qCAAoC,mBAAK;AAAA,QAEzD;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,QAAQ,iBAAiB;AAAA,YACzB,SAAS,MAAM,gBAAgB,MAAM;AAAA;AAAA,QACvC;AAAA,QAEC,MAAM,IAAI,CAAC,MACV;AAAA,UAAC;AAAA;AAAA,YAEC,OAAO,OAAO,CAAC;AAAA,YACf,QAAQ,iBAAiB;AAAA,YACzB,SAAS,MAAM,gBAAgB,CAAC;AAAA;AAAA,UAH3B;AAAA,QAIP,CACD;AAAA,SACH;AAAA,OACF,GAEJ;AAAA,IAEC,OAAO,4CAAC,WAAQ,KAAK,IAAI,KAAK,GAAG,IAAI,GAAG,GAAG,IAAI,GAAG;AAAA,KACrD;AAEJ;AAEA,IAAO,6BAAQ,mBAAK,cAAc;","names":["_"]}
|
|
1
|
+
{"version":3,"sources":["../src/GithubActivity.tsx"],"sourcesContent":["import { memo, useEffect, useState, useMemo } from \"react\";\r\n\r\ntype Theme = \"light\" | \"dark\" | \"blue\" | \"purple\";\r\n\r\ninterface Day {\r\n date: string;\r\n count: number;\r\n level: 0 | 1 | 2 | 3 | 4;\r\n}\r\n\r\ninterface Props {\r\n username: string;\r\n theme?: Theme;\r\n className?: string;\r\n}\r\n\r\n/* ---------- Constants ---------- */\r\n\r\nconst MONTHS = [\r\n \"Jan\",\r\n \"Feb\",\r\n \"Mar\",\r\n \"Apr\",\r\n \"May\",\r\n \"Jun\",\r\n \"Jul\",\r\n \"Aug\",\r\n \"Sep\",\r\n \"Oct\",\r\n \"Nov\",\r\n \"Dec\",\r\n];\r\nconst DAY_LABELS: Record<number, string> = { 1: \"Mon\", 3: \"Wed\", 5: \"Fri\" };\r\n\r\nconst CELL = 13;\r\nconst GAP = 3;\r\nconst STEP = CELL + GAP;\r\nconst DAY_COL_W = 30;\r\n\r\n/* ---------- Color Themes ---------- */\r\n\r\nconst LIGHT = [\"#ebedf0\", \"#9be9a8\", \"#40c463\", \"#30a14e\", \"#216e39\"];\r\nconst DARK = [\"#21262d\", \"#0e4429\", \"#006d32\", \"#26a641\", \"#39d353\"];\r\nconst BLUE = [\"#21262d\", \"#a3c9ff\", \"#5fa3ff\", \"#2f7bff\", \"#0b5cff\"];\r\nconst PURPLE = [\"#21262d\", \"#d8b4ff\", \"#c084fc\", \"#a855f7\", \"#7e22ce\"];\r\n\r\nconst COLOR_MAP: Record<Theme, string[]> = {\r\n light: LIGHT,\r\n dark: DARK,\r\n blue: BLUE,\r\n purple: PURPLE,\r\n};\r\n\r\n/* ---------- Utilities ---------- */\r\n\r\nfunction toLevel(count: number): 0 | 1 | 2 | 3 | 4 {\r\n if (count === 0) return 0;\r\n if (count <= 3) return 1;\r\n if (count <= 6) return 2;\r\n if (count <= 9) return 3;\r\n return 4;\r\n}\r\n\r\nfunction buildGrid(\r\n dayMap: Map<string, Day>,\r\n year: number | \"last\",\r\n): (Day | null)[][] {\r\n let start: Date;\r\n let end: Date;\r\n\r\n if (year === \"last\") {\r\n end = new Date();\r\n start = new Date(end);\r\n start.setFullYear(start.getFullYear() - 1);\r\n start.setDate(start.getDate() + 1);\r\n } else {\r\n start = new Date(year, 0, 1);\r\n end =\r\n year === new Date().getFullYear() ? new Date() : new Date(year, 11, 31);\r\n }\r\n\r\n start.setDate(start.getDate() - start.getDay());\r\n\r\n const weeks: (Day | null)[][] = [];\r\n const cur = new Date(start);\r\n\r\n while (cur <= end) {\r\n const week: (Day | null)[] = [];\r\n\r\n for (let d = 0; d < 7; d++) {\r\n const iso = cur.toISOString().slice(0, 10);\r\n\r\n if (cur > end) {\r\n week.push(null);\r\n } else {\r\n week.push(\r\n dayMap.get(iso) ?? {\r\n date: iso,\r\n count: 0,\r\n level: 0,\r\n },\r\n );\r\n }\r\n\r\n cur.setDate(cur.getDate() + 1);\r\n }\r\n\r\n weeks.push(week);\r\n }\r\n\r\n return weeks;\r\n}\r\n\r\nfunction monthLabels(grid: (Day | null)[][]) {\r\n const out: { label: string; col: number }[] = [];\r\n let last = -1;\r\n\r\n grid.forEach((week, i) => {\r\n const first = week.find(Boolean);\r\n if (!first) return;\r\n\r\n const m = new Date(first.date).getMonth();\r\n\r\n if (m !== last) {\r\n out.push({ label: MONTHS[m], col: i });\r\n last = m;\r\n }\r\n });\r\n\r\n return out;\r\n}\r\n\r\n/* ---------- UI Components ---------- */\r\n\r\nfunction Tooltip({ day, x, y }: { day: Day; x: number; y: number }) {\r\n const label = new Date(day.date).toLocaleDateString(\"en-US\", {\r\n weekday: \"long\",\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n });\r\n\r\n return (\r\n <div\r\n className=\"fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white dark:bg-white dark:text-neutral-900\"\r\n style={{ left: x, top: y - 8 }}\r\n >\r\n <b>\r\n {day.count} contribution{day.count !== 1 ? \"s\" : \"\"}\r\n </b>{\" \"}\r\n · {label}\r\n </div>\r\n );\r\n}\r\n\r\nfunction Skeleton() {\r\n return (\r\n <div className=\"flex gap-[3px] animate-pulse opacity-40\">\r\n {Array.from({ length: 53 }).map((_, w) => (\r\n <div key={w} className=\"flex flex-col gap-[3px]\">\r\n {Array.from({ length: 7 }).map((_, d) => (\r\n <div\r\n key={d}\r\n className=\"w-[13px] h-[13px] rounded-[3px] bg-neutral-300 dark:bg-neutral-700\"\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\nfunction YearPill({\r\n label,\r\n active,\r\n onClick,\r\n}: {\r\n label: string;\r\n active: boolean;\r\n onClick: () => void;\r\n}) {\r\n return (\r\n <button\r\n onClick={onClick}\r\n className={[\r\n \"px-2.5 py-0.5 rounded-full text-[11px] font-medium transition-colors duration-150\",\r\n active\r\n ? \"bg-neutral-900 text-white dark:bg-white dark:text-neutral-900\"\r\n : \"bg-neutral-100 text-neutral-600 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-400 dark:hover:bg-neutral-700\",\r\n ].join(\" \")}\r\n >\r\n {label}\r\n </button>\r\n );\r\n}\r\n\r\n/* ---------- Main Component ---------- */\r\n\r\nfunction GithubActivity({ username, theme = \"dark\", className }: Props) {\r\n const [allDays, setAllDays] = useState<Map<string, Day>>(new Map());\r\n const [years, setYears] = useState<number[]>([]);\r\n const [selectedYear, setSelectedYear] = useState<number | \"last\">(\"last\");\r\n const [total, setTotal] = useState<number | null>(null);\r\n const [bestDay, setBestDay] = useState<Day | null>(null);\r\n const [loading, setLoading] = useState(true);\r\n const [error, setError] = useState(false);\r\n const [tip, setTip] = useState<{ day: Day; x: number; y: number } | null>(\r\n null,\r\n );\r\n\r\n const colors = COLOR_MAP[theme] ?? COLOR_MAP.dark;\r\n\r\n /* Fetch Contributions */\r\n\r\n useEffect(() => {\r\n if (!username) return;\r\n\r\n let mounted = true;\r\n setLoading(true);\r\n setError(false);\r\n\r\n (async () => {\r\n try {\r\n const res = await fetch(\r\n `https://github-contributions-api.jogruber.de/v4/${username}?y=all`,\r\n );\r\n\r\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\r\n\r\n const json = await res.json();\r\n const raw: { date: string; count: number }[] = json.contributions ?? [];\r\n\r\n if (!raw.length) throw new Error(\"empty data\");\r\n\r\n const map = new Map<string, Day>();\r\n const yearSet = new Set<number>();\r\n\r\n raw.forEach((c) => {\r\n map.set(c.date, {\r\n date: c.date,\r\n count: c.count,\r\n level: toLevel(c.count),\r\n });\r\n\r\n yearSet.add(new Date(c.date).getFullYear());\r\n });\r\n\r\n if (mounted) {\r\n setAllDays(map);\r\n setYears(Array.from(yearSet).sort((a, b) => b - a));\r\n setLoading(false);\r\n }\r\n } catch (err) {\r\n console.warn(\"GithubActivity fetch error:\", err);\r\n\r\n if (mounted) {\r\n setError(true);\r\n setLoading(false);\r\n }\r\n }\r\n })();\r\n\r\n return () => {\r\n mounted = false;\r\n };\r\n }, [username]);\r\n\r\n /* Stats Calculation */\r\n\r\n useEffect(() => {\r\n if (!allDays.size) return;\r\n\r\n const entries = Array.from(allDays.values()).filter((d) => {\r\n if (selectedYear === \"last\") {\r\n const oneYearAgo = new Date();\r\n oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);\r\n return new Date(d.date) >= oneYearAgo;\r\n }\r\n\r\n return new Date(d.date).getFullYear() === selectedYear;\r\n });\r\n\r\n const sum = entries.reduce((s, d) => s + d.count, 0);\r\n\r\n const best = entries.reduce<Day | null>(\r\n (b, d) => (!b || d.count > b.count ? d : b),\r\n null,\r\n );\r\n\r\n setTotal(sum);\r\n setBestDay(best && best.count > 0 ? best : null);\r\n }, [allDays, selectedYear]);\r\n\r\n /* Rendering Helpers */\r\n\r\n const grid = useMemo(\r\n () => (allDays.size ? buildGrid(allDays, selectedYear) : []),\r\n [allDays, selectedYear],\r\n );\r\n\r\n const labels = useMemo(() => monthLabels(grid), [grid]);\r\n\r\n const outlineColor = theme === \"light\" ? \"#333\" : \"#f0f0f0\";\r\n\r\n const bestDateLabel = bestDay\r\n ? new Date(bestDay.date).toLocaleDateString(\"en-US\", {\r\n month: \"short\",\r\n day: \"numeric\",\r\n year: \"numeric\",\r\n })\r\n : null;\r\n\r\n const periodLabel =\r\n selectedYear === \"last\" ? \" in the last year\" : ` in ${selectedYear}`;\r\n\r\n return (\r\n <section className={[\"w-full font-mono\", className].join(\" \").trim()}>\r\n <div className=\"flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-500 dark:text-neutral-400\">\r\n {loading ? (\r\n \"Loading…\"\r\n ) : error ? (\r\n \"Unavailable\"\r\n ) : (\r\n <>\r\n <span className=\"font-semibold text-neutral-700 dark:text-neutral-200\">\r\n {total?.toLocaleString()}\r\n </span>\r\n {\" contributions\"}\r\n {periodLabel}\r\n </>\r\n )}\r\n\r\n {bestDay && !loading && (\r\n <span className=\"flex items-center gap-1.5\">\r\n <span\r\n className=\"inline-block w-[10px] h-[10px] rounded-[2px]\"\r\n style={{ backgroundColor: colors[4] }}\r\n />\r\n Best day:\r\n <span className=\"font-semibold text-neutral-700 dark:text-neutral-200\">\r\n {bestDay.count} contributions\r\n </span>\r\n on {bestDateLabel}\r\n </span>\r\n )}\r\n </div>\r\n\r\n <div className=\"border border-neutral-200 dark:border-neutral-800 rounded-xl p-4 bg-white dark:bg-neutral-950\">\r\n {error ? (\r\n <p className=\"text-sm italic text-neutral-400\">\r\n GitHub activity unavailable.\r\n </p>\r\n ) : loading ? (\r\n <Skeleton />\r\n ) : (\r\n <>\r\n <div className=\"overflow-x-auto overflow-y-visible pb-1\">\r\n <div\r\n className=\"relative\"\r\n style={{\r\n minWidth: grid.length * STEP + DAY_COL_W + 8,\r\n }}\r\n >\r\n <div\r\n className=\"relative h-[18px] mb-1\"\r\n style={{ marginLeft: DAY_COL_W }}\r\n >\r\n {labels.map(({ label, col }) => (\r\n <span\r\n key={`${label}-${col}`}\r\n className=\"absolute text-[11px] select-none text-neutral-500 dark:text-neutral-400\"\r\n style={{ left: col * STEP }}\r\n >\r\n {label}\r\n </span>\r\n ))}\r\n </div>\r\n\r\n <div className=\"flex gap-[3px]\">\r\n <div\r\n className=\"flex flex-col gap-[3px] pt-px shrink-0\"\r\n style={{ width: DAY_COL_W - GAP }}\r\n >\r\n {Array.from({ length: 7 }).map((_, i) => (\r\n <div\r\n key={i}\r\n className=\"h-[13px] text-[10px] leading-[13px] text-right pr-1.5 select-none text-neutral-500 dark:text-neutral-400\"\r\n >\r\n {DAY_LABELS[i] ?? \"\"}\r\n </div>\r\n ))}\r\n </div>\r\n\r\n {grid.map((week, wi) => (\r\n <div key={wi} className=\"flex flex-col gap-[3px]\">\r\n {week.map((day, di) => (\r\n <div\r\n key={di}\r\n className=\"w-[13px] h-[13px] rounded-[3px] transition-transform duration-100 hover:scale-125\"\r\n style={{\r\n backgroundColor: day\r\n ? colors[day.level]\r\n : \"transparent\",\r\n cursor: day ? \"pointer\" : \"default\",\r\n outline:\r\n bestDay && day?.date === bestDay.date\r\n ? `2px solid ${outlineColor}`\r\n : \"none\",\r\n outlineOffset: \"1px\",\r\n }}\r\n onMouseEnter={(e) => {\r\n if (!day) return;\r\n\r\n const r = e.currentTarget.getBoundingClientRect();\r\n\r\n setTip({\r\n day,\r\n x: r.left + r.width / 2,\r\n y: r.top,\r\n });\r\n }}\r\n onMouseLeave={() => setTip(null)}\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"flex items-center justify-start gap-1 mt-3\">\r\n <span className=\"text-[11px] text-neutral-500 dark:text-neutral-400 mr-1\">\r\n Less\r\n </span>\r\n\r\n {colors.map((c, i) => (\r\n <div\r\n key={i}\r\n className=\"w-[13px] h-[13px] rounded-[3px]\"\r\n style={{ backgroundColor: c }}\r\n />\r\n ))}\r\n\r\n <span className=\"text-[11px] text-neutral-500 dark:text-neutral-400 ml-1\">\r\n More\r\n </span>\r\n </div>\r\n\r\n <div className=\"flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-100 dark:border-neutral-800\">\r\n <span className=\"text-[11px] text-neutral-400 mr-1\">Year:</span>\r\n\r\n <YearPill\r\n label=\"Last year\"\r\n active={selectedYear === \"last\"}\r\n onClick={() => setSelectedYear(\"last\")}\r\n />\r\n\r\n {years.map((y) => (\r\n <YearPill\r\n key={y}\r\n label={String(y)}\r\n active={selectedYear === y}\r\n onClick={() => setSelectedYear(y)}\r\n />\r\n ))}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n\r\n {tip && <Tooltip day={tip.day} x={tip.x} y={tip.y} />}\r\n </section>\r\n );\r\n}\r\n\r\nexport default memo(GithubActivity);\r\n"],"mappings":";AAAA,SAAS,MAAM,WAAW,UAAU,eAAe;AAmJ7C,SAgLI,UAlKE,KA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O,OAAO,CAAC;AAAA,YACf,QAAQ,iBAAiB;AAAA,YACzB,SAAS,MAAM,gBAAgB,CAAC;AAAA;AAAA,UAH3B;AAAA,QAIP,CACD;AAAA,SACH;AAAA,OACF,GAEJ;AAAA,IAEC,OAAO,oBAAC,WAAQ,KAAK,IAAI,KAAK,GAAG,IAAI,GAAG,GAAG,IAAI,GAAG;AAAA,KACrD;AAEJ;AAEA,IAAO,yBAAQ,KAAK,cAAc;","names":["_","_a"]}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-leading:initial;--tw-outline-style:solid;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.z-50{z-index:50}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.h-\[10px\]{height:10px}.h-\[13px\]{height:13px}.h-\[18px\]{height:18px}.w-\[10px\]{width:10px}.w-\[13px\]{width:13px}.w-full{width:100%}.flex-shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-full{--tw-translate-y:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-start{justify-content:flex-start}.gap-\[3px\]{gap:3px}.overflow-x-auto{overflow-x:auto}.overflow-y-visible{overflow-y:visible}.rounded-\[2px\]{border-radius:2px}.rounded-\[3px\]{border-radius:3px}.rounded-full{border-radius:3.40282e38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.pt-px{padding-top:1px}.text-right{text-align:right}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-\[13px\]{--tw-leading:13px;line-height:13px}.whitespace-nowrap{white-space:nowrap}.italic{font-style:italic}.opacity-40{opacity:.4}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.hover\:scale-125:hover{--tw-scale-x:125%;--tw-scale-y:125%;--tw-scale-z:125%;scale:var(--tw-scale-x) var(--tw-scale-y)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
|
package/package.json
CHANGED
|
@@ -1,25 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-contributions-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "GitHub contributions graph React component",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"style": "./dist/styles.css",
|
|
10
|
+
"sideEffects": [
|
|
11
|
+
"*.css"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
9
23
|
"scripts": {
|
|
10
|
-
"build": "tsup",
|
|
24
|
+
"build": "tsup && npm run build:css",
|
|
25
|
+
"build:css": "npx tailwindcss -i ./src/styles.css -o ./dist/styles.css --minify",
|
|
11
26
|
"publish-package": "npm run build && npm publish --access public"
|
|
12
27
|
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
|
|
28
|
+
"keywords": [
|
|
29
|
+
"github",
|
|
30
|
+
"react",
|
|
31
|
+
"contributions",
|
|
32
|
+
"graph",
|
|
33
|
+
"ui"
|
|
34
|
+
],
|
|
15
35
|
"license": "MIT",
|
|
16
|
-
"
|
|
17
|
-
"react": "
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": ">=18"
|
|
18
38
|
},
|
|
19
39
|
"devDependencies": {
|
|
40
|
+
"@tailwindcss/cli": "^4.2.1",
|
|
41
|
+
"@tailwindcss/postcss": "^4.2.1",
|
|
20
42
|
"@types/react": "^18.0.0",
|
|
43
|
+
"autoprefixer": "^10.4.27",
|
|
44
|
+
"postcss": "^8.5.6",
|
|
45
|
+
"tailwindcss": "^4.2.1",
|
|
21
46
|
"tsup": "^8.5.1",
|
|
22
47
|
"typescript": "^5.9.3"
|
|
23
48
|
}
|
|
24
49
|
}
|
|
25
|
-
|
package/readme.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# github-contributions-ui
|
|
2
|
+
|
|
3
|
+
GitHub contributions graph React component.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
npm install github-contributions-ui
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
"use client";
|
|
12
|
+
import { GithubActivity } from "github-contributions-ui";
|
|
13
|
+
|
|
14
|
+
<GithubActivity username="octocat" />
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/GithubActivity.tsx"],"sourcesContent":["import { memo, useEffect, useState, useMemo } from \"react\";\r\n\r\ntype Theme = \"light\" | \"dark\" | \"blue\" | \"purple\";\r\n\r\ninterface Day {\r\n date: string;\r\n count: number;\r\n level: 0 | 1 | 2 | 3 | 4;\r\n}\r\n\r\ninterface Props {\r\n username: string;\r\n theme?: Theme;\r\n className?: string;\r\n}\r\n\r\n/* ---------- Constants ---------- */\r\n\r\nconst MONTHS = [\r\n \"Jan\",\r\n \"Feb\",\r\n \"Mar\",\r\n \"Apr\",\r\n \"May\",\r\n \"Jun\",\r\n \"Jul\",\r\n \"Aug\",\r\n \"Sep\",\r\n \"Oct\",\r\n \"Nov\",\r\n \"Dec\",\r\n];\r\nconst DAY_LABELS: Record<number, string> = { 1: \"Mon\", 3: \"Wed\", 5: \"Fri\" };\r\n\r\nconst CELL = 13;\r\nconst GAP = 3;\r\nconst STEP = CELL + GAP;\r\nconst DAY_COL_W = 30;\r\n\r\n/* ---------- Color Themes ---------- */\r\n\r\nconst LIGHT = [\"#ebedf0\", \"#9be9a8\", \"#40c463\", \"#30a14e\", \"#216e39\"];\r\nconst DARK = [\"#21262d\", \"#0e4429\", \"#006d32\", \"#26a641\", \"#39d353\"];\r\nconst BLUE = [\"#21262d\", \"#a3c9ff\", \"#5fa3ff\", \"#2f7bff\", \"#0b5cff\"];\r\nconst PURPLE = [\"#21262d\", \"#d8b4ff\", \"#c084fc\", \"#a855f7\", \"#7e22ce\"];\r\n\r\nconst COLOR_MAP: Record<Theme, string[]> = {\r\n light: LIGHT,\r\n dark: DARK,\r\n blue: BLUE,\r\n purple: PURPLE,\r\n};\r\n\r\n/* ---------- Utilities ---------- */\r\n\r\nfunction toLevel(count: number): 0 | 1 | 2 | 3 | 4 {\r\n if (count === 0) return 0;\r\n if (count <= 3) return 1;\r\n if (count <= 6) return 2;\r\n if (count <= 9) return 3;\r\n return 4;\r\n}\r\n\r\nfunction buildGrid(\r\n dayMap: Map<string, Day>,\r\n year: number | \"last\",\r\n): (Day | null)[][] {\r\n let start: Date;\r\n let end: Date;\r\n\r\n if (year === \"last\") {\r\n end = new Date();\r\n start = new Date(end);\r\n start.setFullYear(start.getFullYear() - 1);\r\n start.setDate(start.getDate() + 1);\r\n } else {\r\n start = new Date(year, 0, 1);\r\n end =\r\n year === new Date().getFullYear() ? new Date() : new Date(year, 11, 31);\r\n }\r\n\r\n start.setDate(start.getDate() - start.getDay());\r\n\r\n const weeks: (Day | null)[][] = [];\r\n const cur = new Date(start);\r\n\r\n while (cur <= end) {\r\n const week: (Day | null)[] = [];\r\n\r\n for (let d = 0; d < 7; d++) {\r\n const iso = cur.toISOString().slice(0, 10);\r\n\r\n if (cur > end) {\r\n week.push(null);\r\n } else {\r\n week.push(\r\n dayMap.get(iso) ?? {\r\n date: iso,\r\n count: 0,\r\n level: 0,\r\n },\r\n );\r\n }\r\n\r\n cur.setDate(cur.getDate() + 1);\r\n }\r\n\r\n weeks.push(week);\r\n }\r\n\r\n return weeks;\r\n}\r\n\r\nfunction monthLabels(grid: (Day | null)[][]) {\r\n const out: { label: string; col: number }[] = [];\r\n let last = -1;\r\n\r\n grid.forEach((week, i) => {\r\n const first = week.find(Boolean);\r\n if (!first) return;\r\n\r\n const m = new Date(first.date).getMonth();\r\n\r\n if (m !== last) {\r\n out.push({ label: MONTHS[m], col: i });\r\n last = m;\r\n }\r\n });\r\n\r\n return out;\r\n}\r\n\r\n/* ---------- UI Components ---------- */\r\n\r\nfunction Tooltip({ day, x, y }: { day: Day; x: number; y: number }) {\r\n const label = new Date(day.date).toLocaleDateString(\"en-US\", {\r\n weekday: \"long\",\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n });\r\n\r\n return (\r\n <div\r\n className=\"fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white dark:bg-white dark:text-neutral-900\"\r\n style={{ left: x, top: y - 8 }}\r\n >\r\n <b>\r\n {day.count} contribution{day.count !== 1 ? \"s\" : \"\"}\r\n </b>{\" \"}\r\n · {label}\r\n </div>\r\n );\r\n}\r\n\r\nfunction Skeleton() {\r\n return (\r\n <div className=\"flex gap-[3px] animate-pulse opacity-40\">\r\n {Array.from({ length: 53 }).map((_, w) => (\r\n <div key={w} className=\"flex flex-col gap-[3px]\">\r\n {Array.from({ length: 7 }).map((_, d) => (\r\n <div\r\n key={d}\r\n className=\"w-[13px] h-[13px] rounded-[3px] bg-neutral-300 dark:bg-neutral-700\"\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\nfunction YearPill({\r\n label,\r\n active,\r\n onClick,\r\n}: {\r\n label: string;\r\n active: boolean;\r\n onClick: () => void;\r\n}) {\r\n return (\r\n <button\r\n onClick={onClick}\r\n className={[\r\n \"px-2.5 py-0.5 rounded-full text-[11px] font-medium transition-colors duration-150\",\r\n active\r\n ? \"bg-neutral-900 text-white dark:bg-white dark:text-neutral-900\"\r\n : \"bg-neutral-100 text-neutral-600 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-400 dark:hover:bg-neutral-700\",\r\n ].join(\" \")}\r\n >\r\n {label}\r\n </button>\r\n );\r\n}\r\n\r\n/* ---------- Main Component ---------- */\r\n\r\nfunction GithubActivity({ username, theme = \"dark\", className }: Props) {\r\n const [allDays, setAllDays] = useState<Map<string, Day>>(new Map());\r\n const [years, setYears] = useState<number[]>([]);\r\n const [selectedYear, setSelectedYear] = useState<number | \"last\">(\"last\");\r\n const [total, setTotal] = useState<number | null>(null);\r\n const [bestDay, setBestDay] = useState<Day | null>(null);\r\n const [loading, setLoading] = useState(true);\r\n const [error, setError] = useState(false);\r\n const [tip, setTip] = useState<{ day: Day; x: number; y: number } | null>(\r\n null,\r\n );\r\n\r\n const colors = COLOR_MAP[theme] ?? COLOR_MAP.dark;\r\n\r\n /* Fetch Contributions */\r\n\r\n useEffect(() => {\r\n if (!username) return;\r\n\r\n let mounted = true;\r\n setLoading(true);\r\n setError(false);\r\n\r\n (async () => {\r\n try {\r\n const res = await fetch(\r\n `https://github-contributions-api.jogruber.de/v4/${username}?y=all`,\r\n );\r\n\r\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\r\n\r\n const json = await res.json();\r\n const raw: { date: string; count: number }[] = json.contributions ?? [];\r\n\r\n if (!raw.length) throw new Error(\"empty data\");\r\n\r\n const map = new Map<string, Day>();\r\n const yearSet = new Set<number>();\r\n\r\n raw.forEach((c) => {\r\n map.set(c.date, {\r\n date: c.date,\r\n count: c.count,\r\n level: toLevel(c.count),\r\n });\r\n\r\n yearSet.add(new Date(c.date).getFullYear());\r\n });\r\n\r\n if (mounted) {\r\n setAllDays(map);\r\n setYears(Array.from(yearSet).sort((a, b) => b - a));\r\n setLoading(false);\r\n }\r\n } catch (err) {\r\n console.warn(\"GithubActivity fetch error:\", err);\r\n\r\n if (mounted) {\r\n setError(true);\r\n setLoading(false);\r\n }\r\n }\r\n })();\r\n\r\n return () => {\r\n mounted = false;\r\n };\r\n }, [username]);\r\n\r\n /* Stats Calculation */\r\n\r\n useEffect(() => {\r\n if (!allDays.size) return;\r\n\r\n const entries = Array.from(allDays.values()).filter((d) => {\r\n if (selectedYear === \"last\") {\r\n const oneYearAgo = new Date();\r\n oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);\r\n return new Date(d.date) >= oneYearAgo;\r\n }\r\n\r\n return new Date(d.date).getFullYear() === selectedYear;\r\n });\r\n\r\n const sum = entries.reduce((s, d) => s + d.count, 0);\r\n\r\n const best = entries.reduce<Day | null>(\r\n (b, d) => (!b || d.count > b.count ? d : b),\r\n null,\r\n );\r\n\r\n setTotal(sum);\r\n setBestDay(best && best.count > 0 ? best : null);\r\n }, [allDays, selectedYear]);\r\n\r\n /* Rendering Helpers */\r\n\r\n const grid = useMemo(\r\n () => (allDays.size ? buildGrid(allDays, selectedYear) : []),\r\n [allDays, selectedYear],\r\n );\r\n\r\n const labels = useMemo(() => monthLabels(grid), [grid]);\r\n\r\n const outlineColor = theme === \"light\" ? \"#333\" : \"#f0f0f0\";\r\n\r\n const bestDateLabel = bestDay\r\n ? new Date(bestDay.date).toLocaleDateString(\"en-US\", {\r\n month: \"short\",\r\n day: \"numeric\",\r\n year: \"numeric\",\r\n })\r\n : null;\r\n\r\n const periodLabel =\r\n selectedYear === \"last\" ? \" in the last year\" : ` in ${selectedYear}`;\r\n\r\n return (\r\n <section className={[\"w-full font-mono\", className].join(\" \").trim()}>\r\n <div className=\"flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-500 dark:text-neutral-400\">\r\n {loading ? (\r\n \"Loading…\"\r\n ) : error ? (\r\n \"Unavailable\"\r\n ) : (\r\n <>\r\n <span className=\"font-semibold text-neutral-700 dark:text-neutral-200\">\r\n {total?.toLocaleString()}\r\n </span>\r\n {\" contributions\"}\r\n {periodLabel}\r\n </>\r\n )}\r\n\r\n {bestDay && !loading && (\r\n <span className=\"flex items-center gap-1.5\">\r\n <span\r\n className=\"inline-block w-[10px] h-[10px] rounded-[2px]\"\r\n style={{ backgroundColor: colors[4] }}\r\n />\r\n Best day:\r\n <span className=\"font-semibold text-neutral-700 dark:text-neutral-200\">\r\n {bestDay.count} contributions\r\n </span>\r\n on {bestDateLabel}\r\n </span>\r\n )}\r\n </div>\r\n\r\n <div className=\"border border-neutral-200 dark:border-neutral-800 rounded-xl p-4 bg-white dark:bg-neutral-950\">\r\n {error ? (\r\n <p className=\"text-sm italic text-neutral-400\">\r\n GitHub activity unavailable.\r\n </p>\r\n ) : loading ? (\r\n <Skeleton />\r\n ) : (\r\n <>\r\n <div className=\"overflow-x-auto overflow-y-visible pb-1\">\r\n <div\r\n className=\"relative\"\r\n style={{\r\n minWidth: grid.length * STEP + DAY_COL_W + 8,\r\n }}\r\n >\r\n <div\r\n className=\"relative h-[18px] mb-1\"\r\n style={{ marginLeft: DAY_COL_W }}\r\n >\r\n {labels.map(({ label, col }) => (\r\n <span\r\n key={`${label}-${col}`}\r\n className=\"absolute text-[11px] select-none text-neutral-500 dark:text-neutral-400\"\r\n style={{ left: col * STEP }}\r\n >\r\n {label}\r\n </span>\r\n ))}\r\n </div>\r\n\r\n <div className=\"flex gap-[3px]\">\r\n <div\r\n className=\"flex flex-col gap-[3px] pt-px shrink-0\"\r\n style={{ width: DAY_COL_W - GAP }}\r\n >\r\n {Array.from({ length: 7 }).map((_, i) => (\r\n <div\r\n key={i}\r\n className=\"h-[13px] text-[10px] leading-[13px] text-right pr-1.5 select-none text-neutral-500 dark:text-neutral-400\"\r\n >\r\n {DAY_LABELS[i] ?? \"\"}\r\n </div>\r\n ))}\r\n </div>\r\n\r\n {grid.map((week, wi) => (\r\n <div key={wi} className=\"flex flex-col gap-[3px]\">\r\n {week.map((day, di) => (\r\n <div\r\n key={di}\r\n className=\"w-[13px] h-[13px] rounded-[3px] transition-transform duration-100 hover:scale-125\"\r\n style={{\r\n backgroundColor: day\r\n ? colors[day.level]\r\n : \"transparent\",\r\n cursor: day ? \"pointer\" : \"default\",\r\n outline:\r\n bestDay && day?.date === bestDay.date\r\n ? `2px solid ${outlineColor}`\r\n : \"none\",\r\n outlineOffset: \"1px\",\r\n }}\r\n onMouseEnter={(e) => {\r\n if (!day) return;\r\n\r\n const r = e.currentTarget.getBoundingClientRect();\r\n\r\n setTip({\r\n day,\r\n x: r.left + r.width / 2,\r\n y: r.top,\r\n });\r\n }}\r\n onMouseLeave={() => setTip(null)}\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"flex items-center justify-start gap-1 mt-3\">\r\n <span className=\"text-[11px] text-neutral-500 dark:text-neutral-400 mr-1\">\r\n Less\r\n </span>\r\n\r\n {colors.map((c, i) => (\r\n <div\r\n key={i}\r\n className=\"w-[13px] h-[13px] rounded-[3px]\"\r\n style={{ backgroundColor: c }}\r\n />\r\n ))}\r\n\r\n <span className=\"text-[11px] text-neutral-500 dark:text-neutral-400 ml-1\">\r\n More\r\n </span>\r\n </div>\r\n\r\n <div className=\"flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-100 dark:border-neutral-800\">\r\n <span className=\"text-[11px] text-neutral-400 mr-1\">Year:</span>\r\n\r\n <YearPill\r\n label=\"Last year\"\r\n active={selectedYear === \"last\"}\r\n onClick={() => setSelectedYear(\"last\")}\r\n />\r\n\r\n {years.map((y) => (\r\n <YearPill\r\n key={y}\r\n label={String(y)}\r\n active={selectedYear === y}\r\n onClick={() => setSelectedYear(y)}\r\n />\r\n ))}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n\r\n {tip && <Tooltip day={tip.day} x={tip.x} y={tip.y} />}\r\n </section>\r\n );\r\n}\r\n\r\nexport default memo(GithubActivity);\r\n"],"mappings":";AAAA,SAAS,MAAM,WAAW,UAAU,eAAe;AAmJ7C,SAgLI,UAlKE,KAdN;AAjIN,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,aAAqC,EAAE,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM;AAE1E,IAAM,OAAO;AACb,IAAM,MAAM;AACZ,IAAM,OAAO,OAAO;AACpB,IAAM,YAAY;AAIlB,IAAM,QAAQ,CAAC,WAAW,WAAW,WAAW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