@pablo2410/shared-ui 0.6.0 → 0.6.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.
@@ -1,201 +1,406 @@
1
1
  import {
2
2
  cn
3
3
  } from "../chunk-JT3XLKKD.js";
4
+ import {
5
+ Badge,
6
+ Button,
7
+ Dialog,
8
+ DialogContent,
9
+ DialogDescription,
10
+ DialogFooter,
11
+ DialogHeader,
12
+ DialogTitle,
13
+ DropdownMenu,
14
+ DropdownMenuContent,
15
+ DropdownMenuItem,
16
+ DropdownMenuSeparator,
17
+ DropdownMenuTrigger,
18
+ Input,
19
+ Label,
20
+ Select,
21
+ SelectContent,
22
+ SelectItem,
23
+ SelectTrigger,
24
+ SelectValue,
25
+ Textarea
26
+ } from "../chunk-LTUYIBMA.js";
4
27
 
5
28
  // src/reporting/ReportingToolbar.tsx
29
+ import { useState } from "react";
6
30
  import {
7
31
  ShieldAlert,
8
32
  Leaf,
9
33
  OctagonX,
10
- AlertTriangle,
11
- Lightbulb
34
+ Bug,
35
+ Lightbulb,
36
+ ChevronDown,
37
+ Send,
38
+ AlertTriangle
12
39
  } from "lucide-react";
