feat(chat): add manual refresh for delivered agents
This commit is contained in:
1 parent
862477f9d4
commit
2b1943dd0f
13 files changed
+517
-59
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import * as Tooltip from '@radix-ui/react-tooltip';
|
||||
import { Sparkles } from 'lucide-react';
|
||||
import type { ReactElement, Ref } from 'react';
|
||||
import { useRef, type ReactElement, type Ref } from 'react';
|
||||
import type { TeacherDefinition } from '../../../shared/coding-teacher';
|
||||
import { TeacherAvatar } from './TeacherAvatar';
|
||||
|
||||
@@ -13,11 +13,23 @@ export function TeacherIntroduction({ definition, children, contentRef, open, on
|
||||
onOpenChange(open: boolean): void;
|
||||
}) {
|
||||
const description = definition?.description?.trim();
|
||||
return <Tooltip.Root open={Boolean(description) && open} onOpenChange={onOpenChange}>
|
||||
const clicked = useRef(false);
|
||||
return <Tooltip.Root open={Boolean(description) && open} onOpenChange={(next) => {
|
||||
if (!next || !clicked.current) onOpenChange(next);
|
||||
}}>
|
||||
<Tooltip.Trigger asChild onPointerEnter={(event) => {
|
||||
// Adjacent entries must switch immediately, even inside the previous
|
||||
// tooltip's pointer grace area used when moving into its readable card.
|
||||
if (event.pointerType !== 'touch') onOpenChange(true);
|
||||
if (event.pointerType === 'touch') return;
|
||||
if (event.relatedTarget instanceof Node && event.currentTarget.contains(event.relatedTarget)) return;
|
||||
clicked.current = false;
|
||||
onOpenChange(true);
|
||||
}} onClick={() => {
|
||||
// A delayed Radix hover callback must not reopen the card after selection.
|
||||
clicked.current = true;
|
||||
onOpenChange(false);
|
||||
}} onFocus={() => {
|
||||
clicked.current = false;
|
||||
}} onPointerMove={(event) => {
|
||||
// pointerEnter owns hover opening. Skip Radix's second opening path so
|
||||
// moving inside an entry after clicking it cannot reopen its introduction.
|
||||
|
||||
Reference in new issue
Block a user