hale-commenting-system 2.0.2 → 2.0.4

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.
Files changed (58) hide show
  1. package/README.md +16 -207
  2. package/bin/detect.d.ts +1 -0
  3. package/bin/detect.js +62 -0
  4. package/bin/generators.d.ts +18 -0
  5. package/bin/generators.js +193 -0
  6. package/bin/hale-commenting.js +4 -0
  7. package/bin/index.d.ts +2 -0
  8. package/bin/index.js +61 -0
  9. package/bin/onboarding.d.ts +1 -0
  10. package/bin/onboarding.js +170 -0
  11. package/bin/postinstall.d.ts +2 -0
  12. package/bin/postinstall.js +65 -0
  13. package/bin/validators.d.ts +2 -0
  14. package/bin/validators.js +66 -0
  15. package/dist/cli/detect.d.ts +1 -0
  16. package/dist/cli/detect.js +62 -0
  17. package/dist/cli/generators.d.ts +18 -0
  18. package/dist/cli/generators.js +193 -0
  19. package/dist/cli/index.d.ts +2 -0
  20. package/dist/cli/index.js +61 -0
  21. package/dist/cli/onboarding.d.ts +1 -0
  22. package/dist/cli/onboarding.js +170 -0
  23. package/dist/cli/postinstall.d.ts +2 -0
  24. package/dist/cli/postinstall.js +65 -0
  25. package/dist/cli/validators.d.ts +2 -0
  26. package/dist/cli/validators.js +66 -0
  27. package/dist/components/CommentOverlay.d.ts +2 -0
  28. package/dist/components/CommentOverlay.js +101 -0
  29. package/dist/components/CommentPanel.d.ts +6 -0
  30. package/dist/components/CommentPanel.js +334 -0
  31. package/dist/components/CommentPin.d.ts +11 -0
  32. package/dist/components/CommentPin.js +64 -0
  33. package/dist/components/DetailsTab.d.ts +2 -0
  34. package/dist/components/DetailsTab.js +380 -0
  35. package/dist/components/FloatingWidget.d.ts +8 -0
  36. package/dist/components/FloatingWidget.js +128 -0
  37. package/dist/components/JiraTab.d.ts +2 -0
  38. package/dist/components/JiraTab.js +507 -0
  39. package/dist/contexts/CommentContext.d.ts +30 -0
  40. package/dist/contexts/CommentContext.js +891 -0
  41. package/dist/contexts/GitHubAuthContext.d.ts +13 -0
  42. package/dist/contexts/GitHubAuthContext.js +96 -0
  43. package/dist/index.d.ts +10 -97
  44. package/dist/index.js +26 -789
  45. package/dist/services/githubAdapter.d.ts +56 -0
  46. package/dist/services/githubAdapter.js +321 -0
  47. package/dist/types/index.d.ts +25 -0
  48. package/dist/types/index.js +2 -0
  49. package/dist/utils/version.d.ts +1 -0
  50. package/dist/utils/version.js +23 -0
  51. package/package.json +39 -38
  52. package/templates/webpack-middleware.js +226 -0
  53. package/cli/dist/index.js +0 -370
  54. package/cli/dist/index.js.map +0 -1
  55. package/dist/index.d.mts +0 -97
  56. package/dist/index.js.map +0 -1
  57. package/dist/index.mjs +0 -762
  58. package/dist/index.mjs.map +0 -1