13
- import { useState, useCallback } from "react";
40
+ import { toast } from "sonner";
14
41
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
- var REPORT_ICONS = {
16
- safety: ShieldAlert,
17
- environmental: Leaf,
18
- "stop-work": OctagonX
19
- };
20
- var FEEDBACK_ICONS = {
21
- problem: AlertTriangle,
22
- suggestion: Lightbulb
23
- };
24
- var REPORT_COLORS = {
25
- safety: "#ef4444",
26
- environmental: "#22c55e",
27
- "stop-work": "#f59e0b"
28
- };
29
- var FEEDBACK_COLORS = {
30
- problem: "#ef4444",
31
- suggestion: "#8C34E9"
32
- };
33
- var REPORT_LABELS = {
34
- safety: "Safety",
35
- environmental: "Environmental",
36
- "stop-work": "Stop Work"
37
- };
38
- var FEEDBACK_LABELS = {
39
- problem: "Problem",
40
- suggestion: "Suggestion"
41
- };
42
- var REPORT_DESCRIPTIONS = {
43
- safety: "Report a safety incident, near-miss, or hazard",
44
- environmental: "Report an environmental incident or concern",
45
- "stop-work": "Raise a stop work authority \u2014 immediate safety concern"
46
- };
47
- var FEEDBACK_DESCRIPTIONS = {
48
- problem: "Report a problem with the platform",
49
- suggestion: "Suggest an improvement or new feature"
50
- };
51
- function ToolbarButton({
52
- icon: Icon,
53
- label,
54
- color,
55
- compact,
56
- onClick
57
- }) {
58
- return /* @__PURE__ */ jsxs(
59
- "button",
60
- {
61
- onClick,
62
- className: cn(
63
- "flex items-center gap-1.5 rounded-md transition-all duration-200",
64
- "outline-none focus-visible:ring-1 focus-visible:ring-[#8C34E9]",
65
- "hover:opacity-90 cursor-pointer",
66
- compact ? "px-2 py-1" : "px-2.5 py-1.5"
67
- ),
68
- style: {
69
- backgroundColor: `${color}15`,
70
- color,
71
- border: `1px solid ${color}30`
72
- },
73
- title: label,
74
- children: [
75
- /* @__PURE__ */ jsx(Icon, { className: cn("shrink-0", compact ? "h-3.5 w-3.5" : "h-4 w-4") }),
76
- !compact && /* @__PURE__ */ jsx("span", { className: cn("text-xs font-medium", compact ? "hidden sm:inline" : ""), children: label })
77
- ]
78
- }
79
- );
80
- }
42
+ var ALL_REPORT_OPTIONS = [
43
+ {
44
+ category: "safety",
45
+ label: "Safety Incident",
46
+ description: "Report a safety hazard, near miss, or injury",
47
+ icon: ShieldAlert,
48
+ color: "#EF4444"
49
+ },
50
+ {
51
+ category: "environmental",
52
+ label: "Environmental",
53
+ description: "Report an environmental concern or spill",
54
+ icon: Leaf,
55
+ color: "#22C55E"
56
+ },
57
+ {
58
+ category: "stop-work",
59
+ label: "Stop Work",
60
+ description: "Raise a stop work authority \u2014 immediate halt",
61
+ icon: OctagonX,
62
+ color: "#F59E0B"
63
+ }
64
+ ];
65
+ var ALL_FEEDBACK_OPTIONS = [
66
+ {
67
+ category: "problem",
68
+ label: "Report Problem",
69
+ description: "Something isn't working",
70
+ icon: Bug,
71
+ color: "#EF4444"
72
+ },
73
+ {
74
+ category: "suggestion",
75
+ label: "Suggestion",
76
+ description: "Idea for improvement",
77
+ icon: Lightbulb,
78
+ color: "#8C34E9"
79
+ }
80
+ ];
81
+ var SEVERITY_OPTIONS = [
82
+ { value: "critical", label: "Critical", color: "#EF4444" },
83
+ { value: "high", label: "High", color: "#F59E0B" },
84
+ { value: "medium", label: "Medium", color: "#3b82f6" },
85
+ { value: "low", label: "Low", color: "#22C55E" }
86
+ ];
81
87
  function ReportingToolbar({
82
- moduleName,
88
+ moduleName = "Oplytics",
83
89
  showIncidentReporting = true,
84
90
  showFeedback = true,
85
91
  reportCategories = ["safety", "environmental", "stop-work"],
86
92
  feedbackCategories = ["problem", "suggestion"],
87
93
  onReportSubmit,
88
94
  onFeedbackSubmit,
89
- compact = false,
90
- className,
91
- renderDialog
95
+ defaultLocation = "",
96
+ className
92
97
  }) {
93
- const [activeDialog, setActiveDialog] = useState(null);
94
- const [isSubmitting, setIsSubmitting] = useState(false);
95
- const openDialog = useCallback(
96
- (type, category) => {
97
- if (renderDialog) {
98
- setActiveDialog({ type, category });
99
- } else {
100
- const description = window.prompt(
101
- type === "report" ? `Describe the ${category} incident:` : `Describe your ${category}:`
102
- );
103
- if (description) {
104
- if (type === "report") {
105
- onReportSubmit({
106
- category,
107
- description,
108
- moduleName,
109
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
110
- });
111
- } else {
112
- onFeedbackSubmit({
113
- category,
114
- description,
115
- moduleName,
116
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
117
- pageContext: typeof window !== "undefined" ? window.location.pathname : void 0
118
- });
119
- }
120
- }
121
- }
122
- },
123
- [renderDialog, moduleName, onReportSubmit, onFeedbackSubmit]
98
+ const reportOptions = ALL_REPORT_OPTIONS.filter(
99
+ (opt) => reportCategories.includes(opt.category)
100
+ );
101
+ const feedbackOptions = ALL_FEEDBACK_OPTIONS.filter(
102
+ (opt) => feedbackCategories.includes(opt.category)
124
103
  );
125
- const closeDialog = useCallback(() => {
126
- setActiveDialog(null);
127
- setIsSubmitting(false);
128
- }, []);
129
- const handleSubmit = useCallback(
130
- async (description, extra) => {
131
- if (!activeDialog) return;
132
- setIsSubmitting(true);
133
- try {
134
- if (activeDialog.type === "report") {
135
- await onReportSubmit({
136
- category: activeDialog.category,
137
- description,
138
- location: extra?.location,
139
- severity: extra?.severity,
140
- moduleName,
141
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
142
- });
143
- } else {
144
- await onFeedbackSubmit({
145
- category: activeDialog.category,
146
- description,
147
- moduleName,
148
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
149
- pageContext: typeof window !== "undefined" ? window.location.pathname : void 0
150
- });
151
- }
152
- closeDialog();
153
- } catch (err) {
154
- console.error("[ReportingToolbar] Submit failed:", err);
155
- setIsSubmitting(false);
156
- }
157
- },
158
- [activeDialog, moduleName, onReportSubmit, onFeedbackSubmit, closeDialog]
104
+ const [reportDialogOpen, setReportDialogOpen] = useState(false);
105
+ const [selectedReportCategory, setSelectedReportCategory] = useState("safety");
106
+ const [reportSeverity, setReportSeverity] = useState("medium");
107
+ const [reportLocation, setReportLocation] = useState(defaultLocation);
108
+ const [reportDescription, setReportDescription] = useState("");
109
+ const [reportImmediateAction, setReportImmediateAction] = useState("");
110
+ const [feedbackDialogOpen, setFeedbackDialogOpen] = useState(false);
111
+ const [selectedFeedbackCategory, setSelectedFeedbackCategory] = useState("problem");
112
+ const [feedbackSubject, setFeedbackSubject] = useState("");
113
+ const [feedbackDescription, setFeedbackDescription] = useState("");
114
+ const [submitting, setSubmitting] = useState(false);
115
+ const openReportDialog = (category) => {
116
+ setSelectedReportCategory(category);
117
+ setReportSeverity(category === "stop-work" ? "critical" : "medium");
118
+ setReportLocation(defaultLocation);
119
+ setReportDescription("");
120
+ setReportImmediateAction("");
121
+ setReportDialogOpen(true);
122
+ };
123
+ const openFeedbackDialog = (category) => {
124
+ setSelectedFeedbackCategory(category);
125
+ setFeedbackSubject("");
126
+ setFeedbackDescription("");
127
+ setFeedbackDialogOpen(true);
128
+ };
129
+ const handleReportSubmit = async () => {
130
+ if (!reportDescription.trim()) {
131
+ toast.error("Please provide a description");
132
+ return;
133
+ }
134
+ setSubmitting(true);
135
+ try {
136
+ const report = {
137
+ category: selectedReportCategory,
138
+ description: reportDescription,
139
+ location: reportLocation || void 0,
140
+ severity: reportSeverity,
141
+ immediateAction: reportImmediateAction || void 0,
142
+ moduleName,
143
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
144
+ };
145
+ await onReportSubmit(report);
146
+ toast.success("Report submitted successfully", {
147
+ description: selectedReportCategory === "stop-work" ? "Stop Work authority raised \u2014 management has been notified" : "Your report has been logged and assigned for review"
148
+ });
149
+ setReportDialogOpen(false);
150
+ } catch (err) {
151
+ console.error("[ReportingToolbar] report submit failed:", err);
152
+ toast.error("Failed to submit report. Please try again.");
153
+ } finally {
154
+ setSubmitting(false);
155
+ }
156
+ };
157
+ const handleFeedbackSubmit = async () => {
158
+ if (!feedbackDescription.trim()) {
159
+ toast.error("Please provide a description");
160
+ return;
161
+ }
162
+ setSubmitting(true);
163
+ try {
164
+ const feedback = {
165
+ category: selectedFeedbackCategory,
166
+ subject: feedbackSubject || void 0,
167
+ description: feedbackDescription,
168
+ moduleName,
169
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
170
+ pageContext: typeof window !== "undefined" ? window.location.pathname : void 0
171
+ };
172
+ await onFeedbackSubmit(feedback);
173
+ toast.success(
174
+ selectedFeedbackCategory === "problem" ? "Problem reported \u2014 Oplytics team will review" : "Suggestion submitted \u2014 thank you for your feedback"
175
+ );
176
+ setFeedbackDialogOpen(false);
177
+ } catch (err) {
178
+ console.error("[ReportingToolbar] feedback submit failed:", err);
179
+ toast.error("Failed to submit feedback. Please try again.");
180
+ } finally {
181
+ setSubmitting(false);
182
+ }
183
+ };
184
+ const reportConfig = ALL_REPORT_OPTIONS.find(
185
+ (r) => r.category === selectedReportCategory
159
186
  );
160
- const dialogProps = activeDialog ? {
161
- isOpen: true,
162
- onClose: closeDialog,
163
- type: activeDialog.type,
164
- category: activeDialog.category,
165
- label: activeDialog.type === "report" ? REPORT_LABELS[activeDialog.category] : FEEDBACK_LABELS[activeDialog.category],
166
- description: activeDialog.type === "report" ? REPORT_DESCRIPTIONS[activeDialog.category] : FEEDBACK_DESCRIPTIONS[activeDialog.category],
167
- color: activeDialog.type === "report" ? REPORT_COLORS[activeDialog.category] : FEEDBACK_COLORS[activeDialog.category],
168
- icon: activeDialog.type === "report" ? REPORT_ICONS[activeDialog.category] : FEEDBACK_ICONS[activeDialog.category],
169
- onSubmit: handleSubmit,
170
- isSubmitting
171
- } : null;
172
187
  return /* @__PURE__ */ jsxs(Fragment, { children: [
173
- /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1.5", className), children: [
174
- showIncidentReporting && reportCategories.map((cat) => /* @__PURE__ */ jsx(
175
- ToolbarButton,
176
- {
177
- icon: REPORT_ICONS[cat],
178
- label: REPORT_LABELS[cat],
179
- color: REPORT_COLORS[cat],
180
- compact,
181
- onClick: () => openDialog("report", cat)
182
- },
183
- cat
184
- )),
185
- showIncidentReporting && showFeedback && /* @__PURE__ */ jsx("div", { className: "w-px h-5 bg-[#1E2738] mx-1" }),
186
- showFeedback && feedbackCategories.map((cat) => /* @__PURE__ */ jsx(
187
- ToolbarButton,
188
- {
189
- icon: FEEDBACK_ICONS[cat],
190
- label: FEEDBACK_LABELS[cat],
191
- color: FEEDBACK_COLORS[cat],
192
- compact,
193
- onClick: () => openDialog("feedback", cat)
194
- },
195
- cat
196
- ))
188
+ /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
189
+ showIncidentReporting && reportOptions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
190
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
191
+ Button,
192
+ {
193
+ variant: "ghost",
194
+ size: "sm",
195
+ className: "h-9 gap-1.5 text-xs font-medium text-[#EF4444] hover:bg-[#EF4444]/10 hover:text-[#EF4444] border border-[#EF4444]/20",
196
+ children: [
197
+ /* @__PURE__ */ jsx(AlertTriangle, { className: "h-3.5 w-3.5" }),
198
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: "Report" }),
199
+ /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" })
200
+ ]
201
+ }
202
+ ) }),
203
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", className: "w-56", children: reportOptions.map((opt) => /* @__PURE__ */ jsxs(
204
+ DropdownMenuItem,
205
+ {
206
+ onClick: () => openReportDialog(opt.category),
207
+ className: "gap-3 py-2.5",
208
+ children: [
209
+ /* @__PURE__ */ jsx(opt.icon, { className: "h-4 w-4", style: { color: opt.color } }),
210
+ /* @__PURE__ */ jsxs("div", { children: [
211
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: opt.label }),
212
+ /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground", children: opt.description })
213
+ ] })
214
+ ]
215
+ },
216
+ opt.category
217
+ )) })
218
+ ] }),
219
+ showFeedback && feedbackOptions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
220
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
221
+ Button,
222
+ {
223
+ variant: "ghost",
224
+ size: "sm",
225
+ className: "h-9 gap-1.5 text-xs font-medium text-[#8C34E9] hover:bg-[#8C34E9]/10 hover:text-[#8C34E9] border border-[#8C34E9]/20",
226
+ children: [
227
+ /* @__PURE__ */ jsx(Lightbulb, { className: "h-3.5 w-3.5" }),
228
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: "Feedback" }),
229
+ /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" })
230
+ ]
231
+ }
232
+ ) }),
233
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", className: "w-52", children: feedbackOptions.map((opt, idx) => /* @__PURE__ */ jsxs("span", { children: [
234
+ idx > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
235
+ /* @__PURE__ */ jsxs(
236
+ DropdownMenuItem,
237
+ {
238
+ onClick: () => openFeedbackDialog(opt.category),
239
+ className: "gap-3 py-2.5",
240
+ children: [
241
+ /* @__PURE__ */ jsx(opt.icon, { className: "h-4 w-4", style: { color: opt.color } }),
242
+ /* @__PURE__ */ jsxs("div", { children: [
243
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: opt.label }),
244
+ /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground", children: opt.description })
245
+ ] })
246
+ ]
247
+ }
248
+ )
249
+ ] }, opt.category)) })
250
+ ] })
197
251
  ] }),
