-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntakeFieldControl.tsx
More file actions
74 lines (68 loc) · 1.84 KB
/
IntakeFieldControl.tsx
File metadata and controls
74 lines (68 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
67
68
69
70
71
72
73
74
import type { NoteAudience } from "../../types/workspace";
export type IntakeField =
| "issue"
| "environment"
| "impact"
| "affected_user"
| "affected_system"
| "affected_site"
| "symptoms"
| "steps_tried"
| "blockers"
| "likely_category";
export const NOTE_AUDIENCES: Array<{ id: NoteAudience; label: string }> = [
{ id: "internal-note", label: "Internal note" },
{ id: "customer-safe", label: "Customer-safe" },
{ id: "escalation-note", label: "Escalation note" },
];
export const INTAKE_FIELDS: Array<{
key: IntakeField;
label: string;
rows?: number;
}> = [
{ key: "issue", label: "Issue summary" },
{ key: "environment", label: "Environment" },
{ key: "impact", label: "Impact", rows: 2 },
{ key: "affected_user", label: "Affected user" },
{ key: "affected_system", label: "Affected system" },
{ key: "affected_site", label: "Affected site" },
{ key: "symptoms", label: "Symptoms", rows: 3 },
{ key: "steps_tried", label: "Steps already tried", rows: 3 },
{ key: "blockers", label: "Current blocker", rows: 2 },
{ key: "likely_category", label: "Likely category" },
];
interface IntakeFieldControlProps {
label: string;
value: string;
rows?: number;
onChange: (value: string) => void;
}
export function IntakeFieldControl({
label,
value,
rows,
onChange,
}: IntakeFieldControlProps) {
if (rows && rows > 1) {
return (
<label className="ticket-workspace-rail__field">
<span>{label}</span>
<textarea
rows={rows}
value={value}
onChange={(event) => onChange(event.target.value)}
/>
</label>
);
}
return (
<label className="ticket-workspace-rail__field">
<span>{label}</span>
<input
type="text"
value={value}
onChange={(event) => onChange(event.target.value)}
/>
</label>
);
}