Open History to see the last commit
1import { uuidv4 } from "../../lib/uuid";
2import { useNavigation } from "@react-navigation/native";
3import {
4 claimThreadOpen,
5 nextShownOrder,
6 threadSearchSubject,
7 type EnvironmentThreadSearchMatch,
8 type ShownOrder,
9} from "@t3tools/client-runtime/state/thread-search";
10import { THREAD_JUMP_KEYBINDING_COMMANDS } from "@t3tools/contracts";
11import {
12 foldSearchQuery,
13 PALETTE_MESSAGE_LIMIT,
14 rankMessageMatches,
15 splitSearchText,
16 pickedQuery,
17 threadRecentUse,
18} from "@t3tools/shared/paletteSearch";
19import { useCallback, useEffect, useMemo, useRef, useState } from "react";
20import {
21 FlatList,
22 KeyboardAvoidingView,
23 Modal,
24 Pressable,
25 Text as NativeText,
26 TextInput,
27 useWindowDimensions,
28 View,
29 type TextInputInstance,
30} from "react-native";
31
32import { GestureHandlerRootView } from "react-native-gesture-handler";
33
34import { ProjectFavicon } from "../../components/ProjectFavicon";
35import { GlassSurface } from "../../components/ui/GlassSurface";
36import { RowPressable } from "../../components/ui/RowPressable";
37import { AppText as Text } from "../../components/ui/AppText";
38import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
39import { cn } from "../../lib/cn";
40import { deriveBottomControlInsets } from "../../lib/reserved-regions";
41import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
42import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
43import { T3KeyboardCommands } from "../../native/T3KeyboardCommands";
44import { useProjects, useThreadShell, useThreadShells } from "../../state/entities";
45import { useThreadSearch } from "../../state/queries";
46import { requestThreadMessageJump } from "../threads/threadMessageJump";
47import { threadEnvironment } from "../../state/threads";
48import { useAtomCommand } from "../../state/use-atom-command";
49import { useWorkspaceEnvironments } from "../../state/workspace";
50import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
51import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
52import { ThreadSearchMatchExcerpt } from "../threads/thread-search-match";
53import {
54 filterCommandPaletteItems,
55 nextPaletteIndex,
56 type CommandPaletteItem,
57 type CommandPaletteResult,
58} from "./commandPaletteItems";
59import { parseActiveThreadPath, type HardwareKeyboardCommand } from "./hardwareKeyboardCommands";
60import { threadJumpIndex } from "./threadKeyboardShortcuts";
61import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
62import { openSettings } from "../settings/settings-navigation";
63import { useSelectWorkspaceTab } from "../workspace/useSelectWorkspaceTab";
64import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
65
66const PALETTE_COMMANDS: ReadonlyArray<HardwareKeyboardCommand> = [
67 "commandPalette",
68 "paletteDismiss",
69 "paletteNext",
70 "palettePrevious",
71 ...THREAD_JUMP_KEYBINDING_COMMANDS,
72];
73const ROW_HEIGHT = 50;
74// The "In messages" label above the first message match; server results always come last.
75const SECTION_LABEL_HEIGHT = 26;
76
77const ACTION_ICONS: Record<string, AppSymbolName> = {
78 newTask: "square.and.pencil",
79 newThread: "square.and.pencil",
80 addProject: "folder.badge.plus",
81 settings: "gearshape",
82 appearance: "paintbrush",
83 environments: "desktopcomputer",
84 usage: "chart.bar.xaxis",
85 archive: "archivebox",
86 files: "doc.text",
87 terminal: "terminal",
88 review: PullRequestGlyph.pullRequest,
89 copyThreadReference: "link",
90};
91
92function itemIcon(item: CommandPaletteItem): AppSymbolName {
93 if (item.kind === "thread") return "text.bubble";
94 return ACTION_ICONS[item.key] ?? "ellipsis";
95}
96
97function PaletteRow(props: {
98 readonly item: CommandPaletteResult;
99 readonly index: number;
100 readonly selected: boolean;
101 readonly searchMatch?: EnvironmentThreadSearchMatch;
102 readonly searchQuery: string;
103 readonly onSelect: () => void;
104}) {
105 const foregroundClassName = props.selected
106 ? "text-thread-selected-foreground"
107 : "text-foreground";
108 const mutedForegroundClassName = props.selected
109 ? "text-thread-selected-foreground-muted"
110 : "text-foreground-muted";
111 return (
112 <RowPressable
113 accessibilityRole="button"
114 interactionOpacity={props.selected ? 0 : 1}
115 accessibilityState={{ selected: props.selected }}
116 onPress={props.onSelect}
117 className={
118 props.selected
119 ? "mx-2 flex-row items-center gap-3 rounded-xl bg-thread-selected px-3"
120 : "mx-2 flex-row items-center gap-3 rounded-xl px-3"
121 }
122 style={{ height: ROW_HEIGHT }}
123 >
124 <View className="w-7 items-center">
125 {props.item.project ? (
126 <ProjectFavicon
127 environmentId={props.item.project.environmentId}
128 faviconPath={props.item.project.faviconPath}
129 projectIcon={props.item.project.projectIcon}
130 projectTitle={props.item.project.title}
131 size={20}
132 workspaceRoot={props.item.project.workspaceRoot}
133 />
134 ) : (
135 <SymbolView
136 name={itemIcon(props.item)}
137 size={20}
138 tintColorClassName={
139 props.selected ? "accent-thread-selected-foreground" : "accent-icon"
140 }
141 />
142 )}
143 </View>
144 <View className="flex-1">
145 <View className="flex-row items-baseline gap-2">
146 <Text numberOfLines={1} className={cn("shrink text-base", foregroundClassName)}>
147 {props.item.titleRanges?.length
148 ? splitSearchText(props.item.title, props.item.titleRanges).map((part) => (
149 <Text
150 key={part.start}
151 className={cn("text-base", part.highlighted && "font-t3-bold")}
152 >
153 {part.text}
154 </Text>
155 ))
156 : props.item.title}
157 </Text>
158 {/* The second line shows the snippet or hint, so keep where the thread
159 lives, unless the hint already names it. */}
160 {(props.searchMatch ||
161 (props.item.matchHint &&
162 props.item.matchHint.label !== "Project" &&
163 props.item.matchHint.label !== "Environment")) &&
164 props.item.detail ? (
165 <Text
166 numberOfLines={1}
167 className={cn("max-w-[45%] shrink-0 text-sm", mutedForegroundClassName)}
168 >
169 {props.item.detail}
170 </Text>
171 ) : null}
172 </View>
173 {props.searchMatch ? (
174 <ThreadSearchMatchExcerpt
175 match={props.searchMatch}
176 query={props.searchQuery}
177 selected={props.selected}
178 compact
179 />
180 ) : props.item.matchHint ? (
181 <Text numberOfLines={1} className={cn("text-sm", mutedForegroundClassName)}>
182 {props.item.matchHint.label}:{" "}
183 {splitSearchText(props.item.matchHint.text, props.item.matchHint.ranges).map((part) => (
184 <Text key={part.start} className={cn("text-sm", part.highlighted && "font-t3-bold")}>
185 {part.text}
186 </Text>
187 ))}
188 </Text>
189 ) : props.item.detail ? (
190 <Text numberOfLines={1} className={cn("text-sm", mutedForegroundClassName)}>
191 {props.item.detail}
192 </Text>
193 ) : null}
194 </View>
195 {props.index < 9 ? (
196 <NativeText
197 className={cn("w-8 shrink-0 text-right text-sm tabular-nums", mutedForegroundClassName)}
198 >
199 ⌘{props.index + 1}
200 </NativeText>
201 ) : null}
202 </RowPressable>
203 );
204}
205
206/** Mounted only while open, so the app root does not subscribe to the full thread catalog. */
207export function CommandPalette(props: {
208 readonly pathname: string;
209 readonly onClose: () => void;
210 readonly onCommand: (command: HardwareKeyboardCommand) => void;
211}) {
212 const navigation = useNavigation();
213 const selectTab = useSelectWorkspaceTab();
214 const { themeVariables } = useAppearancePreferences();
215 const selectDetail = useSelectWorkspaceDetail();
216 const runCommand = props.onCommand;
217 const projects = useProjects();
218 const threads = useThreadShells();
219 const activeThreadRef = useMemo(() => parseActiveThreadPath(props.pathname), [props.pathname]);
220 const activeThread = useThreadShell(activeThreadRef);
221 const visitThread = useAtomCommand(threadEnvironment.visit, { reportFailure: false });
222 const environments = useWorkspaceEnvironments();
223 const { savedConnectionsById } = useSavedRemoteConnections();
224 const [query, setQuery] = useState("");
225 // Ranking is relative to when the palette opened, so rows do not reorder as time passes.
226 const [now] = useState(() => Date.now());
227 const [selection, setSelection] = useState<string | null>(null);
228 const [visible, setVisible] = useState(true);
229 const pendingAction = useRef<(() => void) | null>(null);
230 const closing = useRef(false);
231 const inputRef = useRef<TextInputInstance>(null);
232 const listRef = useRef<FlatList<CommandPaletteResult>>(null);
233 const { width, height } = useWindowDimensions();
234 // The palette floats above every column, so it keeps itself inside the window's side insets
235 // and to one side of a book fold.
236 const bounds = deriveBottomControlInsets(useNativeLayoutMetrics());
237 const searchEnvironmentIds = useMemo(
238 () =>
239 environments
240 .filter((environment) => environment.connectionState === "connected")
241 .map((environment) => environment.environmentId),
242 [environments],
243 );
244 // The palette matches environment names when there are several; older rows must match the same.
245 const environmentLabels =
246 environments.length > 1
247 ? Object.fromEntries(
248 searchEnvironmentIds.flatMap((environmentId) => {
249 const label = savedConnectionsById[environmentId]?.environmentLabel;
250 return label === undefined ? [] : [[environmentId, label]];
251 }),
252 )
253 : undefined;
254 const search = useThreadSearch(
255 searchEnvironmentIds,
256 query.startsWith(">") ? "" : query,
257 environmentLabels === undefined ? {} : { environmentLabels },
258 );
259 const contentMatchByKey = useMemo(
260 () =>
261 new Map(
262 search.matches
263 .filter((match) => match.source === "user" || match.source === "assistant")
264 .map((match) => [scopedThreadKey(match.environmentId, match.threadId), match]),
265 ),
266 [search.matches],
267 );
268 const items = useMemo(() => {
269 const actions: CommandPaletteItem[] = [
270 {
271 key: "newTask",
272 kind: "action",
273 title: "New thread in…",
274 searchTerms: ["new task", "chat", "create", "project"],
275 run: () => runCommand("newTask"),
276 },
277 {
278 key: "addProject",
279 kind: "action",
280 title: "Add project",
281 searchTerms: ["folder", "clone", "repository", "git"],
282 run: () => navigation.navigate("AddProject"),
283 },
284 {
285 key: "settings",
286 kind: "action",
287 title: "Open settings",
288 searchTerms: ["preferences", "configuration"],
289 run: () => selectTab("settings"),
290 },
291 {
292 key: "appearance",
293 kind: "action",
294 title: "Appearance",
295 searchTerms: ["theme", "colors", "dark", "light"],
296 run: () => openSettings(navigation, "SettingsAppearance"),
297 },
298 {
299 key: "environments",
300 kind: "action",
301 title: "Manage environments",
302 searchTerms: ["connections", "server", "remote"],
303 run: () => openSettings(navigation, "SettingsEnvironments"),
304 },
305 {
306 key: "scheduledTasks",
307 kind: "action",
308 title: "Scheduled tasks",
309 searchTerms: ["schedule", "automations", "recurring"],
310 run: () => openSettings(navigation, "SettingsScheduledTasks"),
311 },
312 {
313 key: "usage",
314 kind: "action",
315 title: "Usage",
316 searchTerms: ["limits", "accounts", "quota"],
317 run: () => openSettings(navigation, "SettingsUsage"),
318 },
319 {
320 key: "archive",
321 kind: "action",
322 title: "Archived threads",
323 searchTerms: ["restore", "history"],
324 run: () => openSettings(navigation, "SettingsArchive"),
325 },
326 ];
327 const projectByKey = new Map(
328 projects.map((project) => [scopedProjectKey(project.environmentId, project.id), project]),
329 );
330 const activeProject = activeThread
331 ? projectByKey.get(scopedProjectKey(activeThread.environmentId, activeThread.projectId))
332 : null;
333 if (activeProject) {
334 actions.unshift({
335 key: "newThread",
336 kind: "action",
337 title: `New thread in ${activeProject.title}`,
338 searchTerms: ["new task", "chat", "create"],
339 run: () =>
340 selectDetail({
341 name: "Thread",
342 params: {
343 draft: {
344 requestId: uuidv4(),
345 environmentId: activeProject.environmentId,
346 projectId: activeProject.id,
347 title: activeProject.title,
348 },
349 },
350 }),
351 });
352 }
353 if (activeThreadRef) {
354 const threadActions = [
355 ["files", "Go to file", ["open", "files", "browse", "search"]],
356 ["terminal", "Open terminal", ["shell", "console"]],
357 ["review", "Review changes", ["diff", "git", "pull request"]],
358 ["copyThreadReference", "Copy PR link or thread ID", ["reference", "clipboard"]],
359 ] as const;
360 actions.push(
361 ...threadActions.map(([command, title, searchTerms]) => ({
362 key: command,
363 kind: "action" as const,
364 title,
365 searchTerms,
366 run: () => runCommand(command),
367 })),
368 );
369 }
370 const projectItems: CommandPaletteItem[] = projects.map((project) => ({
371 key: `project:${scopedProjectKey(project.environmentId, project.id)}`,
372 kind: "project",
373 project,
374 title: project.title,
375 detail: `New thread · ${savedConnectionsById[project.environmentId]?.environmentLabel ?? project.environmentId}`,
376 searchTerms: [project.workspaceRoot, "new thread", "project"],
377 run: () =>
378 selectDetail({
379 name: "Thread",
380 params: {
381 draft: {
382 requestId: uuidv4(),
383 environmentId: project.environmentId,
384 projectId: project.id,
385 title: project.title,
386 },
387 },
388 }),
389 }));
390 const threadItems: CommandPaletteItem[] = threads
391 .filter(
392 (thread) =>
393 thread.archivedAt === null && thread.lineage.relationshipToParent !== "subagent",
394 )
395 .map((thread) => {
396 const project = projectByKey.get(scopedProjectKey(thread.environmentId, thread.projectId));
397 const environment =
398 savedConnectionsById[thread.environmentId]?.environmentLabel ?? thread.environmentId;
399 return {
400 key: scopedThreadKey(thread.environmentId, thread.id),
401 kind: "thread",
402 title: thread.title || "Untitled thread",
403 detail: [project?.title, environment].filter(Boolean).join(" · "),
404 searchTerms: [],
405 threadSearch: threadSearchSubject(
406 thread,
407 project?.title,
408 environments.length > 1 ? environment : null,
409 ),
410 // Last among threads: picking the thread already open does nothing.
411 ...(thread.environmentId === activeThread?.environmentId && thread.id === activeThread.id
412 ? { secondary: true }
413 : {}),
414 run: () =>
415 selectDetail({
416 name: "Thread",
417 params: { environmentId: String(thread.environmentId), threadId: String(thread.id) },
418 }),
419 };
420 });
421 // Recent means used recently: written in or opened, whichever is later.
422 threadItems.sort(
423 (left, right) =>
424 (right.threadSearch ? threadRecentUse(right.threadSearch) : 0) -
425 (left.threadSearch ? threadRecentUse(left.threadSearch) : 0),
426 );
427 return [...actions, ...projectItems, ...threadItems];
428 }, [
429 selectTab,
430 activeThread,
431 activeThreadRef,
432 environments.length,
433 navigation,
434 projects,
435 runCommand,
436 savedConnectionsById,
437 selectDetail,
438 threads,
439 ]);
440 const rankedMessageKeys = useMemo(() => {
441 const subjectByKey = new Map(
442 items.flatMap((item) => (item.threadSearch ? [[item.key, item.threadSearch] as const] : [])),
443 );
444 const keyOf = (match: EnvironmentThreadSearchMatch) =>
445 scopedThreadKey(match.environmentId, match.threadId);
446 return rankMessageMatches(
447 search.matches,
448 (match) => subjectByKey.get(keyOf(match)),
449 foldSearchQuery(query),
450 now,
451 { withoutTitleMatches: true },
452 ).map(keyOf);
453 }, [items, now, query, search.matches]);
454 // Rows already shown keep their places when a slower environment answers.
455 const [shownOrder, setShownOrder] = useState<ShownOrder | null>(null);
456 const messageOrder = nextShownOrder(
457 shownOrder,
458 search.query,
459 rankedMessageKeys,
460 PALETTE_MESSAGE_LIMIT,
461 );
462 if (messageOrder !== shownOrder) setShownOrder(messageOrder);
463 const messageMatchKeys = useMemo(
464 () => messageOrder.keys.slice(0, messageOrder.shown),
465 [messageOrder.keys, messageOrder.shown],
466 );
467 const results = useMemo(() => {
468 const ranked = filterCommandPaletteItems(items, query, messageMatchKeys, now);
469 // Recent threads leave out the open one, which would always lead them.
470 const activeKey = activeThread
471 ? scopedThreadKey(activeThread.environmentId, activeThread.id)
472 : null;
473 return query.trim() ? ranked : ranked.filter((item) => item.key !== activeKey);
474 }, [activeThread, items, messageMatchKeys, now, query]);
475 const runResult = (item: CommandPaletteResult) => {
476 const thread =
477 item.kind === "thread" && query.trim() && !query.startsWith(">")
478 ? threads.find(
479 (candidate) => scopedThreadKey(candidate.environmentId, candidate.id) === item.key,
480 )
481 : undefined;
482 // A message result opens the thread at that message.
483 const messageId = item.fromMessages ? contentMatchByKey.get(item.key)?.messageId : undefined;
484 if (messageId) requestThreadMessageJump(item.key, messageId);
485 // A pick sends its open with the query, always, so the server records it;
486 // the thread screen then skips its own open. The open thread is no pick.
487 if (thread && !item.secondary) claimThreadOpen(thread.environmentId, thread.id, Date.now());
488 if (thread && thread.lastVisitedAt !== undefined && !item.secondary) {
489 void visitThread({
490 environmentId: thread.environmentId,
491 input: {
492 threadId: thread.id,
493 visitedAt: thread.updatedAt,
494 opened: true,
495 searchQuery: pickedQuery(query),
496 },
497 });
498 }
499 item.run();
500 };
501 const firstMessageIndex = results.findIndex((item) => item.fromMessages);
502 const selectedIndex = Math.max(
503 0,
504 results.findIndex((item) => item.key === selection),
505 );
506 const selectedKey = results[selectedIndex]?.key;
507 // The native list follows the highlighted row. Key presses move it, but so do
508 // live thread updates and late message matches that reorder or drop the
509 // selected row under a kept selection, so no single handler owns the scroll.
510 useEffect(() => {
511 if (selectedIndex === 0) {
512 // Centering before the list measures its height scrolls half the first row out of view.
513 listRef.current?.scrollToOffset({ offset: 0, animated: false });
514 } else if (selectedKey !== undefined) {
515 listRef.current?.scrollToIndex({ index: selectedIndex, animated: false, viewPosition: 0.5 });
516 }
517 }, [selectedIndex, selectedKey]);
518
519 const dismissed = useRef(false);
520 const dismissFallback = useRef<ReturnType<typeof setTimeout> | null>(null);
521 const handleDismissed = useCallback(() => {
522 if (dismissFallback.current !== null) clearTimeout(dismissFallback.current);
523 dismissFallback.current = null;
524 if (dismissed.current) return;
525 dismissed.current = true;
526 // Present navigation sheets only after UIKit has dismissed this modal.
527 props.onClose();
528 pendingAction.current?.();
529 }, [props]);
530 useEffect(
531 () => () => {
532 if (dismissFallback.current !== null) clearTimeout(dismissFallback.current);
533 },
534 [],
535 );
536
537 function close(run?: () => void) {
538 if (closing.current) return;
539 closing.current = true;
540 pendingAction.current = run ?? null;
541 setVisible(false);
542 // iOS may drop onDismiss during presentation or competing sheets; a fallback clears stale palette state.
543 dismissFallback.current = setTimeout(handleDismissed, 400);
544 }
545
546 function onCommand(command: HardwareKeyboardCommand) {
547 if (command === "commandPalette" || command === "paletteDismiss") {
548 close();
549 } else if (command === "paletteNext" || command === "palettePrevious") {
550 setSelection(
551 results[nextPaletteIndex(selectedIndex, command === "paletteNext" ? 1 : -1, results.length)]
552 ?.key ?? null,
553 );
554 } else {
555 const item = results[threadJumpIndex(command)];
556 if (item) close(() => runResult(item));
557 }
558 }
559
560 return (
561 <Modal
562 visible={visible}
563 transparent
564 animationType="fade"
565 onShow={() => inputRef.current?.focus()}
566 onRequestClose={() => close()}
567 onDismiss={handleDismissed}
568 >
569 <GestureHandlerRootView className="flex-1">
570 <T3KeyboardCommands enabledCommands={PALETTE_COMMANDS} onCommand={onCommand}>
571 <KeyboardAvoidingView
572 behavior="padding"
573 className="flex-1 items-center justify-center py-4"
574 style={{ paddingLeft: 16 + bounds.left, paddingRight: 16 + bounds.right }}
575 >
576 <Pressable
577 className="absolute inset-0 bg-backdrop"
578 accessibilityLabel="Close command palette"
579 onPress={() => close()}
580 />
581 <GlassSurface
582 accessibilityViewIsModal
583 className="bg-sheet"
584 tintColorClassName="accent-sheet/20"
585 fallbackColor={themeVariables["--color-sheet"]}
586 style={{
587 width: Math.min(600, width - 32 - bounds.left - bounds.right),
588 height: Math.min(520, height - 80),
589 borderRadius: 20,
590 }}
591 >
592 <View className="px-3 pb-2.5 pt-3.5">
593 <View className="h-[38px] flex-row items-center gap-1.5 pr-2.5 pl-[11px]">
594 <SymbolView
595 name="magnifyingglass"
596 size={15}
597 tintColorClassName="accent-foreground-muted"
598 type="monochrome"
599 />
600 <TextInput
601 ref={inputRef}
602 accessibilityLabel="Search commands, projects, and threads"
603 placeholder="Search commands, projects, and threads…"
604 placeholderTextColorClassName="accent-placeholder"
605 autoCorrect={false}
606 autoCapitalize="none"
607 clearButtonMode="while-editing"
608 className="h-[34px] flex-1 px-0 py-0 font-sans text-base text-foreground"
609 value={query}
610 onChangeText={(value) => {
611 setQuery(value);
612 setSelection(null);
613 // The follow effect stays idle when the top row and its key are unchanged,
614 // so a touch-scrolled list would otherwise keep its old offset.
615 listRef.current?.scrollToOffset({ offset: 0, animated: false });
616 }}
617 returnKeyType="go"
618 submitBehavior="submit"
619 onSubmitEditing={() => {
620 const item = results[selectedIndex];
621 if (item) close(() => runResult(item));
622 }}
623 />
624 </View>
625 </View>
626 <FlatList
627 ref={listRef}
628 data={results}
629 extraData={selectedKey}
630 keyboardShouldPersistTaps="handled"
631 keyExtractor={(item) => item.key}
632 getItemLayout={(_, index) => ({
633 length: ROW_HEIGHT + (index === firstMessageIndex ? SECTION_LABEL_HEIGHT : 0),
634 offset:
635 ROW_HEIGHT * index +
636 (firstMessageIndex !== -1 && index > firstMessageIndex
637 ? SECTION_LABEL_HEIGHT
638 : 0),
639 index,
640 })}
641 contentContainerClassName="pb-2"
642 ListEmptyComponent={
643 <Text className="p-5 text-center text-foreground-muted">
644 {search.isPending ? "Searching…" : "No results"}
645 </Text>
646 }
647 // Message results from slower environments may still arrive below.
648 ListFooterComponent={
649 results.length > 0 && search.isPending && !query.startsWith(">") ? (
650 <Text className="px-5 pt-2 text-xs text-foreground-muted">
651 Searching messages…
652 </Text>
653 ) : undefined
654 }
655 renderItem={({ item, index }) => (
656 <>
657 {index === firstMessageIndex ? (
658 <Text
659 className="px-5 pt-2 text-xs text-foreground-muted"
660 style={{ height: SECTION_LABEL_HEIGHT }}
661 >
662 In messages
663 </Text>
664 ) : null}
665 <PaletteRow
666 item={item}
667 index={index}
668 selected={item.key === selectedKey}
669 searchMatch={item.fromMessages ? contentMatchByKey.get(item.key) : undefined}
670 searchQuery={search.query}
671 onSelect={() => close(() => runResult(item))}
672 />
673 </>
674 )}
675 />
676 </GlassSurface>
677 </KeyboardAvoidingView>
678 </T3KeyboardCommands>
679 </GestureHandlerRootView>
680 </Modal>
681 );
682}