198
- renderDialog && dialogProps && renderDialog(dialogProps)
252
+ /* @__PURE__ */ jsx(Dialog, { open: reportDialogOpen, onOpenChange: setReportDialogOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[500px]", children: [
253
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
254
+ /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
255
+ reportConfig && /* @__PURE__ */ jsx(reportConfig.icon, { className: "h-5 w-5", style: { color: reportConfig.color } }),
256
+ reportConfig?.label || "Report",
257
+ selectedReportCategory === "stop-work" && /* @__PURE__ */ jsx(Badge, { className: "bg-[#F59E0B] text-white text-[9px] border-0", children: "URGENT" })
258
+ ] }),
259
+ /* @__PURE__ */ jsxs(DialogDescription, { children: [
260
+ reportConfig?.description,
261
+ ". All reports are logged and tracked."
262
+ ] })
263
+ ] }),
264
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 py-2", children: [
265
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
266
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-medium", children: "Severity" }),
267
+ /* @__PURE__ */ jsxs(
268
+ Select,
269
+ {
270
+ value: reportSeverity,
271
+ onValueChange: (v) => setReportSeverity(v),
272
+ children: [
273
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "h-9", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
274
+ /* @__PURE__ */ jsx(SelectContent, { children: SEVERITY_OPTIONS.map((s) => /* @__PURE__ */ jsx(SelectItem, { value: s.value, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
275
+ /* @__PURE__ */ jsx(
276
+ "div",
277
+ {
278
+ className: "h-2 w-2 rounded-full",
279
+ style: { backgroundColor: s.color }
280
+ }
281
+ ),
282
+ s.label
283
+ ] }) }, s.value)) })
284
+ ]
285
+ }
286
+ )
287
+ ] }),
288
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
289
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-medium", children: "Location / Area" }),
290
+ /* @__PURE__ */ jsx(
291
+ Input,
292
+ {
293
+ value: reportLocation,
294
+ onChange: (e) => setReportLocation(e.target.value),
295
+ placeholder: "e.g., Production Line 3, Warehouse B",
296
+ className: "h-9"
297
+ }
298
+ )
299
+ ] }),
300
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
301
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-medium", children: "Description *" }),
302
+ /* @__PURE__ */ jsx(
303
+ Textarea,
304
+ {
305
+ value: reportDescription,
306
+ onChange: (e) => setReportDescription(e.target.value),
307
+ placeholder: "Describe what happened or what you observed...",
308
+ rows: 4
309
+ }
310
+ )
311
+ ] }),
312
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
313
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-medium", children: "Immediate Action Taken" }),
314
+ /* @__PURE__ */ jsx(
315
+ Textarea,
316
+ {
317
+ value: reportImmediateAction,
318
+ onChange: (e) => setReportImmediateAction(e.target.value),
319
+ placeholder: "Describe any immediate action taken to make the area safe...",
320
+ rows: 2
321
+ }
322
+ )
323
+ ] })
324
+ ] }),
325
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
326
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setReportDialogOpen(false), children: "Cancel" }),
327
+ /* @__PURE__ */ jsxs(
328
+ Button,
329
+ {
330
+ onClick: handleReportSubmit,
331
+ disabled: submitting || !reportDescription.trim(),
332
+ className: "gap-2",
333
+ style: {
334
+ backgroundColor: reportConfig?.color,
335
+ color: "white"
336
+ },
337
+ children: [
338
+ /* @__PURE__ */ jsx(Send, { className: "h-3.5 w-3.5" }),
339
+ submitting ? "Submitting..." : "Submit Report"
340
+ ]
341
+ }
342
+ )
343
+ ] })
344
+ ] }) }),
345
+ /* @__PURE__ */ jsx(Dialog, { open: feedbackDialogOpen, onOpenChange: setFeedbackDialogOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[500px]", children: [
346
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
347
+ /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
348
+ selectedFeedbackCategory === "problem" ? /* @__PURE__ */ jsx(Bug, { className: "h-5 w-5 text-[#EF4444]" }) : /* @__PURE__ */ jsx(Lightbulb, { className: "h-5 w-5 text-[#8C34E9]" }),
349
+ selectedFeedbackCategory === "problem" ? "Report a Problem" : "Submit a Suggestion"
350
+ ] }),
351
+ /* @__PURE__ */ jsx(DialogDescription, { children: selectedFeedbackCategory === "problem" ? "Help us fix issues \u2014 describe what went wrong." : "We'd love to hear your ideas for improving Oplytics." })
352
+ ] }),
353
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 py-2", children: [
354
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
355
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-medium", children: "Subject" }),
356
+ /* @__PURE__ */ jsx(
357
+ Input,
358
+ {
359
+ value: feedbackSubject,
360
+ onChange: (e) => setFeedbackSubject(e.target.value),
361
+ placeholder: selectedFeedbackCategory === "problem" ? "Brief summary of the issue" : "Brief summary of your idea",
362
+ className: "h-9"
363
+ }
364
+ )
365
+ ] }),
366
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
367
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-medium", children: "Description *" }),
368
+ /* @__PURE__ */ jsx(
369
+ Textarea,
370
+ {
371
+ value: feedbackDescription,
372
+ onChange: (e) => setFeedbackDescription(e.target.value),
373
+ placeholder: selectedFeedbackCategory === "problem" ? "What were you trying to do? What happened instead?" : "Describe your suggestion and how it would help...",
374
+ rows: 5
375
+ }
376
+ )
377
+ ] }),
378
+ /* @__PURE__ */ jsxs("div", { className: "text-[10px] text-muted-foreground", children: [
379
+ "Module: ",
380
+ moduleName,
381
+ " \u2014 Feedback is reviewed by the Oplytics team"
382
+ ] })
383
+ ] }),
384
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
385
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setFeedbackDialogOpen(false), children: "Cancel" }),
386
+ /* @__PURE__ */ jsxs(
387
+ Button,
388
+ {
389
+ onClick: handleFeedbackSubmit,
390
+ disabled: submitting || !feedbackDescription.trim(),
391
+ className: "gap-2",
392
+ style: {
393
+ backgroundColor: selectedFeedbackCategory === "problem" ? "#EF4444" : "#8C34E9",
394
+ color: "white"
395
+ },
396
+ children: [
397
+ /* @__PURE__ */ jsx(Send, { className: "h-3.5 w-3.5" }),
398
+ submitting ? "Submitting..." : "Submit"
399
+ ]
400
+ }
401
+ )
402
+ ] })
403
+ ] }) })
199
404
  ] });
200
405
  }
201
406