package/dist/index.mjs DELETED
@@ -1,762 +0,0 @@
1
- // src/components/CommentOverlay.tsx
2
- import * as React3 from "react";
3
- import { useLocation } from "react-router-dom";
4
-
5
- // src/contexts/CommentContext.tsx
6
- import * as React from "react";
7
- import { jsx } from "react/jsx-runtime";
8
- var CommentContext = React.createContext(void 0);
9
- var STORAGE_KEY = "hale-threads";
10
- var SHOW_PINS_KEY = "hale-show-pins";
11
- var ENABLE_COMMENTING_KEY = "hale-enable-commenting";
12
- var migrateOldComments = () => {
13
- try {
14
- const oldThreadsKey = localStorage.getItem("apollo-threads");
15
- const oldCommentsKey = localStorage.getItem("apollo-comments");
16
- if (oldThreadsKey) {
17
- const parsed = JSON.parse(oldThreadsKey);
18
- const cleanThreads = parsed.map((t) => ({
19
- id: t.id,
20
- x: t.x,
21
- y: t.y,
22
- route: t.route,
23
- comments: t.comments.map((c) => ({
24
- id: c.id,
25
- text: c.text || "",
26
- createdAt: c.createdAt,
27
- author: c.author
28
- })),
29
- version: t.version
30
- }));
31
- localStorage.setItem(STORAGE_KEY, JSON.stringify(cleanThreads));
32
- localStorage.removeItem("apollo-threads");
33
- return cleanThreads;
34
- }
35
- if (oldCommentsKey) {
36
- const parsed = JSON.parse(oldCommentsKey);
37
- const threads = parsed.map((oldComment) => ({
38
- id: oldComment.id,
39
- x: oldComment.x,
40
- y: oldComment.y,
41
- route: oldComment.route,
42
- comments: [
43
- {
44
- id: `${oldComment.id}-comment-0`,
45
- text: oldComment.text || "",
46
- createdAt: oldComment.createdAt
47
- }
48
- ]
49
- }));
50
- localStorage.setItem(STORAGE_KEY, JSON.stringify(threads));
51
- localStorage.removeItem("apollo-comments");
52
- return threads;
53
- }
54
- } catch (error) {
55
- console.error("Failed to migrate old comments:", error);
56
- }
57
- return [];
58
- };
59
- var CommentProvider = ({ children }) => {
60
- const [threads, setThreads] = React.useState(() => {
61
- try {
62
- const stored = localStorage.getItem(STORAGE_KEY);
63
- if (stored) {
64
- return JSON.parse(stored);
65
- }
66
- return migrateOldComments();
67
- } catch (error) {
68
- console.error("Failed to load threads from localStorage:", error);
69
- return [];
70
- }
71
- });
72
- const [showPins, setShowPins] = React.useState(() => {
73
- try {
74
- const stored = localStorage.getItem(SHOW_PINS_KEY);
75
- if (stored !== null) return stored === "true";
76
- const oldKey = localStorage.getItem("apollo-show-pins");
77
- return oldKey === "true";
78
- } catch (error) {
79
- return false;
80
- }
81
- });
82
- const [enableCommenting, setEnableCommenting] = React.useState(() => {
83
- try {
84
- const stored = localStorage.getItem(ENABLE_COMMENTING_KEY);
85
- if (stored !== null) return stored === "true";
86
- const oldKey = localStorage.getItem("apollo-enable-commenting");
87
- return oldKey === "true";
88
- } catch (error) {
89
- return false;
90
- }
91
- });
92
- React.useEffect(() => {
93
- try {
94
- localStorage.setItem(STORAGE_KEY, JSON.stringify(threads));
95
- } catch (error) {
96
- console.error("Failed to save threads to localStorage:", error);
97
- }
98
- }, [threads]);
99
- React.useEffect(() => {
100
- try {
101
- localStorage.setItem(SHOW_PINS_KEY, String(showPins));
102
- } catch (error) {
103
- console.error("Failed to save showPins to localStorage:", error);
104
- }
105
- }, [showPins]);
106
- React.useEffect(() => {
107
- try {
108
- localStorage.setItem(ENABLE_COMMENTING_KEY, String(enableCommenting));
109
- } catch (error) {
110
- console.error("Failed to save enableCommenting to localStorage:", error);
111
- }
112
- }, [enableCommenting]);
113
- const toggleShowPins = React.useCallback(() => {
114
- setShowPins((prev) => !prev);
115
- }, []);
116
- const toggleEnableCommenting = React.useCallback(() => {
117
- setEnableCommenting((prev) => !prev);
118
- }, []);
119
- const addThread = React.useCallback((x, y, route, version) => {
120
- const threadId = `thread-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
121
- const newThread = {
122
- id: threadId,
123
- x,
124
- y,
125
- route,
126
- comments: [],
127
- version
128
- };
129
- setThreads((prev) => [...prev, newThread]);
130
- return threadId;
131
- }, []);
132
- const addReply = React.useCallback((threadId, text) => {
133
- const commentId = `${threadId}-comment-${Date.now()}`;
134
- const newComment = {
135
- id: commentId,
136
- text,
137
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
138
- };
139
- setThreads(
140
- (prev) => prev.map((t) => {
141
- if (t.id === threadId) {
142
- return {
143
- ...t,
144
- comments: [...t.comments, newComment]
145
- };
146
- }
147
- return t;
148
- })
149
- );
150
- }, []);
151
- const updateComment = React.useCallback((threadId, commentId, text) => {
152
- setThreads(
153
- (prev) => prev.map((t) => {
154
- if (t.id === threadId) {
155
- return {
156
- ...t,
157
- comments: t.comments.map(
158
- (c) => c.id === commentId ? { ...c, text } : c
159
- )
160
- };
161
- }
162
- return t;
163
- })
164
- );
165
- }, []);
166
- const deleteComment = React.useCallback((threadId, commentId) => {
167
- setThreads(
168
- (prev) => prev.map((t) => {
169
- if (t.id === threadId) {
170
- return {
171
- ...t,
172
- comments: t.comments.filter((c) => c.id !== commentId)
173
- };
174
- }
175
- return t;
176
- })
177
- );
178
- }, []);
179
- const deleteThread = React.useCallback((threadId) => {
180
- setThreads((prev) => prev.filter((t) => t.id !== threadId));
181
- }, []);
182
- const clearAllThreads = React.useCallback(() => {
183
- setThreads([]);
184
- }, []);
185
- const getThreadsForRoute = React.useCallback((route, version) => {
186
- return threads.filter((thread) => {
187
- const routeMatch = thread.route === route;
188
- const threadVersion = thread.version || "3";
189
- const versionMatch = !version || threadVersion === version;
190
- return routeMatch && versionMatch;
191
- });
192
- }, [threads]);
193
- const value = React.useMemo(
194
- () => ({
195
- threads,
196
- showPins,
197
- enableCommenting,
198
- toggleShowPins,
199
- toggleEnableCommenting,
200
- addThread,
201
- addReply,
202
- updateComment,
203
- deleteComment,
204
- deleteThread,
205
- clearAllThreads,
206
- getThreadsForRoute
207
- }),
208
- [threads, showPins, enableCommenting, toggleShowPins, toggleEnableCommenting, addThread, addReply, updateComment, deleteComment, deleteThread, clearAllThreads, getThreadsForRoute]
209
- );
210
- return /* @__PURE__ */ jsx(CommentContext.Provider, { value, children });
211
- };
212
- var useComments = () => {
213
- const context = React.useContext(CommentContext);
214
- if (!context) {
215
- throw new Error("useComments must be used within a CommentProvider");
216
- }
217
- return context;
218
- };
219
-
220
- // src/contexts/VersionContext.tsx
221
- import * as React2 from "react";
222
- import { jsx as jsx2 } from "react/jsx-runtime";
223
- var VersionContext = React2.createContext(void 0);
224
- var VERSION_STORAGE_KEY = "hale-current-version";
225
- var VersionProvider = ({ children }) => {
226
- const [currentVersion, setCurrentVersionState] = React2.useState(() => {
227
- try {
228
- const stored = localStorage.getItem(VERSION_STORAGE_KEY);
229
- return stored || "3";
230
- } catch (error) {
231
- console.error("Failed to load version from localStorage:", error);
232
- return "3";
233
- }
234
- });
235
- React2.useEffect(() => {
236
- try {
237
- localStorage.setItem(VERSION_STORAGE_KEY, currentVersion);
238
- } catch (error) {
239
- console.error("Failed to save version to localStorage:", error);
240
- }
241
- }, [currentVersion]);
242
- const setCurrentVersion = React2.useCallback((version) => {
243
- setCurrentVersionState(version);
244
- }, []);
245
- const value = React2.useMemo(
246
- () => ({
247
- currentVersion,
248
- setCurrentVersion
249
- }),
250
- [currentVersion, setCurrentVersion]
251
- );
252
- return /* @__PURE__ */ jsx2(VersionContext.Provider, { value, children });
253
- };
254
- var useVersion = () => {
255
- const context = React2.useContext(VersionContext);
256
- if (!context) {
257
- throw new Error("useVersion must be used within a VersionProvider");
258
- }
259
- return context;
260
- };
261
-
262
- // src/components/CommentPin.tsx
263
- import { Button } from "@patternfly/react-core";
264
- import { CommentIcon } from "@patternfly/react-icons";
265
- import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
266
- var CommentPin = ({
267
- thread,
268
- onPinClick,
269
- isSelected = false
270
- }) => {
271
- const commentCount = thread.comments.length;
272
- return /* @__PURE__ */ jsxs(Fragment, { children: [
273
- /* @__PURE__ */ jsx3("style", { children: `
274
- @keyframes pulse {
275
- 0%, 100% { opacity: 1; }
276
- 50% { opacity: 0.5; }
277
- }
278
- ` }),
279
- /* @__PURE__ */ jsx3(
280
- Button,
281
- {
282
- id: `comment-pin-${thread.id}`,
283
- variant: "plain",
284
- "aria-label": `Comment thread with ${commentCount} ${commentCount === 1 ? "comment" : "comments"}`,
285
- onClick: (e) => {
286
- e.stopPropagation();
287
- onPinClick();
288
- },
289
- style: {
290
- position: "absolute",
291
- left: `${thread.x}px`,
292
- top: `${thread.y}px`,
293
- transform: "translate(-50%, -50%)",
294
- width: "32px",
295
- height: "32px",
296
- borderRadius: "50%",
297
- backgroundColor: "#C9190B",
298
- color: "white",
299
- border: isSelected ? "3px solid #0066CC" : "2px solid white",
300
- boxShadow: isSelected ? "0 0 0 2px #0066CC, 0 4px 12px rgba(0, 0, 0, 0.4)" : "0 2px 8px rgba(0, 0, 0, 0.3)",
301
- padding: 0,
302
- display: "flex",
303
- alignItems: "center",
304
- justifyContent: "center",
305
- cursor: "pointer",
306
- zIndex: isSelected ? 1001 : 1e3,
307
- transition: "all 0.2s ease",
308
- fontSize: commentCount > 1 ? "0.7rem" : void 0
309
- },
310
- children: commentCount === 0 ? /* @__PURE__ */ jsx3("span", { style: { fontWeight: "bold", fontSize: "0.75rem" }, children: "0" }) : commentCount === 1 ? /* @__PURE__ */ jsx3(CommentIcon, {}) : /* @__PURE__ */ jsx3("span", { style: { fontWeight: "bold" }, children: commentCount })
311
- }
312
- )
313
- ] });
314
- };
315
-
316
- // src/components/CommentOverlay.tsx
317
- import { jsx as jsx4 } from "react/jsx-runtime";
318
- var CommentOverlay = ({
319
- selectedThreadId,
320
- onThreadSelect
321
- }) => {
322
- const location = useLocation();
323
- const { showPins, enableCommenting, addThread, getThreadsForRoute } = useComments();
324
- const { currentVersion } = useVersion();
325
- const overlayRef = React3.useRef(null);
326
- const currentRouteThreads = React3.useMemo(
327
- () => getThreadsForRoute(location.pathname, currentVersion),
328
- [getThreadsForRoute, location.pathname, currentVersion]
329
- );
330
- const handleOverlayClick = React3.useCallback(
331
- (event) => {
332
- if (!enableCommenting) return;
333
- if (event.target === overlayRef.current) {
334
- const rect = overlayRef.current.getBoundingClientRect();
335
- const x = event.clientX - rect.left;
336
- const y = event.clientY - rect.top;
337
- const newThreadId = addThread(x, y, location.pathname, currentVersion);
338
- onThreadSelect(newThreadId);
339
- }
340
- },
341
- [enableCommenting, addThread, location.pathname, currentVersion, onThreadSelect]
342
- );
343
- if (!showPins && !enableCommenting) {
344
- return null;
345
- }
346
- return /* @__PURE__ */ jsx4(
347
- "div",
348
- {
349
- ref: overlayRef,
350
- id: "comment-overlay",
351
- onClick: handleOverlayClick,
352
- style: {
353
- position: "absolute",
354
- top: 0,
355
- left: 0,
356
- right: 0,
357
- bottom: 0,
358
- pointerEvents: enableCommenting ? "auto" : "none",
359
- cursor: enableCommenting ? "crosshair" : "default",
360
- zIndex: 999
361
- },
362
- children: showPins && currentRouteThreads.map((thread) => /* @__PURE__ */ jsx4(
363
- "div",
364
- {
365
- style: { pointerEvents: "auto" },
366
- onClick: (e) => e.stopPropagation(),
367
- children: /* @__PURE__ */ jsx4(
368
- CommentPin,
369
- {
370
- thread,
371
- onPinClick: () => onThreadSelect(thread.id),
372
- isSelected: thread.id === selectedThreadId
373
- }
374
- )
375
- },
376
- thread.id
377
- ))
378
- }
379
- );
380
- };
381
-
382
- // src/components/CommentDrawer.tsx
383
- import * as React5 from "react";
384
- import {
385
- Drawer,
386
- DrawerContent,
387
- DrawerContentBody,
388
- DrawerPanelContent,
389
- DrawerHead,
390
- DrawerActions,
391
- DrawerCloseButton,
392
- Title,
393
- Button as Button2,
394
- TextArea,
395
- Card,
396
- CardBody,
397
- CardTitle,
398
- EmptyState,
399
- EmptyStateBody,
400
- Divider,
401
- ExpandableSection,
402
- Alert
403
- } from "@patternfly/react-core";
404
- import { CommentIcon as CommentIcon2, TimesIcon, PlusCircleIcon, MagicIcon } from "@patternfly/react-icons";
405
- import { useLocation as useLocation2 } from "react-router-dom";
406
-
407
- // src/contexts/GitLabAuthContext.tsx
408
- import * as React4 from "react";
409
- import { jsx as jsx5 } from "react/jsx-runtime";
410
- var GitLabAuthContext = React4.createContext(void 0);
411
- var GitLabAuthProvider = ({ children }) => {
412
- const value = {
413
- user: null,
414
- isAuthenticated: false,
415
- login: () => {
416
- console.log("GitLab login not available in local mode");
417
- },
418
- logout: () => {
419
- console.log("GitLab logout not available in local mode");
420
- },
421
- getToken: () => null
422
- };
423
- return /* @__PURE__ */ jsx5(GitLabAuthContext.Provider, { value, children });
424
- };
425
- var useGitLabAuth = () => {
426
- const ctx = React4.useContext(GitLabAuthContext);
427
- if (!ctx) {
428
- throw new Error("useGitLabAuth must be used within a GitLabAuthProvider");
429
- }
430
- return ctx;
431
- };
432
-
433
- // src/components/CommentDrawer.tsx
434
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
435
- var CommentDrawer = ({
436
- children,
437
- selectedThreadId,
438
- onThreadSelect
439
- }) => {
440
- const location = useLocation2();
441
- const {
442
- getThreadsForRoute,
443
- addReply,
444
- updateComment,
445
- deleteComment,
446
- deleteThread,
447
- enableCommenting
448
- } = useComments();
449
- const { currentVersion } = useVersion();
450
- const { isAuthenticated: isGitLabAuthenticated } = useGitLabAuth();
451
- const [editingCommentId, setEditingCommentId] = React5.useState(null);
452
- const [editText, setEditText] = React5.useState("");
453
- const [replyText, setReplyText] = React5.useState("");
454
- const replyTextAreaRef = React5.useRef(null);
455
- const [threadSummaries, setThreadSummaries] = React5.useState({});
456
- const [loadingSummary, setLoadingSummary] = React5.useState(false);
457
- const [summaryExpanded, setSummaryExpanded] = React5.useState(true);
458
- const currentRouteThreads = getThreadsForRoute(location.pathname, currentVersion);
459
- const selectedThread = currentRouteThreads.find((t) => t.id === selectedThreadId);
460
- const isDrawerOpen = selectedThreadId !== null && selectedThread !== void 0;
461
- React5.useEffect(() => {
462
- if (!isDrawerOpen || !enableCommenting) return;
463
- const timer = setTimeout(() => {
464
- replyTextAreaRef.current?.focus();
465
- }, 100);
466
- return () => clearTimeout(timer);
467
- }, [isDrawerOpen, enableCommenting, selectedThreadId]);
468
- const handleEdit = (commentId, text) => {
469
- setEditingCommentId(commentId);
470
- setEditText(text);
471
- };
472
- const handleSave = async (threadId, commentId) => {
473
- await updateComment(threadId, commentId, editText);
474
- setEditingCommentId(null);
475
- };
476
- const handleAddReply = async () => {
477
- if (selectedThreadId && replyText.trim()) {
478
- await addReply(selectedThreadId, replyText);
479
- setReplyText("");
480
- }
481
- };
482
- const handleDeleteThread = async () => {
483
- if (selectedThreadId && window.confirm("Delete this entire thread and all its comments?")) {
484
- await deleteThread(selectedThreadId);
485
- onThreadSelect(null);
486
- }
487
- };
488
- const handleSummarizeThread = async () => {
489
- console.log("AI features not available in local-only mode");
490
- };
491
- const handleDeleteComment = async (threadId, commentId) => {
492
- if (window.confirm("Delete this comment?")) {
493
- await deleteComment(threadId, commentId);
494
- }
495
- };
496
- const formatDate = (isoDate) => {
497
- const date = new Date(isoDate);
498
- return date.toLocaleString(void 0, {
499
- month: "short",
500
- day: "numeric",
501
- hour: "2-digit",
502
- minute: "2-digit"
503
- });
504
- };
505
- const panelContent = /* @__PURE__ */ jsxs2(DrawerPanelContent, { isResizable: true, defaultSize: "400px", minSize: "300px", children: [
506
- /* @__PURE__ */ jsxs2(DrawerHead, { children: [
507
- /* @__PURE__ */ jsx6("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", flex: 1 }, children: /* @__PURE__ */ jsxs2(Title, { headingLevel: "h2", size: "xl", children: [
508
- /* @__PURE__ */ jsx6(CommentIcon2, { style: { marginRight: "0.5rem", color: "#C9190B" } }),
509
- "Thread"
510
- ] }) }),
511
- /* @__PURE__ */ jsx6(DrawerActions, { children: /* @__PURE__ */ jsx6(DrawerCloseButton, { onClick: () => onThreadSelect(null) }) })
512
- ] }),
513
- /* @__PURE__ */ jsx6(DrawerContentBody, { style: { padding: "1rem" }, children: !selectedThread ? /* @__PURE__ */ jsxs2(EmptyState, { children: [
514
- /* @__PURE__ */ jsx6(CommentIcon2, { style: { fontSize: "3rem", color: "var(--pf-v6-global--Color--200)", marginBottom: "1rem" } }),
515
- /* @__PURE__ */ jsx6(Title, { headingLevel: "h3", size: "lg", children: "No thread selected" }),
516
- /* @__PURE__ */ jsx6(EmptyStateBody, { children: "Click a pin to view its comments." })
517
- ] }) : /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
518
- /* @__PURE__ */ jsx6(Card, { isCompact: true, children: /* @__PURE__ */ jsxs2(CardBody, { children: [
519
- /* @__PURE__ */ jsxs2("div", { style: { fontSize: "0.875rem", marginBottom: "0.5rem" }, children: [
520
- /* @__PURE__ */ jsx6("strong", { children: "Location:" }),
521
- " (",
522
- Math.round(selectedThread.x),
523
- ", ",
524
- Math.round(selectedThread.y),
525
- ")"
526
- ] }),
527
- selectedThread.version && /* @__PURE__ */ jsxs2("div", { style: { fontSize: "0.875rem", marginBottom: "0.5rem" }, children: [
528
- /* @__PURE__ */ jsx6("strong", { children: "Version:" }),
529
- " ",
530
- selectedThread.version
531
- ] }),
532
- /* @__PURE__ */ jsxs2("div", { style: { fontSize: "0.875rem", marginBottom: "0.5rem" }, children: [
533
- /* @__PURE__ */ jsx6("strong", { children: "Comments:" }),
534
- " ",
535
- selectedThread.comments.length
536
- ] }),
537
- selectedThread.comments.length > 0 && /* @__PURE__ */ jsx6(
538
- Button2,
539
- {
540
- id: `ai-summarize-thread-${selectedThread.id}`,
541
- variant: "secondary",
542
- size: "sm",
543
- icon: /* @__PURE__ */ jsx6(MagicIcon, {}),
544
- onClick: handleSummarizeThread,
545
- isLoading: loadingSummary,
546
- isDisabled: loadingSummary,
547
- style: { marginTop: "0.5rem" },
548
- children: loadingSummary ? "Generating..." : "AI Summarize Thread"
549
- }
550
- ),
551
- enableCommenting && /* @__PURE__ */ jsx6(
552
- Button2,
553
- {
554
- id: `delete-thread-${selectedThread.id}`,
555
- variant: "danger",
556
- size: "sm",
557
- icon: /* @__PURE__ */ jsx6(TimesIcon, {}),
558
- onClick: handleDeleteThread,
559
- style: { marginTop: "0.5rem", marginLeft: selectedThread.comments.length > 0 ? "0.5rem" : "0" },
560
- children: "Delete Thread"
561
- }
562
- )
563
- ] }) }),
564
- threadSummaries[selectedThread.id] && /* @__PURE__ */ jsx6(
565
- Alert,
566
- {
567
- variant: "info",
568
- isInline: true,
569
- title: "AI Summary",
570
- actionClose: /* @__PURE__ */ jsx6(
571
- Button2,
572
- {
573
- variant: "plain",
574
- onClick: () => {
575
- const newSummaries = { ...threadSummaries };
576
- delete newSummaries[selectedThread.id];
577
- setThreadSummaries(newSummaries);
578
- },
579
- "aria-label": "Clear summary",
580
- children: /* @__PURE__ */ jsx6(TimesIcon, {})
581
- }
582
- ),
583
- children: /* @__PURE__ */ jsx6(
584
- ExpandableSection,
585
- {
586
- toggleText: summaryExpanded ? "Hide summary" : "Show summary",
587
- onToggle: (_event, isExpanded) => setSummaryExpanded(isExpanded),
588
- isExpanded: summaryExpanded,
589
- isIndented: true,
590
- children: /* @__PURE__ */ jsx6("div", { style: { fontSize: "0.875rem", lineHeight: "1.5" }, children: threadSummaries[selectedThread.id] })
591
- }
592
- )
593
- }
594
- ),
595
- /* @__PURE__ */ jsx6(Divider, {}),
596
- /* @__PURE__ */ jsx6("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: selectedThread.comments.length === 0 ? /* @__PURE__ */ jsxs2(EmptyState, { children: [
597
- /* @__PURE__ */ jsx6(Title, { headingLevel: "h4", size: "md", children: "No comments yet" }),
598
- /* @__PURE__ */ jsx6(EmptyStateBody, { children: enableCommenting ? "Add a reply below to start the conversation." : "Enable commenting to add replies." })
599
- ] }) : selectedThread.comments.map((comment, index) => /* @__PURE__ */ jsxs2(Card, { isCompact: true, children: [
600
- /* @__PURE__ */ jsxs2(CardTitle, { children: [
601
- "Comment #",
602
- index + 1,
603
- /* @__PURE__ */ jsxs2("div", { style: { fontSize: "0.75rem", color: "var(--pf-v6-global--Color--200)", fontWeight: "normal" }, children: [
604
- comment.author && /* @__PURE__ */ jsxs2("span", { style: { marginRight: "0.5rem" }, children: [
605
- "@",
606
- comment.author
607
- ] }),
608
- formatDate(comment.createdAt)
609
- ] })
610
- ] }),
611
- /* @__PURE__ */ jsx6(CardBody, { children: editingCommentId === comment.id ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
612
- /* @__PURE__ */ jsx6(
613
- TextArea,
614
- {
615
- id: `edit-comment-${comment.id}`,
616
- value: editText,
617
- onChange: (_event, value) => setEditText(value),
618
- rows: 3,
619
- style: { marginBottom: "0.5rem" },
620
- onKeyDown: (e) => {
621
- if (e.key === "Enter" && !e.shiftKey) {
622
- e.preventDefault();
623
- handleSave(selectedThread.id, comment.id);
624
- }
625
- if (e.key === "Escape") {
626
- setEditingCommentId(null);
627
- }
628
- }
629
- }
630
- ),
631
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: "0.5rem" }, children: [
632
- /* @__PURE__ */ jsx6(
633
- Button2,
634
- {
635
- id: `save-comment-${comment.id}`,
636
- variant: "primary",
637
- size: "sm",
638
- onClick: () => handleSave(selectedThread.id, comment.id),
639
- children: "Save"
640
- }
641
- ),
642
- /* @__PURE__ */ jsx6(
643
- Button2,
644
- {
645
- id: `cancel-edit-${comment.id}`,
646
- variant: "link",
647
- size: "sm",
648
- onClick: () => setEditingCommentId(null),
649
- children: "Cancel"
650
- }
651
- )
652
- ] })
653
- ] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
654
- /* @__PURE__ */ jsx6("div", { style: { marginBottom: "0.75rem", whiteSpace: "pre-wrap" }, children: comment.text || /* @__PURE__ */ jsx6("em", { style: { color: "var(--pf-v6-global--Color--200)" }, children: "No text" }) }),
655
- enableCommenting && /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: "0.5rem" }, children: [
656
- /* @__PURE__ */ jsx6(
657
- Button2,
658
- {
659
- id: `edit-comment-btn-${comment.id}`,
660
- variant: "secondary",
661
- size: "sm",
662
- onClick: () => handleEdit(comment.id, comment.text),
663
- children: "Edit"
664
- }
665
- ),
666
- /* @__PURE__ */ jsx6(
667
- Button2,
668
- {
669
- id: `delete-comment-btn-${comment.id}`,
670
- variant: "danger",
671
- size: "sm",
672
- icon: /* @__PURE__ */ jsx6(TimesIcon, {}),
673
- onClick: () => handleDeleteComment(selectedThread.id, comment.id),
674
- children: "Delete"
675
- }
676
- )
677
- ] })
678
- ] }) })
679
- ] }, comment.id)) }),
680
- enableCommenting && /* @__PURE__ */ jsxs2(Fragment2, { children: [
681
- /* @__PURE__ */ jsx6(Divider, {}),
682
- /* @__PURE__ */ jsxs2(Card, { isCompact: true, children: [
683
- /* @__PURE__ */ jsxs2(CardTitle, { children: [
684
- /* @__PURE__ */ jsx6(PlusCircleIcon, { style: { marginRight: "0.5rem" } }),
685
- "Add Reply"
686
- ] }),
687
- /* @__PURE__ */ jsxs2(CardBody, { children: [
688
- /* @__PURE__ */ jsx6(
689
- TextArea,
690
- {
691
- ref: replyTextAreaRef,
692
- id: `reply-textarea-${selectedThread.id}`,
693
- value: replyText,
694
- onChange: (_event, value) => setReplyText(value),
695
- placeholder: "Enter your reply...",
696
- rows: 3,
697
- style: { marginBottom: "0.5rem" },
698
- onKeyDown: (e) => {
699
- if (e.key === "Enter" && !e.shiftKey) {
700
- e.preventDefault();
701
- handleAddReply();
702
- }
703
- }
704
- }
705
- ),
706
- /* @__PURE__ */ jsx6(
707
- Button2,
708
- {
709
- id: `add-reply-${selectedThread.id}`,
710
- variant: "primary",
711
- size: "sm",
712
- onClick: handleAddReply,
713
- isDisabled: !replyText.trim(),
714
- children: "Add Reply"
715
- }
716
- )
717
- ] })
718
- ] })
719
- ] })
720
- ] }) })
721
- ] });
722
- return /* @__PURE__ */ jsx6(Drawer, { isExpanded: isDrawerOpen, isInline: true, position: "right", children: /* @__PURE__ */ jsx6(DrawerContent, { panelContent, children: /* @__PURE__ */ jsx6(DrawerContentBody, { children }) }) });
723
- };
724
-
725
- // src/contexts/GitHubAuthContext.tsx
726
- import * as React6 from "react";
727
- import { jsx as jsx7 } from "react/jsx-runtime";
728
- var GitHubAuthContext = React6.createContext(void 0);
729
- var GitHubAuthProvider = ({ children }) => {
730
- const value = {
731
- user: null,
732
- isAuthenticated: false,
733
- login: () => {
734
- console.log("GitHub login not available in local mode");
735
- },
736
- logout: () => {
737
- console.log("GitHub logout not available in local mode");
738
- }
739
- };
740
- return /* @__PURE__ */ jsx7(GitHubAuthContext.Provider, { value, children });
741
- };
742
- var useGitHubAuth = () => {
743
- const context = React6.useContext(GitHubAuthContext);
744
- if (context === void 0) {
745
- throw new Error("useGitHubAuth must be used within a GitHubAuthProvider");
746
- }
747
- return context;
748
- };
749
- export {
750
- CommentDrawer,
751
- CommentOverlay,
752
- CommentPin,
753
- CommentProvider,
754
- GitHubAuthProvider,
755
- GitLabAuthProvider,
756
- VersionProvider,
757
- useComments,
758
- useGitHubAuth,
759
- useGitLabAuth,
760
- useVersion
761
- };
762
- //# sourceMappingURL=index.mjs.map