@stoked-ui/github 0.0.0-a.0
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/CHANGELOG.md +15014 -0
- package/GithubCalendar/GithubCalendar.d.ts +7 -0
- package/GithubCalendar/GithubCalendar.js +330 -0
- package/GithubCalendar/index.d.ts +2 -0
- package/GithubCalendar/index.js +2 -0
- package/GithubCalendar/package.json +6 -0
- package/GithubEvents/EventTypes/CreateEvent.d.ts +7 -0
- package/GithubEvents/EventTypes/CreateEvent.js +72 -0
- package/GithubEvents/EventTypes/DeleteEvent.d.ts +7 -0
- package/GithubEvents/EventTypes/DeleteEvent.js +65 -0
- package/GithubEvents/EventTypes/ForkEvent.d.ts +7 -0
- package/GithubEvents/EventTypes/ForkEvent.js +77 -0
- package/GithubEvents/EventTypes/IssueCommentEvent.d.ts +7 -0
- package/GithubEvents/EventTypes/IssueCommentEvent.js +210 -0
- package/GithubEvents/EventTypes/IssuesEvent.d.ts +7 -0
- package/GithubEvents/EventTypes/IssuesEvent.js +97 -0
- package/GithubEvents/EventTypes/ProjectsV2ColumnEvent.d.ts +7 -0
- package/GithubEvents/EventTypes/ProjectsV2ColumnEvent.js +69 -0
- package/GithubEvents/EventTypes/ProjectsV2Event.d.ts +7 -0
- package/GithubEvents/EventTypes/ProjectsV2Event.js +74 -0
- package/GithubEvents/EventTypes/ProjectsV2FieldEvent.d.ts +7 -0
- package/GithubEvents/EventTypes/ProjectsV2FieldEvent.js +77 -0
- package/GithubEvents/EventTypes/ProjectsV2ItemEvent.d.ts +7 -0
- package/GithubEvents/EventTypes/ProjectsV2ItemEvent.js +79 -0
- package/GithubEvents/EventTypes/PullRequest/CommitsList.d.ts +17 -0
- package/GithubEvents/EventTypes/PullRequest/CommitsList.js +99 -0
- package/GithubEvents/EventTypes/PullRequest/FileChanges.d.ts +17 -0
- package/GithubEvents/EventTypes/PullRequest/FileChanges.js +182 -0
- package/GithubEvents/EventTypes/PullRequest/PullRequestEvent.d.ts +8 -0
- package/GithubEvents/EventTypes/PullRequest/PullRequestEvent.js +374 -0
- package/GithubEvents/EventTypes/PullRequest/PullRequestView.d.ts +29 -0
- package/GithubEvents/EventTypes/PullRequest/PullRequestView.js +132 -0
- package/GithubEvents/EventTypes/PushEvent.d.ts +7 -0
- package/GithubEvents/EventTypes/PushEvent.js +106 -0
- package/GithubEvents/GithubEvents.d.ts +49 -0
- package/GithubEvents/GithubEvents.js +1454 -0
- package/GithubEvents/index.d.ts +2 -0
- package/GithubEvents/index.js +2 -0
- package/GithubEvents/package.json +6 -0
- package/LICENSE +21 -0
- package/README.md +29 -0
- package/apiHandlers/getPullRequestDetails.d.ts +7 -0
- package/apiHandlers/getPullRequestDetails.js +120 -0
- package/apiHandlers/index.d.ts +1 -0
- package/apiHandlers/index.js +1 -0
- package/apiHandlers/package.json +6 -0
- package/index.d.ts +3 -0
- package/index.js +10 -0
- package/modern/GithubCalendar/GithubCalendar.js +330 -0
- package/modern/GithubCalendar/index.js +2 -0
- package/modern/GithubEvents/EventTypes/CreateEvent.js +72 -0
- package/modern/GithubEvents/EventTypes/DeleteEvent.js +65 -0
- package/modern/GithubEvents/EventTypes/ForkEvent.js +77 -0
- package/modern/GithubEvents/EventTypes/IssueCommentEvent.js +210 -0
- package/modern/GithubEvents/EventTypes/IssuesEvent.js +97 -0
- package/modern/GithubEvents/EventTypes/ProjectsV2ColumnEvent.js +69 -0
- package/modern/GithubEvents/EventTypes/ProjectsV2Event.js +74 -0
- package/modern/GithubEvents/EventTypes/ProjectsV2FieldEvent.js +77 -0
- package/modern/GithubEvents/EventTypes/ProjectsV2ItemEvent.js +79 -0
- package/modern/GithubEvents/EventTypes/PullRequest/CommitsList.js +99 -0
- package/modern/GithubEvents/EventTypes/PullRequest/FileChanges.js +182 -0
- package/modern/GithubEvents/EventTypes/PullRequest/PullRequestEvent.js +374 -0
- package/modern/GithubEvents/EventTypes/PullRequest/PullRequestView.js +132 -0
- package/modern/GithubEvents/EventTypes/PushEvent.js +106 -0
- package/modern/GithubEvents/GithubEvents.js +1454 -0
- package/modern/GithubEvents/index.js +2 -0
- package/modern/apiHandlers/getPullRequestDetails.js +120 -0
- package/modern/apiHandlers/index.js +1 -0
- package/modern/index.js +10 -0
- package/modern/types/github.js +1 -0
- package/node/GithubCalendar/GithubCalendar.js +337 -0
- package/node/GithubCalendar/index.js +9 -0
- package/node/GithubEvents/EventTypes/CreateEvent.js +80 -0
- package/node/GithubEvents/EventTypes/DeleteEvent.js +73 -0
- package/node/GithubEvents/EventTypes/ForkEvent.js +85 -0
- package/node/GithubEvents/EventTypes/IssueCommentEvent.js +218 -0
- package/node/GithubEvents/EventTypes/IssuesEvent.js +105 -0
- package/node/GithubEvents/EventTypes/ProjectsV2ColumnEvent.js +77 -0
- package/node/GithubEvents/EventTypes/ProjectsV2Event.js +82 -0
- package/node/GithubEvents/EventTypes/ProjectsV2FieldEvent.js +85 -0
- package/node/GithubEvents/EventTypes/ProjectsV2ItemEvent.js +87 -0
- package/node/GithubEvents/EventTypes/PullRequest/CommitsList.js +107 -0
- package/node/GithubEvents/EventTypes/PullRequest/FileChanges.js +188 -0
- package/node/GithubEvents/EventTypes/PullRequest/PullRequestEvent.js +381 -0
- package/node/GithubEvents/EventTypes/PullRequest/PullRequestView.js +138 -0
- package/node/GithubEvents/EventTypes/PushEvent.js +114 -0
- package/node/GithubEvents/GithubEvents.js +1463 -0
- package/node/GithubEvents/index.js +9 -0
- package/node/apiHandlers/getPullRequestDetails.js +127 -0
- package/node/apiHandlers/index.js +13 -0
- package/node/index.js +27 -0
- package/node/types/github.js +5 -0
- package/package.json +71 -0
- package/types/github.d.ts +107 -0
- package/types/github.js +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default function GithubCalendar({ windowMode, containerMode, blockSize: inputBlockSize, fx, startImage }: {
|
|
2
|
+
windowMode?: boolean;
|
|
3
|
+
containerMode?: boolean;
|
|
4
|
+
blockSize?: number;
|
|
5
|
+
fx?: 'punch' | 'highlight';
|
|
6
|
+
startImage?: string;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Box } from "@mui/material";
|
|
4
|
+
import { ActivityCalendar } from "react-activity-calendar";
|
|
5
|
+
import { useTheme } from '@mui/material/styles';
|
|
6
|
+
import { useResize } from '@stoked-ui/common';
|
|
7
|
+
import { useResizeWindow } from '@stoked-ui/common';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const defaultActivityData = {
|
|
10
|
+
total: {},
|
|
11
|
+
contributions: [],
|
|
12
|
+
countLabel: 'Loading...'
|
|
13
|
+
};
|
|
14
|
+
function sleep(duration) {
|
|
15
|
+
return new Promise(resolve => {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
resolve(void 0);
|
|
18
|
+
}, duration);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export default function GithubCalendar({
|
|
22
|
+
windowMode = false,
|
|
23
|
+
containerMode = false,
|
|
24
|
+
blockSize: inputBlockSize = 12,
|
|
25
|
+
fx = undefined,
|
|
26
|
+
startImage = undefined
|
|
27
|
+
}) {
|
|
28
|
+
const [activityTheme, setActivityTheme] = React.useState('light');
|
|
29
|
+
const [activityData, setActivityData] = React.useState(defaultActivityData);
|
|
30
|
+
const [activityLoading, setActivityLoading] = React.useState(true);
|
|
31
|
+
const [activityHover, setActivityHover] = React.useState(false);
|
|
32
|
+
const [activityLabels, setActivityLabels] = React.useState(false);
|
|
33
|
+
const [activityClass, setActivityClass] = React.useState('activity');
|
|
34
|
+
const [labelsTimer, setLabelsTimer] = React.useState(null);
|
|
35
|
+
const theme = useTheme();
|
|
36
|
+
const elementRef = React.useRef(null);
|
|
37
|
+
const [windowWidth, _] = useResizeWindow();
|
|
38
|
+
const elemSize = useResize(elementRef);
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
if (inputBlockSize) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (activityData.totalWeeks) {
|
|
44
|
+
if (windowMode) {
|
|
45
|
+
activityData.blockSize = Math.max(10, Math.floor(windowWidth / activityData.totalWeeks));
|
|
46
|
+
setActivityData(_extends({}, activityData));
|
|
47
|
+
} else if (containerMode) {
|
|
48
|
+
if (elemSize.width) {
|
|
49
|
+
activityData.blockSize = Math.max(10, Math.floor(elemSize.width / activityData.totalWeeks));
|
|
50
|
+
setActivityData(_extends({}, activityData));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, [elemSize.width, windowWidth]);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (activityHover && !activityLabels) {
|
|
57
|
+
setLabelsTimer(setTimeout(() => {
|
|
58
|
+
setActivityLabels(true);
|
|
59
|
+
}, 200));
|
|
60
|
+
} else if (!activityHover && (activityLabels || labelsTimer)) {
|
|
61
|
+
setActivityLabels(false);
|
|
62
|
+
if (labelsTimer) {
|
|
63
|
+
clearTimeout(labelsTimer);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
setActivityClass('activity ' + (activityLabels ? 'hover labels' : activityHover ? 'hover' : ''));
|
|
67
|
+
}, [activityHover, activityLabels]);
|
|
68
|
+
|
|
69
|
+
// Scroll activity all the way to the right on mount
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
if (!activityLoading) {
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
const activityContainer = document.querySelector('.react-activity-calendar__scroll-container');
|
|
74
|
+
if (activityContainer) {
|
|
75
|
+
activityContainer.scrollLeft = activityContainer.scrollWidth;
|
|
76
|
+
}
|
|
77
|
+
}, 200);
|
|
78
|
+
}
|
|
79
|
+
}, [activityLoading]);
|
|
80
|
+
const fetchActivityData = async () => {
|
|
81
|
+
setActivityLoading(true);
|
|
82
|
+
try {
|
|
83
|
+
const response = await fetch('https://github-contributions-api.jogruber.de/v4/brian-stoker?yr=last');
|
|
84
|
+
if (!response.ok) {
|
|
85
|
+
throw new Error(`API error: ${response.status}`);
|
|
86
|
+
}
|
|
87
|
+
const data = await response.json();
|
|
88
|
+
function compare(a, b) {
|
|
89
|
+
if (a.date < b.date) {
|
|
90
|
+
return -1;
|
|
91
|
+
}
|
|
92
|
+
if (a.date > b.date) {
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
const earliestDate = data.contributions.filter(item => item.count > 0) // Filter items with count > 0
|
|
98
|
+
.reduce((earliest, current) => {
|
|
99
|
+
return !earliest || new Date(current.date) < new Date(earliest.date) ? current : earliest;
|
|
100
|
+
}, null);
|
|
101
|
+
const today = new Date();
|
|
102
|
+
const year = today.getFullYear();
|
|
103
|
+
const month = String(today.getMonth() + 1).padStart(2, '0'); // Month is 0-indexed
|
|
104
|
+
const day = String(today.getDate()).padStart(2, '0');
|
|
105
|
+
const formattedDate = `${year}-${month}-${day}`;
|
|
106
|
+
const contribs = data.contributions.filter(contrib => contrib.date < formattedDate && (!earliestDate || contrib.date >= earliestDate.date));
|
|
107
|
+
data.contributions = contribs.sort(compare);
|
|
108
|
+
const allJansSet = contribs.map(contrib => {
|
|
109
|
+
return contrib.date.slice(2, 7);
|
|
110
|
+
}).filter(yymm => yymm.slice(-2) === '01');
|
|
111
|
+
const allJans = new Set(allJansSet);
|
|
112
|
+
console.log('allJans', [...allJans]);
|
|
113
|
+
const all = Object.values(data.total).reduce((acc, curr) => acc + curr, 0);
|
|
114
|
+
const totalKeys = Object.keys(data.total);
|
|
115
|
+
data.countLabel = `${all} contributions from ${totalKeys[0]} to ${totalKeys[totalKeys.length - 1]}`;
|
|
116
|
+
data.totalWeeks = data.contributions.length / 7;
|
|
117
|
+
if (inputBlockSize) {
|
|
118
|
+
data.blockSize = inputBlockSize;
|
|
119
|
+
} else if (windowMode) {
|
|
120
|
+
data.blockSize = Math.max(10, Math.floor(windowWidth / data.totalWeeks));
|
|
121
|
+
} else {
|
|
122
|
+
if (elemSize.width) {
|
|
123
|
+
data.blockSize = Math.max(10, Math.floor(elemSize.width / data.totalWeeks));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
setActivityData(data);
|
|
127
|
+
} catch (err) {
|
|
128
|
+
console.error(`Error fetching activity data: ${err instanceof Error ? err.message : String(err)}`);
|
|
129
|
+
// Use fallback data if API fails
|
|
130
|
+
setActivityData(defaultActivityData);
|
|
131
|
+
} finally {
|
|
132
|
+
setActivityLoading(false);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Initial load
|
|
137
|
+
React.useEffect(() => {
|
|
138
|
+
async function setup() {
|
|
139
|
+
await fetchActivityData();
|
|
140
|
+
await sleep(800);
|
|
141
|
+
setupRectAnimations();
|
|
142
|
+
window.addEventListener('resize', handleResize);
|
|
143
|
+
}
|
|
144
|
+
if (!fx) {
|
|
145
|
+
fetchActivityData().catch(() => console.error('Error fetching activity data'));
|
|
146
|
+
} else {
|
|
147
|
+
setup().catch(() => console.error('Error fetching activity data'));
|
|
148
|
+
}
|
|
149
|
+
if (startImage) {
|
|
150
|
+
const startImageContainer = document.querySelector('.react-activity-calendar__scroll-container');
|
|
151
|
+
if (startImageContainer) {
|
|
152
|
+
const startImageEl = document.createElement('img');
|
|
153
|
+
startImageEl.src = startImage;
|
|
154
|
+
startImageEl.alt = 'hbngha';
|
|
155
|
+
startImageEl.style.position = 'absolute';
|
|
156
|
+
startImageEl.style.top = '0';
|
|
157
|
+
startImageEl.style.left = '0';
|
|
158
|
+
startImageEl.style.marginTop = '25px';
|
|
159
|
+
startImageEl.style.width = `${(activityData.blockSize || 12) * 7}px`;
|
|
160
|
+
startImageEl.style.height = `${(activityData.blockSize || 12) * 7}px`;
|
|
161
|
+
const div = document.createElement('div');
|
|
162
|
+
div.style.position = 'relative';
|
|
163
|
+
div.appendChild(startImageEl);
|
|
164
|
+
startImageContainer.insertBefore(div, startImageContainer.firstChild);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return () => {
|
|
168
|
+
if (fx) {
|
|
169
|
+
var _elementRef$current;
|
|
170
|
+
window.removeEventListener('resize', handleResize);
|
|
171
|
+
|
|
172
|
+
// Clean up any active timeouts
|
|
173
|
+
const svg = (_elementRef$current = elementRef.current) == null ? void 0 : _elementRef$current.querySelector('svg');
|
|
174
|
+
if (svg) {
|
|
175
|
+
const rects = svg.querySelectorAll('rect');
|
|
176
|
+
rects.forEach(rect => {
|
|
177
|
+
if (rect.dataset.timeoutId) {
|
|
178
|
+
clearTimeout(parseInt(rect.dataset.timeoutId));
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}, []);
|
|
185
|
+
const handleResize = () => {
|
|
186
|
+
var _elementRef$current2;
|
|
187
|
+
// Clear all animations first
|
|
188
|
+
const svg = (_elementRef$current2 = elementRef.current) == null ? void 0 : _elementRef$current2.querySelector('svg');
|
|
189
|
+
if (svg) {
|
|
190
|
+
const rects = svg.querySelectorAll('rect');
|
|
191
|
+
rects.forEach(rect => {
|
|
192
|
+
rect.classList.remove('rect-animated');
|
|
193
|
+
if (rect.dataset.timeoutId) {
|
|
194
|
+
clearTimeout(parseInt(rect.dataset.timeoutId));
|
|
195
|
+
delete rect.dataset.timeoutId;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Recalculate positions
|
|
201
|
+
setupRectAnimations();
|
|
202
|
+
};
|
|
203
|
+
function setupRectAnimations() {
|
|
204
|
+
var _elementRef$current3;
|
|
205
|
+
// Get the SVG container
|
|
206
|
+
const svg = (_elementRef$current3 = elementRef.current) == null ? void 0 : _elementRef$current3.querySelector('svg');
|
|
207
|
+
if (!svg) return;
|
|
208
|
+
|
|
209
|
+
// Calculate center of the SVG
|
|
210
|
+
const svgRect = svg.getBoundingClientRect();
|
|
211
|
+
const centerX = svgRect.width / 2;
|
|
212
|
+
const centerY = svgRect.height / 2;
|
|
213
|
+
|
|
214
|
+
// Get all rect elements
|
|
215
|
+
const rects = svg.querySelectorAll('rect');
|
|
216
|
+
rects.forEach(rect => {
|
|
217
|
+
if (fx === 'punch') {
|
|
218
|
+
var _rect$parentNode;
|
|
219
|
+
// Calculate the translate value
|
|
220
|
+
const rectRect = rect.getBoundingClientRect();
|
|
221
|
+
const rectCenterY = rectRect.top + rectRect.height / 2 - svgRect.top;
|
|
222
|
+
const rectCenterX = rectRect.left + rectRect.width / 2 - svgRect.left;
|
|
223
|
+
|
|
224
|
+
// Calculate distance from center
|
|
225
|
+
const distanceFromCenterX = svgRect.width / 2 / (rectCenterX - centerX);
|
|
226
|
+
const distanceFromCenterY = svgRect.height / 2 / (rectCenterY - centerY);
|
|
227
|
+
const translateFactorX = 6;
|
|
228
|
+
const translateFactorY = 0.02;
|
|
229
|
+
const randomX = Math.random() * 10 - 5;
|
|
230
|
+
const randomY = Math.random() * 10 - 5;
|
|
231
|
+
const translateX = distanceFromCenterX * translateFactorX + randomX;
|
|
232
|
+
const translateY = distanceFromCenterY * translateFactorY + randomY;
|
|
233
|
+
// Set the custom property
|
|
234
|
+
rect.style.setProperty('--translate-x', `${translateX}px`);
|
|
235
|
+
rect.style.setProperty('--translate-y', `${translateY - 200}px`);
|
|
236
|
+
// Remove existing event listeners (if possible)
|
|
237
|
+
const oldRect = rect.cloneNode(true);
|
|
238
|
+
(_rect$parentNode = rect.parentNode) == null || _rect$parentNode.replaceChild(oldRect, rect);
|
|
239
|
+
|
|
240
|
+
// Add mouseenter event
|
|
241
|
+
oldRect.addEventListener('mouseenter', () => {
|
|
242
|
+
// Clear any existing timeout
|
|
243
|
+
if (oldRect != null && oldRect.dataset.timeoutId) {
|
|
244
|
+
clearTimeout(parseInt(oldRect == null ? void 0 : oldRect.dataset.timeoutId));
|
|
245
|
+
}
|
|
246
|
+
oldRect.style.position = 'relative';
|
|
247
|
+
// Add the animated class
|
|
248
|
+
oldRect == null || oldRect.classList.add('rect-animated');
|
|
249
|
+
|
|
250
|
+
// Set a timeout to return after random delay
|
|
251
|
+
const minDelay = 100;
|
|
252
|
+
const randomDelay = Math.random() * 1000 + minDelay;
|
|
253
|
+
const timeoutId = setTimeout(() => {
|
|
254
|
+
oldRect == null || oldRect.classList.remove('rect-animated');
|
|
255
|
+
oldRect == null || delete oldRect.dataset.timeoutId;
|
|
256
|
+
}, randomDelay);
|
|
257
|
+
|
|
258
|
+
// Store the timeout ID
|
|
259
|
+
if (oldRect != null && oldRect.dataset) {
|
|
260
|
+
oldRect.dataset.timeoutId = timeoutId.toString();
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
} else {
|
|
264
|
+
var _rect$parentNode2;
|
|
265
|
+
const oldRect = rect.cloneNode(true);
|
|
266
|
+
(_rect$parentNode2 = rect.parentNode) == null || _rect$parentNode2.replaceChild(oldRect, rect);
|
|
267
|
+
// Add mouseenter event
|
|
268
|
+
rect.addEventListener('mouseenter', () => {
|
|
269
|
+
// Clear any existing timeout
|
|
270
|
+
if (rect != null && rect.dataset.timeoutId) {
|
|
271
|
+
clearTimeout(parseInt(rect == null ? void 0 : rect.dataset.timeoutId));
|
|
272
|
+
}
|
|
273
|
+
rect.style.position = 'relative';
|
|
274
|
+
// Add the animated class
|
|
275
|
+
rect == null || rect.classList.add('rect-highlight');
|
|
276
|
+
// Add the animated class
|
|
277
|
+
//oldRect?.classList.add('rect-animated');
|
|
278
|
+
|
|
279
|
+
// Set a timeout to return after random delay
|
|
280
|
+
const minDelay = 100;
|
|
281
|
+
const randomDelay = Math.random() * 1000 + minDelay;
|
|
282
|
+
const timeoutId = setTimeout(() => {
|
|
283
|
+
rect == null || rect.classList.remove('rect-highlight');
|
|
284
|
+
rect == null || delete rect.dataset.timeoutId;
|
|
285
|
+
}, randomDelay);
|
|
286
|
+
|
|
287
|
+
// Store the timeout ID
|
|
288
|
+
if (rect != null && rect.dataset) {
|
|
289
|
+
rect.dataset.timeoutId = timeoutId.toString();
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
React.useEffect(() => {
|
|
296
|
+
setActivityTheme(theme.palette.mode === 'dark' ? 'dark' : 'light');
|
|
297
|
+
}, [theme.palette.mode]);
|
|
298
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
299
|
+
ref: elementRef,
|
|
300
|
+
onMouseEnter: () => setActivityHover(true),
|
|
301
|
+
onMouseLeave: () => {
|
|
302
|
+
setActivityHover(false);
|
|
303
|
+
setActivityLabels(false);
|
|
304
|
+
},
|
|
305
|
+
className: `${activityClass} ${activityLoading ? 'loading' : ''}`,
|
|
306
|
+
sx: {
|
|
307
|
+
'& .activity > *': {
|
|
308
|
+
transition: '1s ease-in-out'
|
|
309
|
+
},
|
|
310
|
+
position: 'sticky'
|
|
311
|
+
},
|
|
312
|
+
children: /*#__PURE__*/_jsx(ActivityCalendar, {
|
|
313
|
+
data: activityData.contributions,
|
|
314
|
+
theme: {
|
|
315
|
+
light: activityTheme === 'light' ? ['hsl(0, 0%, 92%)', theme.palette.primary.dark] : ['hsl(0, 0%, 12%)', theme.palette.primary.light],
|
|
316
|
+
dark: activityTheme === 'light' ? ['hsl(0, 0%, 92%)', theme.palette.primary.dark] : ['hsl(0, 0%, 12%)', theme.palette.primary.light]
|
|
317
|
+
},
|
|
318
|
+
loading: activityLoading,
|
|
319
|
+
blockMargin: 0.5,
|
|
320
|
+
blockRadius: 0,
|
|
321
|
+
blockSize: activityData.blockSize || 12,
|
|
322
|
+
style: {
|
|
323
|
+
backgroundColor: theme.palette.background.paper
|
|
324
|
+
},
|
|
325
|
+
labels: {
|
|
326
|
+
totalCount: activityData.countLabel
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
});
|
|
330
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import Link from '@mui/material/Link';
|
|
5
|
+
import Chip from '@mui/material/Chip';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export default function CreateEvent({
|
|
8
|
+
event
|
|
9
|
+
}) {
|
|
10
|
+
var _event$payload, _event$payload2, _event$payload3;
|
|
11
|
+
if (!(event != null && event.date)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const refType = ((_event$payload = event.payload) == null ? void 0 : _event$payload.ref_type) || 'unknown';
|
|
15
|
+
const refName = ((_event$payload2 = event.payload) == null ? void 0 : _event$payload2.ref) || 'unknown';
|
|
16
|
+
const repoUrl = `https://github.com/${event.repo}`;
|
|
17
|
+
const description = (_event$payload3 = event.payload) == null ? void 0 : _event$payload3.description;
|
|
18
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
19
|
+
sx: {
|
|
20
|
+
p: '16px'
|
|
21
|
+
},
|
|
22
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
23
|
+
sx: {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
gap: 1,
|
|
27
|
+
mb: 2
|
|
28
|
+
},
|
|
29
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
30
|
+
variant: "caption",
|
|
31
|
+
color: "text.secondary",
|
|
32
|
+
children: event.date
|
|
33
|
+
}), /*#__PURE__*/_jsx(Chip, {
|
|
34
|
+
label: refType,
|
|
35
|
+
size: "small",
|
|
36
|
+
color: "success"
|
|
37
|
+
})]
|
|
38
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
39
|
+
variant: "h6",
|
|
40
|
+
component: "h3",
|
|
41
|
+
sx: {
|
|
42
|
+
mb: 1
|
|
43
|
+
},
|
|
44
|
+
children: /*#__PURE__*/_jsxs(Link, {
|
|
45
|
+
href: repoUrl,
|
|
46
|
+
target: "_blank",
|
|
47
|
+
rel: "noopener noreferrer",
|
|
48
|
+
sx: {
|
|
49
|
+
textDecoration: 'none'
|
|
50
|
+
},
|
|
51
|
+
children: ["Created ", refType, " ", refName]
|
|
52
|
+
})
|
|
53
|
+
}), description && /*#__PURE__*/_jsx(Typography, {
|
|
54
|
+
variant: "body2",
|
|
55
|
+
sx: {
|
|
56
|
+
mb: 2
|
|
57
|
+
},
|
|
58
|
+
children: description
|
|
59
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
60
|
+
sx: {
|
|
61
|
+
display: 'flex',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
gap: 1
|
|
64
|
+
},
|
|
65
|
+
children: /*#__PURE__*/_jsxs(Typography, {
|
|
66
|
+
variant: "body2",
|
|
67
|
+
color: "text.secondary",
|
|
68
|
+
children: ["in ", event.repo]
|
|
69
|
+
})
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import Link from '@mui/material/Link';
|
|
5
|
+
import Chip from '@mui/material/Chip';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export default function DeleteEvent({
|
|
8
|
+
event
|
|
9
|
+
}) {
|
|
10
|
+
var _event$payload, _event$payload2;
|
|
11
|
+
if (!(event != null && event.date)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const refType = ((_event$payload = event.payload) == null ? void 0 : _event$payload.ref_type) || 'unknown';
|
|
15
|
+
const refName = ((_event$payload2 = event.payload) == null ? void 0 : _event$payload2.ref) || 'unknown';
|
|
16
|
+
const repoUrl = `https://github.com/${event.repo}`;
|
|
17
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
18
|
+
sx: {
|
|
19
|
+
p: '16px'
|
|
20
|
+
},
|
|
21
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
22
|
+
sx: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
gap: 1,
|
|
26
|
+
mb: 2
|
|
27
|
+
},
|
|
28
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
29
|
+
variant: "caption",
|
|
30
|
+
color: "text.secondary",
|
|
31
|
+
children: event.date
|
|
32
|
+
}), /*#__PURE__*/_jsx(Chip, {
|
|
33
|
+
label: refType,
|
|
34
|
+
size: "small",
|
|
35
|
+
color: "error"
|
|
36
|
+
})]
|
|
37
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
38
|
+
variant: "h6",
|
|
39
|
+
component: "h3",
|
|
40
|
+
sx: {
|
|
41
|
+
mb: 1
|
|
42
|
+
},
|
|
43
|
+
children: /*#__PURE__*/_jsxs(Link, {
|
|
44
|
+
href: repoUrl,
|
|
45
|
+
target: "_blank",
|
|
46
|
+
rel: "noopener noreferrer",
|
|
47
|
+
sx: {
|
|
48
|
+
textDecoration: 'none'
|
|
49
|
+
},
|
|
50
|
+
children: ["Deleted ", refType, " ", refName]
|
|
51
|
+
})
|
|
52
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
53
|
+
sx: {
|
|
54
|
+
display: 'flex',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
gap: 1
|
|
57
|
+
},
|
|
58
|
+
children: /*#__PURE__*/_jsxs(Typography, {
|
|
59
|
+
variant: "body2",
|
|
60
|
+
color: "text.secondary",
|
|
61
|
+
children: ["from ", event.repo]
|
|
62
|
+
})
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var _Chip;
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import Link from '@mui/material/Link';
|
|
6
|
+
import Chip from '@mui/material/Chip';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export default function ForkEvent({
|
|
9
|
+
event
|
|
10
|
+
}) {
|
|
11
|
+
var _event$payload;
|
|
12
|
+
if (!(event != null && event.date)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const forkee = (_event$payload = event.payload) == null ? void 0 : _event$payload.forkee;
|
|
16
|
+
if (!forkee) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const forkUrl = forkee.html_url;
|
|
20
|
+
const forkName = forkee.full_name;
|
|
21
|
+
const originalRepo = event.repo;
|
|
22
|
+
const description = forkee.description;
|
|
23
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
24
|
+
sx: {
|
|
25
|
+
p: '16px'
|
|
26
|
+
},
|
|
27
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
28
|
+
sx: {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
gap: 1,
|
|
32
|
+
mb: 2
|
|
33
|
+
},
|
|
34
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
35
|
+
variant: "caption",
|
|
36
|
+
color: "text.secondary",
|
|
37
|
+
children: event.date
|
|
38
|
+
}), _Chip || (_Chip = /*#__PURE__*/_jsx(Chip, {
|
|
39
|
+
label: "fork",
|
|
40
|
+
size: "small",
|
|
41
|
+
color: "info"
|
|
42
|
+
}))]
|
|
43
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
44
|
+
variant: "h6",
|
|
45
|
+
component: "h3",
|
|
46
|
+
sx: {
|
|
47
|
+
mb: 1
|
|
48
|
+
},
|
|
49
|
+
children: /*#__PURE__*/_jsx(Link, {
|
|
50
|
+
href: forkUrl,
|
|
51
|
+
target: "_blank",
|
|
52
|
+
rel: "noopener noreferrer",
|
|
53
|
+
sx: {
|
|
54
|
+
textDecoration: 'none'
|
|
55
|
+
},
|
|
56
|
+
children: forkName
|
|
57
|
+
})
|
|
58
|
+
}), description && /*#__PURE__*/_jsx(Typography, {
|
|
59
|
+
variant: "body2",
|
|
60
|
+
sx: {
|
|
61
|
+
mb: 2
|
|
62
|
+
},
|
|
63
|
+
children: description
|
|
64
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
65
|
+
sx: {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
gap: 1
|
|
69
|
+
},
|
|
70
|
+
children: /*#__PURE__*/_jsxs(Typography, {
|
|
71
|
+
variant: "body2",
|
|
72
|
+
color: "text.secondary",
|
|
73
|
+
children: ["Forked from ", originalRepo]
|
|
74
|
+
})
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
}
|