@flamingo-stack/openframe-frontend-core 0.0.807 → 0.0.808
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/build/export-map.json +1 -1
- package/dist/{chunk-IEDID3EB.cjs → chunk-6B5BDFZ6.cjs} +3 -3
- package/dist/{chunk-QPHQVTJO.cjs → chunk-6BYSVWIS.cjs} +2 -2
- package/dist/{chunk-224GFGSR.cjs → chunk-A5TMKZRQ.cjs} +16 -16
- package/dist/{chunk-QWB3CTGR.cjs → chunk-BSF7E5EZ.cjs} +24 -24
- package/dist/{chunk-74I2HT4X.cjs → chunk-DRTXDPWM.cjs} +12 -12
- package/dist/{chunk-3B6PFUL3.cjs → chunk-FRS2VO22.cjs} +71 -19
- package/dist/{chunk-XDVBSTFB.cjs → chunk-H6U3K5EX.cjs} +7 -7
- package/dist/{chunk-Z4IYLXJU.cjs → chunk-HKYGJVTA.cjs} +15 -15
- package/dist/{chunk-XCYL3TYS.cjs → chunk-K6YBHFWX.cjs} +34 -34
- package/dist/{chunk-MBGUHO7Z.cjs → chunk-LF7B3LJE.cjs} +16 -16
- package/dist/{chunk-BAOKF4OV.cjs → chunk-R2S22LDL.cjs} +3 -3
- package/dist/{chunk-M5NBPOKJ.cjs → chunk-SPS7TL7Z.cjs} +677 -639
- package/dist/{chunk-WKVAD374.cjs → chunk-T64MG3HS.cjs} +4 -4
- package/dist/{cloud-tenants-KL2COIBU.cjs → cloud-tenants-H5TMGGDF.cjs} +3 -3
- package/dist/components/case-studies/index.cjs +12 -12
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/docs/index.cjs +6 -6
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/faq/index.cjs +4 -4
- package/dist/components/features/index.cjs +3 -3
- package/dist/components/features/scripts/schedule-form/schedule-offline-fields.d.ts.map +1 -1
- package/dist/components/features/scripts/schedule-form/schedule-offline-fields.js +16 -4
- package/dist/components/features/scripts/schedule-form/schedule-timing-fields.d.ts +1 -1
- package/dist/components/features/scripts/schedule-form/schedule-timing-fields.d.ts.map +1 -1
- package/dist/components/features/scripts/schedule-form/schedule-timing-fields.js +9 -2
- package/dist/components/help-center-pages/index.cjs +55 -55
- package/dist/components/index.cjs +21 -19
- package/dist/components/meeting-scheduler/index.cjs +28 -28
- package/dist/components/navigation/index.cjs +4 -4
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/product-demo/index.cjs +13 -13
- package/dist/components/tickets/index.cjs +6 -6
- package/dist/components/ui/assignee-dropdown.d.ts +10 -0
- package/dist/components/ui/assignee-dropdown.d.ts.map +1 -1
- package/dist/components/ui/assignee-dropdown.js +14 -2
- package/dist/components/ui/autocomplete.d.ts +24 -0
- package/dist/components/ui/autocomplete.d.ts.map +1 -1
- package/dist/components/ui/autocomplete.js +26 -4
- package/dist/components/ui/index.cjs +5 -3
- package/dist/components/ui/reopen-ticket-modal.d.ts +17 -1
- package/dist/components/ui/reopen-ticket-modal.d.ts.map +1 -1
- package/dist/components/ui/reopen-ticket-modal.js +8 -15
- package/dist/components/ui/searchable-select.d.ts +17 -0
- package/dist/components/ui/searchable-select.d.ts.map +1 -1
- package/dist/components/ui/searchable-select.js +24 -9
- package/dist/components/ui/server-search-options.d.ts +30 -0
- package/dist/components/ui/server-search-options.d.ts.map +1 -0
- package/dist/components/ui/server-search-options.js +30 -0
- package/dist/components/ui/take-over-ticket-modal.d.ts +25 -1
- package/dist/components/ui/take-over-ticket-modal.d.ts.map +1 -1
- package/dist/components/ui/take-over-ticket-modal.js +14 -14
- package/dist/components/ui/ticket-info-section.d.ts +2 -0
- package/dist/components/ui/ticket-info-section.d.ts.map +1 -1
- package/dist/components/ui/ticket-info-section.js +2 -1
- package/dist/{devices-3HQDYLE2.cjs → devices-4MF5B7WJ.cjs} +4 -4
- package/dist/index.cjs +6 -4
- package/dist/{knowledge-6LA6XYUR.cjs → knowledge-MI7VMPRF.cjs} +3 -3
- package/dist/{logs-R4YZI33F.cjs → logs-7TEU2UXV.cjs} +11 -11
- package/dist/{policies-DGJMMGXN.cjs → policies-AR7B4LW5.cjs} +7 -7
- package/dist/{remote-session-HLGLKOGW.cjs → remote-session-LMUFV2RZ.cjs} +4 -4
- package/dist/{scripts-6KR5UZQY.cjs → scripts-HTMYPV5Q.cjs} +10 -10
- package/dist/{software-update-R63SKZQM.cjs → software-update-YMSYGYCM.cjs} +7 -7
- package/package.json +1 -1
- package/src/components/features/scripts/schedule-form/schedule-offline-fields.tsx +10 -1
- package/src/components/features/scripts/schedule-form/schedule-timing-fields.tsx +10 -4
- package/src/components/ui/assignee-dropdown.tsx +29 -1
- package/src/components/ui/autocomplete.tsx +68 -5
- package/src/components/ui/reopen-ticket-modal.tsx +22 -14
- package/src/components/ui/searchable-select.tsx +52 -8
- package/src/components/ui/server-search-options.ts +65 -0
- package/src/components/ui/take-over-ticket-modal.tsx +35 -13
- package/src/components/ui/ticket-info-section.tsx +3 -0
|
@@ -5,12 +5,12 @@ import { Autocomplete } from './autocomplete';
|
|
|
5
5
|
import { Button } from './button';
|
|
6
6
|
import { ColorSwatch } from './color-swatch';
|
|
7
7
|
import { ModalV2, ModalV2Footer, ModalV2Header, ModalV2Title } from './modal-v2';
|
|
8
|
-
import { SquareAvatar } from './square-avatar';
|
|
9
8
|
import {
|
|
10
9
|
renderTicketAssigneeOption,
|
|
11
10
|
renderTicketStatusOption,
|
|
12
11
|
type TakeOverAssigneeOption,
|
|
13
12
|
type TakeOverStatusOption,
|
|
13
|
+
withTicketAssigneeAvatars,
|
|
14
14
|
} from './take-over-ticket-modal';
|
|
15
15
|
import { Textarea } from './textarea';
|
|
16
16
|
|
|
@@ -44,6 +44,22 @@ export interface ReopenTicketModalProps {
|
|
|
44
44
|
initialAssigneeId?: string | null;
|
|
45
45
|
/** Confirm in-flight: buttons lock and the modal refuses to close. */
|
|
46
46
|
isPending?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Server search for the Assigned picker. When set, `assigneeOptions` is the
|
|
49
|
+
* server's answer to the query reported here and is not filtered locally:
|
|
50
|
+
* called with the raw query on every keystroke (debounce in the caller) and
|
|
51
|
+
* with `''` when the picker resets (a pick, closing it, the clear button).
|
|
52
|
+
* While `assigneesLoading`, the previous rows stay listed, and the picked
|
|
53
|
+
* assignee keeps their name and avatar after leaving `assigneeOptions`.
|
|
54
|
+
*/
|
|
55
|
+
onAssigneeSearchChange?: (query: string) => void;
|
|
56
|
+
/**
|
|
57
|
+
* The pre-selected assignee as an option, for when `assigneeOptions` does
|
|
58
|
+
* not include them (a server search's first page) — the field would read
|
|
59
|
+
* the raw id otherwise. Only renders the selection; `initialAssigneeId`
|
|
60
|
+
* still decides it.
|
|
61
|
+
*/
|
|
62
|
+
initialAssigneeOption?: TakeOverAssigneeOption;
|
|
47
63
|
onConfirm: (selection: ReopenTicketSelection) => void;
|
|
48
64
|
}
|
|
49
65
|
|
|
@@ -69,6 +85,8 @@ export function ReopenTicketModal({
|
|
|
69
85
|
initialAssigneeId,
|
|
70
86
|
isPending = false,
|
|
71
87
|
onConfirm,
|
|
88
|
+
onAssigneeSearchChange,
|
|
89
|
+
initialAssigneeOption,
|
|
72
90
|
}: ReopenTicketModalProps) {
|
|
73
91
|
const [statusId, setStatusId] = useState<string | null>(initialStatusId ?? null);
|
|
74
92
|
const [assigneeId, setAssigneeId] = useState<string | null>(initialAssigneeId ?? null);
|
|
@@ -95,7 +113,6 @@ export function ReopenTicketModal({
|
|
|
95
113
|
|
|
96
114
|
const selectedStatusId = statusId ?? statusOptions[0]?.value ?? null;
|
|
97
115
|
const selectedStatus = statusOptions.find(o => o.value === selectedStatusId);
|
|
98
|
-
const selectedAssignee = assigneeOptions.find(o => o.value === assigneeId);
|
|
99
116
|
|
|
100
117
|
const handleConfirm = () => {
|
|
101
118
|
if (!selectedStatusId || !assigneeId || isPending) return;
|
|
@@ -133,22 +150,13 @@ export function ReopenTicketModal({
|
|
|
133
150
|
<div className="min-w-0 flex-1">
|
|
134
151
|
<Autocomplete
|
|
135
152
|
label="Assigned"
|
|
136
|
-
options={assigneeOptions}
|
|
153
|
+
options={withTicketAssigneeAvatars(assigneeOptions)}
|
|
137
154
|
value={assigneeId}
|
|
138
155
|
onChange={setAssigneeId}
|
|
139
156
|
placeholder="Select Technician"
|
|
140
157
|
loading={assigneesLoading}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
<SquareAvatar
|
|
144
|
-
src={selectedAssignee.imageUrl}
|
|
145
|
-
alt={selectedAssignee.label}
|
|
146
|
-
fallback={selectedAssignee.label}
|
|
147
|
-
size="sm"
|
|
148
|
-
variant="round"
|
|
149
|
-
/>
|
|
150
|
-
) : undefined
|
|
151
|
-
}
|
|
158
|
+
onSearchChange={onAssigneeSearchChange}
|
|
159
|
+
selectedOptions={initialAssigneeOption ? withTicketAssigneeAvatars([initialAssigneeOption]) : undefined}
|
|
152
160
|
renderOption={renderTicketAssigneeOption}
|
|
153
161
|
/>
|
|
154
162
|
</div>
|
|
@@ -13,6 +13,7 @@ import { FieldWrapper } from './field-wrapper';
|
|
|
13
13
|
import { Input } from './input';
|
|
14
14
|
import { LoadingItems } from './loading-scope';
|
|
15
15
|
import { usePortalContainer } from './portal-container';
|
|
16
|
+
import { useRememberedSelection, useSettledOptions } from './server-search-options';
|
|
16
17
|
|
|
17
18
|
/** An option's frame (a list row, or a tile in the grid): the `row` button kind, read by the options and by their
|
|
18
19
|
* loading state so both draw one box. A tile is the row laid out as a column. */
|
|
@@ -88,6 +89,23 @@ export interface SearchableSelectProps {
|
|
|
88
89
|
className?: string;
|
|
89
90
|
/** Classes for the popover content (e.g. a fixed width for icon triggers). */
|
|
90
91
|
contentClassName?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Server search. When set, `options` is the server's answer to the query
|
|
94
|
+
* reported here, not a list to filter:
|
|
95
|
+
*
|
|
96
|
+
* - called with the raw query on every change of the search field (debounce
|
|
97
|
+
* in the caller), and with `''` when the dropdown closes on a non-empty
|
|
98
|
+
* query (a pick, Escape, a click outside) — the field clears on close, so
|
|
99
|
+
* the caller goes back to its unfiltered first page with it.
|
|
100
|
+
* - nothing is filtered locally (`keywords` are moot).
|
|
101
|
+
* - while `isLoading`, the options stay listed, and an `options` emptied
|
|
102
|
+
* mid-load falls back to the last list that settled; the loading rows show
|
|
103
|
+
* only with nothing to list yet.
|
|
104
|
+
* - the default trigger keeps the label and icon of the last option seen
|
|
105
|
+
* for `value` when the current answer does not include it. A custom
|
|
106
|
+
* `trigger` renders its own selection.
|
|
107
|
+
*/
|
|
108
|
+
onSearchChange?: (query: string) => void;
|
|
91
109
|
}
|
|
92
110
|
|
|
93
111
|
/**
|
|
@@ -119,7 +137,9 @@ export function SearchableSelect(allProps: SearchableSelectProps) {
|
|
|
119
137
|
align = 'start',
|
|
120
138
|
className,
|
|
121
139
|
contentClassName,
|
|
140
|
+
onSearchChange,
|
|
122
141
|
} = allProps;
|
|
142
|
+
const serverSearch = onSearchChange !== undefined;
|
|
123
143
|
// Wired for a message even while `error` is undefined — see `FieldWrapper.errorSlot`.
|
|
124
144
|
const errorSlot = 'error' in allProps;
|
|
125
145
|
const isInvalid = !!error;
|
|
@@ -140,22 +160,46 @@ export function SearchableSelect(allProps: SearchableSelectProps) {
|
|
|
140
160
|
// on `search`, so the extra render pass this schedules takes the early exit.
|
|
141
161
|
if (!isOpen && search !== '') setSearch('');
|
|
142
162
|
|
|
163
|
+
// Server search: what to list (steady between keystrokes) and the last
|
|
164
|
+
// option seen for the selected value. Both pass through untouched otherwise.
|
|
165
|
+
const listedOptions = useSettledOptions(options, isLoading, serverSearch);
|
|
166
|
+
const rememberedSelection = useRememberedSelection(listedOptions, value != null ? [value] : [], serverSearch);
|
|
167
|
+
|
|
143
168
|
const filtered = useMemo(() => {
|
|
169
|
+
// The server already filtered: its answer is the list.
|
|
170
|
+
if (serverSearch) return listedOptions;
|
|
144
171
|
const q = search.trim().toLowerCase();
|
|
145
172
|
if (!q) return options;
|
|
146
173
|
return options.filter(
|
|
147
174
|
o => o.label.toLowerCase().includes(q) || (o.keywords ?? []).some(k => k.toLowerCase().includes(q)),
|
|
148
175
|
);
|
|
149
|
-
}, [options, search]);
|
|
176
|
+
}, [options, listedOptions, serverSearch, search]);
|
|
150
177
|
|
|
151
178
|
const selectedOption = useMemo(
|
|
152
|
-
() => (value != null ?
|
|
153
|
-
[
|
|
179
|
+
() => (value != null ? (listedOptions.find(o => o.value === value) ?? rememberedSelection.get(value)) : undefined),
|
|
180
|
+
[listedOptions, rememberedSelection, value],
|
|
154
181
|
);
|
|
155
182
|
|
|
183
|
+
// The list gives way to its loading rows while loading — except under server
|
|
184
|
+
// search with something to show, where the rows stay until the answer lands.
|
|
185
|
+
const showLoadingRows = isLoading && (!serverSearch || filtered.length === 0);
|
|
186
|
+
|
|
187
|
+
const handleSearchChange = (query: string) => {
|
|
188
|
+
setSearch(query);
|
|
189
|
+
onSearchChange?.(query);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// Every close goes through here, so a server search hears that the query it
|
|
193
|
+
// filtered by is gone — the field itself is emptied by the render-time reset
|
|
194
|
+
// above. An already-empty field has nothing to report.
|
|
195
|
+
const handleOpenChange = (open: boolean) => {
|
|
196
|
+
setIsOpen(open);
|
|
197
|
+
if (!open && search !== '') onSearchChange?.('');
|
|
198
|
+
};
|
|
199
|
+
|
|
156
200
|
const handleSelect = (optionValue: string) => {
|
|
157
201
|
onValueChange(optionValue);
|
|
158
|
-
|
|
202
|
+
handleOpenChange(false);
|
|
159
203
|
};
|
|
160
204
|
|
|
161
205
|
const defaultTrigger = (
|
|
@@ -199,7 +243,7 @@ export function SearchableSelect(allProps: SearchableSelectProps) {
|
|
|
199
243
|
);
|
|
200
244
|
|
|
201
245
|
return (
|
|
202
|
-
<PopoverPrimitive.Root open={isOpen} onOpenChange={disabled ? undefined :
|
|
246
|
+
<PopoverPrimitive.Root open={isOpen} onOpenChange={disabled ? undefined : handleOpenChange} modal={false}>
|
|
203
247
|
{!trigger && (label !== undefined || errorSlot) ? (
|
|
204
248
|
<FieldWrapper label={label} htmlFor={triggerId} labelVariant={labelVariant} error={error} errorSlot={errorSlot}>
|
|
205
249
|
{triggerElement}
|
|
@@ -230,7 +274,7 @@ export function SearchableSelect(allProps: SearchableSelectProps) {
|
|
|
230
274
|
userValue
|
|
231
275
|
autoFocus
|
|
232
276
|
value={search}
|
|
233
|
-
onChange={e =>
|
|
277
|
+
onChange={e => handleSearchChange(e.target.value)}
|
|
234
278
|
placeholder={searchPlaceholder}
|
|
235
279
|
startAdornment={<SearchIcon className="size-4 text-ods-text-secondary" />}
|
|
236
280
|
className="rounded-none border-0"
|
|
@@ -248,9 +292,9 @@ export function SearchableSelect(allProps: SearchableSelectProps) {
|
|
|
248
292
|
)}
|
|
249
293
|
// A listbox owns options only: while they are read the box holds the loading region (a status and
|
|
250
294
|
// hidden rows), with no listbox role around it.
|
|
251
|
-
role={
|
|
295
|
+
role={showLoadingRows ? undefined : 'listbox'}
|
|
252
296
|
>
|
|
253
|
-
{
|
|
297
|
+
{showLoadingRows ? (
|
|
254
298
|
// The options while they are read: the list's own rows (or tiles), a label bar each; `loadingText` is
|
|
255
299
|
// what a screen reader hears.
|
|
256
300
|
<LoadingRegion label={loadingText} className="contents">
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Bookkeeping shared by the pickers that can search on the server
|
|
7
|
+
* (`Autocomplete` / `SearchableSelect` with `onSearchChange`). There the
|
|
8
|
+
* caller's `options` ARE the server's answer to the current query, so the
|
|
9
|
+
* picker filters nothing; what it still owes the user is a list that holds
|
|
10
|
+
* still between keystrokes and a selection that keeps its label.
|
|
11
|
+
*
|
|
12
|
+
* Both hooks take `enabled` and are inert without it, so a client-filtered
|
|
13
|
+
* picker pays nothing and behaves exactly as before.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The options to list. While the next answer is in flight (`isLoading`), a
|
|
18
|
+
* caller that already emptied `options` would blank the list — or flash its
|
|
19
|
+
* "no results" line — on every keystroke, so an empty list falls back to the
|
|
20
|
+
* last one that settled. A caller that keeps the previous answer through the
|
|
21
|
+
* load (a transition, a placeholder) passes through untouched, and an empty
|
|
22
|
+
* answer that has settled is shown as the empty state it is.
|
|
23
|
+
*/
|
|
24
|
+
export function useSettledOptions<O>(options: O[], isLoading: boolean, enabled: boolean): O[] {
|
|
25
|
+
const [settled, setSettled] = useState(options);
|
|
26
|
+
// Adjusted while rendering, not from an effect: the list is drawn from this
|
|
27
|
+
// render's value, so an effect would paint one frame of the stale snapshot.
|
|
28
|
+
// Guarded on identity, so the pass React schedules for it takes the exit.
|
|
29
|
+
if (enabled && !isLoading && settled !== options) setSettled(options);
|
|
30
|
+
return enabled && isLoading && options.length === 0 ? settled : options;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The last option seen for each selected value. A server search replaces
|
|
35
|
+
* `options` on every query, and a selection the current answer does not
|
|
36
|
+
* include would otherwise lose its label and icon. Holds the selected values
|
|
37
|
+
* only — a value that is deselected is forgotten — so it never outgrows the
|
|
38
|
+
* selection.
|
|
39
|
+
*/
|
|
40
|
+
export function useRememberedSelection<T, O extends { value: T }>(
|
|
41
|
+
options: readonly O[],
|
|
42
|
+
selected: readonly T[],
|
|
43
|
+
enabled: boolean,
|
|
44
|
+
): ReadonlyMap<T, O> {
|
|
45
|
+
const [remembered, setRemembered] = useState<ReadonlyMap<T, O>>(() => new Map());
|
|
46
|
+
if (enabled) {
|
|
47
|
+
const next = new Map<T, O>();
|
|
48
|
+
for (const value of selected) {
|
|
49
|
+
const option = options.find(o => o.value === value) ?? remembered.get(value);
|
|
50
|
+
if (option) next.set(value, option);
|
|
51
|
+
}
|
|
52
|
+
// Same render-time adjustment as above; identity-compared entries, so the
|
|
53
|
+
// re-run with the same props computes an equal map and stops.
|
|
54
|
+
if (!hasSameEntries(next, remembered)) setRemembered(next);
|
|
55
|
+
}
|
|
56
|
+
return remembered;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function hasSameEntries<K, V>(a: ReadonlyMap<K, V>, b: ReadonlyMap<K, V>): boolean {
|
|
60
|
+
if (a.size !== b.size) return false;
|
|
61
|
+
for (const [key, value] of a) {
|
|
62
|
+
if (b.get(key) !== value) return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
@@ -39,6 +39,22 @@ export interface TakeOverTicketModalProps {
|
|
|
39
39
|
initialAssigneeId?: string | null;
|
|
40
40
|
/** Confirm in-flight: buttons lock and the modal refuses to close. */
|
|
41
41
|
isPending?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Server search for the Assigned picker. When set, `assigneeOptions` is the
|
|
44
|
+
* server's answer to the query reported here and is not filtered locally:
|
|
45
|
+
* called with the raw query on every keystroke (debounce in the caller) and
|
|
46
|
+
* with `''` when the picker resets (a pick, closing it, the clear button).
|
|
47
|
+
* While `assigneesLoading`, the previous rows stay listed, and the picked
|
|
48
|
+
* assignee keeps their name and avatar after leaving `assigneeOptions`.
|
|
49
|
+
*/
|
|
50
|
+
onAssigneeSearchChange?: (query: string) => void;
|
|
51
|
+
/**
|
|
52
|
+
* The pre-selected assignee as an option, for when `assigneeOptions` does
|
|
53
|
+
* not include them (a server search's first page) — the field would read
|
|
54
|
+
* the raw id otherwise. Only renders the selection; `initialAssigneeId`
|
|
55
|
+
* still decides it.
|
|
56
|
+
*/
|
|
57
|
+
initialAssigneeOption?: TakeOverAssigneeOption;
|
|
42
58
|
onConfirm: (selection: TakeOverTicketSelection) => void;
|
|
43
59
|
}
|
|
44
60
|
|
|
@@ -75,6 +91,20 @@ export function renderTicketAssigneeOption(option: AutocompleteOption, isSelecte
|
|
|
75
91
|
);
|
|
76
92
|
}
|
|
77
93
|
|
|
94
|
+
/**
|
|
95
|
+
* The assignee options with each avatar as the option's `icon` — shared by the
|
|
96
|
+
* ticket lifecycle modals. The Assigned field leads with the SELECTED option's
|
|
97
|
+
* icon, which `Autocomplete` resolves even after a server search has dropped
|
|
98
|
+
* that option from `assigneeOptions`; an adornment looked up in the current
|
|
99
|
+
* options lost the avatar the moment that happened.
|
|
100
|
+
*/
|
|
101
|
+
export function withTicketAssigneeAvatars(options: TakeOverAssigneeOption[]): TakeOverAssigneeOption[] {
|
|
102
|
+
return options.map(option => ({
|
|
103
|
+
...option,
|
|
104
|
+
icon: <SquareAvatar src={option.imageUrl} alt={option.label} fallback={option.label} size="sm" variant="round" />,
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
|
|
78
108
|
/**
|
|
79
109
|
* Take Over Ticket confirmation dialog (Figma openframe---tickets 8482-112154 /
|
|
80
110
|
* 8482-112169): shown when a technician takes a ticket over from the AI
|
|
@@ -97,6 +127,8 @@ export function TakeOverTicketModal({
|
|
|
97
127
|
initialAssigneeId,
|
|
98
128
|
isPending = false,
|
|
99
129
|
onConfirm,
|
|
130
|
+
onAssigneeSearchChange,
|
|
131
|
+
initialAssigneeOption,
|
|
100
132
|
}: TakeOverTicketModalProps) {
|
|
101
133
|
const [statusId, setStatusId] = useState<string | null>(initialStatusId ?? null);
|
|
102
134
|
const [assigneeId, setAssigneeId] = useState<string | null>(initialAssigneeId ?? null);
|
|
@@ -121,7 +153,6 @@ export function TakeOverTicketModal({
|
|
|
121
153
|
|
|
122
154
|
const selectedStatusId = statusId ?? statusOptions[0]?.value ?? null;
|
|
123
155
|
const selectedStatus = statusOptions.find(o => o.value === selectedStatusId);
|
|
124
|
-
const selectedAssignee = assigneeOptions.find(o => o.value === assigneeId);
|
|
125
156
|
|
|
126
157
|
const handleConfirm = () => {
|
|
127
158
|
if (!selectedStatusId || !assigneeId || isPending) return;
|
|
@@ -155,22 +186,13 @@ export function TakeOverTicketModal({
|
|
|
155
186
|
<div className="min-w-0 flex-1">
|
|
156
187
|
<Autocomplete
|
|
157
188
|
label="Assigned"
|
|
158
|
-
options={assigneeOptions}
|
|
189
|
+
options={withTicketAssigneeAvatars(assigneeOptions)}
|
|
159
190
|
value={assigneeId}
|
|
160
191
|
onChange={setAssigneeId}
|
|
161
192
|
placeholder="Select Technician"
|
|
162
193
|
loading={assigneesLoading}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<SquareAvatar
|
|
166
|
-
src={selectedAssignee.imageUrl}
|
|
167
|
-
alt={selectedAssignee.label}
|
|
168
|
-
fallback={selectedAssignee.label}
|
|
169
|
-
size="sm"
|
|
170
|
-
variant="round"
|
|
171
|
-
/>
|
|
172
|
-
) : undefined
|
|
173
|
-
}
|
|
194
|
+
onSearchChange={onAssigneeSearchChange}
|
|
195
|
+
selectedOptions={initialAssigneeOption ? withTicketAssigneeAvatars([initialAssigneeOption]) : undefined}
|
|
174
196
|
renderOption={renderTicketAssigneeOption}
|
|
175
197
|
/>
|
|
176
198
|
</div>
|
|
@@ -67,6 +67,8 @@ export interface TicketInfoSectionProps {
|
|
|
67
67
|
isLoading?: boolean;
|
|
68
68
|
isPending?: boolean;
|
|
69
69
|
onAssign: (userId: string | null) => void;
|
|
70
|
+
/** Server search for the picker — see `AssigneeDropdownProps.onSearchChange`. */
|
|
71
|
+
onSearchChange?: (query: string) => void;
|
|
70
72
|
};
|
|
71
73
|
/** Created date string */
|
|
72
74
|
createdAt?: string;
|
|
@@ -178,6 +180,7 @@ export function TicketInfoSection({
|
|
|
178
180
|
isLoading={assigned.isLoading}
|
|
179
181
|
isPending={assigned.isPending}
|
|
180
182
|
onAssign={assigned.onAssign}
|
|
183
|
+
onSearchChange={assigned.onSearchChange}
|
|
181
184
|
/>
|
|
182
185
|
) : (
|
|
183
186
|
<div className="min-w-0">
|