@mvriu5/payload-ai 0.5.10 → 1.2.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/dist/components/AIInput.js +318 -112
- package/dist/components/AIInput.module.css +11 -2
- package/dist/components/APIKeyField.js +41 -24
- package/dist/components/ActionToast.d.ts +2 -1
- package/dist/components/ActionToast.js +203 -103
- package/dist/components/AuditLogList.js +90 -53
- package/dist/components/DiffDialog.js +222 -121
- package/dist/components/Icons.js +390 -274
- package/dist/components/MentionPopover.js +33 -22
- package/dist/handlers/applyActionHandler.js +316 -107
- package/dist/handlers/chatHandler.js +749 -50
- package/dist/handlers/proposalDiffHandler.js +81 -26
- package/dist/index.js +2 -2
- package/dist/payload/logging.d.ts +9 -0
- package/dist/payload/logging.js +14 -0
- package/dist/payload/normalizeData.d.ts +17 -7
- package/dist/payload/normalizeData.js +22 -1
- package/dist/payload/proposalData.d.ts +31 -0
- package/dist/payload/proposalData.js +575 -0
- package/dist/payload/schemaContext.d.ts +3 -7
- package/dist/payload/schemaContext.js +49 -23
- package/package.json +40 -9
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useField } from "@payloadcms/ui";
|
|
3
4
|
const getFieldClassName = ({ className, isReadOnly, showError })=>[
|
|
4
5
|
"field-type",
|
|
@@ -14,33 +15,49 @@ const APIKeyField = ({ field, inputRef, path, readOnly })=>{
|
|
|
14
15
|
const fieldID = `field-${path.replace(/\./g, "__")}`;
|
|
15
16
|
const isReadOnly = readOnly || disabled || field.admin?.disabled;
|
|
16
17
|
const handleChange = (event)=>setValue(event.target.value);
|
|
17
|
-
return /*#__PURE__*/
|
|
18
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
18
19
|
className: getFieldClassName({
|
|
19
20
|
className: field.admin?.className,
|
|
20
21
|
isReadOnly,
|
|
21
22
|
showError
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
23
|
+
}),
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ _jsxs("label", {
|
|
26
|
+
className: "field-label",
|
|
27
|
+
htmlFor: fieldID,
|
|
28
|
+
children: [
|
|
29
|
+
field?.label?.toString(),
|
|
30
|
+
field.required ? /*#__PURE__*/ _jsx("span", {
|
|
31
|
+
className: "required",
|
|
32
|
+
children: "*"
|
|
33
|
+
}) : null
|
|
34
|
+
]
|
|
35
|
+
}),
|
|
36
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
37
|
+
className: "field-type__wrap",
|
|
38
|
+
children: [
|
|
39
|
+
showError && errorMessage ? /*#__PURE__*/ _jsx("div", {
|
|
40
|
+
className: "field-error",
|
|
41
|
+
children: errorMessage
|
|
42
|
+
}) : null,
|
|
43
|
+
/*#__PURE__*/ _jsx("input", {
|
|
44
|
+
autoComplete: "new-password",
|
|
45
|
+
disabled: isReadOnly,
|
|
46
|
+
id: fieldID,
|
|
47
|
+
name: path,
|
|
48
|
+
onChange: handleChange,
|
|
49
|
+
placeholder: field.admin?.placeholder?.toString(),
|
|
50
|
+
ref: inputRef,
|
|
51
|
+
type: "password",
|
|
52
|
+
value: value || ""
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ _jsx("div", {
|
|
55
|
+
className: "field-description",
|
|
56
|
+
children: field.admin?.description?.toString()
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
45
62
|
};
|
|
46
63
|
export default APIKeyField;
|
|
@@ -19,6 +19,7 @@ type ActionToastProps = {
|
|
|
19
19
|
onDismiss?: () => void;
|
|
20
20
|
onDismissError?: () => void;
|
|
21
21
|
onApply: (proposal: ActionProposal, index: number) => void;
|
|
22
|
+
prompt?: string;
|
|
22
23
|
proposals: ActionProposal[];
|
|
23
24
|
tokenUsage?: {
|
|
24
25
|
inputTokens?: number;
|
|
@@ -26,5 +27,5 @@ type ActionToastProps = {
|
|
|
26
27
|
totalTokens?: number;
|
|
27
28
|
} | null;
|
|
28
29
|
};
|
|
29
|
-
export declare const ActionToast: ({ apiRoute, appliedProposalIndexes, description, error, getViewURL, isApplying, onDismiss, onDismissError, onApply, proposals, tokenUsage, }: ActionToastProps) => import("react").JSX.Element | null;
|
|
30
|
+
export declare const ActionToast: ({ apiRoute, appliedProposalIndexes, description, error, getViewURL, isApplying, onDismiss, onDismissError, onApply, prompt, proposals, tokenUsage, }: ActionToastProps) => import("react").JSX.Element | null;
|
|
30
31
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import styles from "./ActionToast.module.css";
|
|
2
3
|
import { redactSensitiveData } from "../ai/sensitiveData.js";
|
|
3
4
|
import { formatAdminURL } from "payload/shared";
|
|
@@ -19,7 +20,7 @@ const getSafeProposalDetails = (proposal)=>{
|
|
|
19
20
|
}
|
|
20
21
|
return redactedProposal;
|
|
21
22
|
};
|
|
22
|
-
export const ActionToast = ({ apiRoute, appliedProposalIndexes, description, error, getViewURL, isApplying, onDismiss, onDismissError, onApply, proposals, tokenUsage })=>{
|
|
23
|
+
export const ActionToast = ({ apiRoute, appliedProposalIndexes, description, error, getViewURL, isApplying, onDismiss, onDismissError, onApply, prompt, proposals, tokenUsage })=>{
|
|
23
24
|
const [activeDiff, setActiveDiff] = useState(null);
|
|
24
25
|
const [diffError, setDiffError] = useState("");
|
|
25
26
|
const [loadingDiffIndex, setLoadingDiffIndex] = useState(null);
|
|
@@ -35,7 +36,8 @@ export const ActionToast = ({ apiRoute, appliedProposalIndexes, description, err
|
|
|
35
36
|
path: "/ai-proposal-diff"
|
|
36
37
|
}), {
|
|
37
38
|
body: JSON.stringify({
|
|
38
|
-
proposal
|
|
39
|
+
proposal,
|
|
40
|
+
prompt
|
|
39
41
|
}),
|
|
40
42
|
headers: {
|
|
41
43
|
"Content-Type": "application/json"
|
|
@@ -60,105 +62,203 @@ export const ActionToast = ({ apiRoute, appliedProposalIndexes, description, err
|
|
|
60
62
|
setLoadingDiffIndex(null);
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
|
-
return /*#__PURE__*/
|
|
64
|
-
className: styles.list
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
65
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
66
|
+
className: styles.list,
|
|
67
|
+
children: [
|
|
68
|
+
error && /*#__PURE__*/ _jsxs("div", {
|
|
69
|
+
className: `${styles.item} ${styles.errorItem}`,
|
|
70
|
+
children: [
|
|
71
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
72
|
+
children: [
|
|
73
|
+
/*#__PURE__*/ _jsx("div", {
|
|
74
|
+
className: styles.label,
|
|
75
|
+
children: "AI request failed"
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ _jsx("div", {
|
|
78
|
+
className: styles.description,
|
|
79
|
+
children: error
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
}),
|
|
83
|
+
onDismissError && /*#__PURE__*/ _jsx("button", {
|
|
84
|
+
className: styles.button,
|
|
85
|
+
onClick: onDismissError,
|
|
86
|
+
type: "button",
|
|
87
|
+
children: "Dismiss"
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
}),
|
|
91
|
+
!error && proposals.length === 0 && description && /*#__PURE__*/ _jsx("div", {
|
|
92
|
+
className: styles.item,
|
|
93
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
94
|
+
children: [
|
|
95
|
+
/*#__PURE__*/ _jsx("div", {
|
|
96
|
+
className: styles.label,
|
|
97
|
+
children: "AI response"
|
|
98
|
+
}),
|
|
99
|
+
/*#__PURE__*/ _jsx("div", {
|
|
100
|
+
className: styles.description,
|
|
101
|
+
children: descriptionPreview
|
|
102
|
+
}),
|
|
103
|
+
isDescriptionTruncated && /*#__PURE__*/ _jsxs("details", {
|
|
104
|
+
className: styles.details,
|
|
105
|
+
children: [
|
|
106
|
+
/*#__PURE__*/ _jsx("summary", {
|
|
107
|
+
className: styles.summary,
|
|
108
|
+
children: "Full response"
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ _jsx("pre", {
|
|
111
|
+
className: styles.proposalDetails,
|
|
112
|
+
children: description
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
})
|
|
116
|
+
]
|
|
117
|
+
})
|
|
118
|
+
}),
|
|
119
|
+
proposals.map((proposal, index)=>{
|
|
120
|
+
const isApplied = appliedProposalIndexes.includes(index);
|
|
121
|
+
const viewURL = getViewURL?.(proposal);
|
|
122
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
123
|
+
className: styles.item,
|
|
124
|
+
children: [
|
|
125
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
126
|
+
className: styles.content,
|
|
127
|
+
children: [
|
|
128
|
+
/*#__PURE__*/ _jsx("div", {
|
|
129
|
+
className: styles.label,
|
|
130
|
+
children: proposal.label
|
|
131
|
+
}),
|
|
132
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
133
|
+
className: styles.meta,
|
|
134
|
+
children: [
|
|
135
|
+
proposal.action,
|
|
136
|
+
" in ",
|
|
137
|
+
proposal.collection || proposal.slug,
|
|
138
|
+
proposal.id ? ` #${proposal.id}` : ""
|
|
139
|
+
]
|
|
140
|
+
}),
|
|
141
|
+
description && /*#__PURE__*/ _jsx("div", {
|
|
142
|
+
className: styles.description,
|
|
143
|
+
children: descriptionPreview
|
|
144
|
+
}),
|
|
145
|
+
description && isDescriptionTruncated && /*#__PURE__*/ _jsxs("details", {
|
|
146
|
+
className: styles.details,
|
|
147
|
+
children: [
|
|
148
|
+
/*#__PURE__*/ _jsx("summary", {
|
|
149
|
+
className: styles.summary,
|
|
150
|
+
children: "Full response"
|
|
151
|
+
}),
|
|
152
|
+
/*#__PURE__*/ _jsx("pre", {
|
|
153
|
+
className: styles.proposalDetails,
|
|
154
|
+
children: description
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}),
|
|
158
|
+
/*#__PURE__*/ _jsxs("details", {
|
|
159
|
+
className: styles.details,
|
|
160
|
+
children: [
|
|
161
|
+
/*#__PURE__*/ _jsx("summary", {
|
|
162
|
+
className: styles.summary,
|
|
163
|
+
children: "Details"
|
|
164
|
+
}),
|
|
165
|
+
/*#__PURE__*/ _jsx("pre", {
|
|
166
|
+
className: styles.proposalDetails,
|
|
167
|
+
children: JSON.stringify(getSafeProposalDetails(proposal), null, 2)
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
}),
|
|
173
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
174
|
+
className: styles.footer,
|
|
175
|
+
children: [
|
|
176
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
177
|
+
className: styles.viewAction,
|
|
178
|
+
children: [
|
|
179
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
180
|
+
"aria-label": `Review proposal: ${proposal.label}`,
|
|
181
|
+
className: styles.secondaryButton,
|
|
182
|
+
disabled: loadingDiffIndex === index,
|
|
183
|
+
onClick: ()=>void openDiff(proposal, index),
|
|
184
|
+
type: "button",
|
|
185
|
+
children: [
|
|
186
|
+
/*#__PURE__*/ _jsx(FileDiff, {
|
|
187
|
+
height: 16,
|
|
188
|
+
width: 16
|
|
189
|
+
}),
|
|
190
|
+
loadingDiffIndex === index ? "Loading" : "Review"
|
|
191
|
+
]
|
|
192
|
+
}),
|
|
193
|
+
viewURL && /*#__PURE__*/ _jsx("a", {
|
|
194
|
+
className: styles.ghostButton,
|
|
195
|
+
href: viewURL,
|
|
196
|
+
rel: "noreferrer noopener",
|
|
197
|
+
target: "_blank",
|
|
198
|
+
children: "Go to source"
|
|
199
|
+
})
|
|
200
|
+
]
|
|
201
|
+
}),
|
|
202
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
203
|
+
className: styles.actions,
|
|
204
|
+
children: [
|
|
205
|
+
onDismiss && /*#__PURE__*/ _jsx("button", {
|
|
206
|
+
"aria-label": "Dismiss proposals",
|
|
207
|
+
className: styles.secondaryButton,
|
|
208
|
+
onClick: onDismiss,
|
|
209
|
+
type: "button",
|
|
210
|
+
children: /*#__PURE__*/ _jsx(Reject, {
|
|
211
|
+
height: 16,
|
|
212
|
+
width: 16
|
|
213
|
+
})
|
|
214
|
+
}),
|
|
215
|
+
/*#__PURE__*/ _jsx("button", {
|
|
216
|
+
"aria-label": `Apply proposal: ${proposal.label}`,
|
|
217
|
+
className: styles.button,
|
|
218
|
+
disabled: isApplying || isApplied,
|
|
219
|
+
onClick: ()=>onApply(proposal, index),
|
|
220
|
+
type: "button",
|
|
221
|
+
children: /*#__PURE__*/ _jsx(Apply, {
|
|
222
|
+
height: 16,
|
|
223
|
+
width: 16
|
|
224
|
+
})
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
})
|
|
230
|
+
]
|
|
231
|
+
}, `${proposal.action}-${index}`);
|
|
232
|
+
}),
|
|
233
|
+
diffError && /*#__PURE__*/ _jsxs("div", {
|
|
234
|
+
className: `${styles.item} ${styles.errorItem}`,
|
|
235
|
+
children: [
|
|
236
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
237
|
+
children: [
|
|
238
|
+
/*#__PURE__*/ _jsx("div", {
|
|
239
|
+
className: styles.label,
|
|
240
|
+
children: "Diff review failed"
|
|
241
|
+
}),
|
|
242
|
+
/*#__PURE__*/ _jsx("div", {
|
|
243
|
+
className: styles.description,
|
|
244
|
+
children: diffError
|
|
245
|
+
})
|
|
246
|
+
]
|
|
247
|
+
}),
|
|
248
|
+
/*#__PURE__*/ _jsx("button", {
|
|
249
|
+
className: styles.button,
|
|
250
|
+
onClick: ()=>setDiffError(""),
|
|
251
|
+
type: "button",
|
|
252
|
+
children: "Dismiss"
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
}),
|
|
256
|
+
activeDiff && /*#__PURE__*/ _jsx(DiffDialog, {
|
|
257
|
+
diff: activeDiff.diff,
|
|
258
|
+
onClose: ()=>setActiveDiff(null),
|
|
259
|
+
proposal: activeDiff.proposal,
|
|
260
|
+
tokenUsage: tokenUsage || undefined
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
});
|
|
164
264
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { useState } from "react";
|
|
2
3
|
import { ExternalLinkIcon } from "@payloadcms/ui";
|
|
3
4
|
import { DiffDialog } from "./DiffDialog.js";
|
|
@@ -11,57 +12,93 @@ const getChangeProposal = (change)=>({
|
|
|
11
12
|
});
|
|
12
13
|
export const RecentChangesList = ({ allChangesURL, changes })=>{
|
|
13
14
|
const [activeDiff, setActiveDiff] = useState(null);
|
|
14
|
-
return /*#__PURE__*/
|
|
15
|
-
className: styles.recentChanges
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
15
|
+
return /*#__PURE__*/ _jsxs("aside", {
|
|
16
|
+
className: styles.recentChanges,
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
19
|
+
className: styles.header,
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
22
|
+
className: styles.title,
|
|
23
|
+
children: "Recent changes"
|
|
24
|
+
}),
|
|
25
|
+
allChangesURL && /*#__PURE__*/ _jsx("a", {
|
|
26
|
+
className: styles.headerGhostButton,
|
|
27
|
+
href: allChangesURL,
|
|
28
|
+
children: "View all"
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ _jsx("div", {
|
|
33
|
+
className: styles.list,
|
|
34
|
+
children: changes.length === 0 ? /*#__PURE__*/ _jsx("div", {
|
|
35
|
+
className: styles.empty,
|
|
36
|
+
children: "No changes yet."
|
|
37
|
+
}) : changes.slice(0, 10).map((change, index)=>/*#__PURE__*/ _jsxs("div", {
|
|
38
|
+
className: styles.item,
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
41
|
+
className: styles.titleRow,
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ _jsx("div", {
|
|
44
|
+
className: styles.itemTitle,
|
|
45
|
+
children: change.title
|
|
46
|
+
}),
|
|
47
|
+
change.url && /*#__PURE__*/ _jsx("a", {
|
|
48
|
+
className: styles.ghostButton,
|
|
49
|
+
href: change.url,
|
|
50
|
+
rel: "noreferrer noopener",
|
|
51
|
+
target: "_blank",
|
|
52
|
+
children: /*#__PURE__*/ _jsx(ExternalLinkIcon, {})
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
57
|
+
className: styles.stats,
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ _jsxs("code", {
|
|
60
|
+
className: styles.additions,
|
|
61
|
+
children: [
|
|
62
|
+
"+",
|
|
63
|
+
change.additions
|
|
64
|
+
]
|
|
65
|
+
}),
|
|
66
|
+
/*#__PURE__*/ _jsxs("code", {
|
|
67
|
+
className: styles.removals,
|
|
68
|
+
children: [
|
|
69
|
+
"-",
|
|
70
|
+
change.removals
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ _jsx("button", {
|
|
76
|
+
className: styles.button,
|
|
77
|
+
onClick: ()=>{
|
|
78
|
+
if (change.before === undefined || change.after === undefined) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
setActiveDiff({
|
|
82
|
+
change,
|
|
83
|
+
diff: {
|
|
84
|
+
after: change.after,
|
|
85
|
+
before: change.before
|
|
86
|
+
},
|
|
87
|
+
proposal: getChangeProposal(change)
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
type: "button",
|
|
91
|
+
children: "Review"
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
}, `${change.title}-${index}`))
|
|
95
|
+
}),
|
|
96
|
+
activeDiff && activeDiff.change && /*#__PURE__*/ _jsx(DiffDialog, {
|
|
97
|
+
change: activeDiff.change,
|
|
98
|
+
diff: activeDiff.diff,
|
|
99
|
+
onClose: ()=>setActiveDiff(null),
|
|
100
|
+
proposal: activeDiff.proposal
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
});
|
|
67
104
|
};
|