Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/components/DevDocTemplate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ const DevDocTemplate: FC<DevDocTemplateProps> = (props) => {
// breadcrumsData is derived after processedNavMap is built (see useMemo below)
const [activeCategory, setActiveCategory] = useState<DocCategory>('guides');
const [showSearch, setShowSearch] = useState(false);

useEffect(() => {
window.dispatchEvent(new CustomEvent('spotter-code-suspend', { detail: { suspended: showSearch } }));
}, [showSearch]);
const [leftNavOpen, setLeftNavOpen] = useState(false);
const [keyword, updateKeyword] = useState('');
const [isPublicSiteOpen, setIsPublicSiteOpen] = useState(() => {
Expand Down Expand Up @@ -461,10 +457,10 @@ const isVersionedIframe = VERSION_DROPDOWN.some(
},
content: {
top: '50px',
left: 'auto',
right: 'auto',
left: 0,
right: 0,
bottom: 'auto',
width: isMaxMobileResolution ? '40%' : '100%',
width: isMaxMobileResolution ? '40%' : 'calc(100% - 32px)',
margin: 'auto',
transform: 'translate(0, 70px)',
border: 'none',
Expand All @@ -479,6 +475,7 @@ const isVersionedIframe = VERSION_DROPDOWN.some(
isOpen={showSearch}
onRequestClose={() => setShowSearch(false)}
style={customStyles}
portalClassName="DocsSearchModalPortal"
>
<div
id="docsModal"
Expand Down
17 changes: 0 additions & 17 deletions src/components/FloatingAssistant/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@
}
}

.floating-assistant__chip-ring--suspended {
pointer-events: none;
opacity: 0.5;
}

.floating-assistant__panel {
position: fixed;
top: 108px;
Expand Down Expand Up @@ -113,18 +108,6 @@
&--embedded {
top: 0; // no header or secondary nav in embedded mode — panel takes full height
}

&--suspended {
pointer-events: none;

&::after {
content: '';
position: absolute;
inset: 0;
background: rgba(50, 57, 70, 0.4);
z-index: 1;
}
}
}

// ── Header ────────────────────────────────────────────────────────────────────
Expand Down
30 changes: 6 additions & 24 deletions src/components/FloatingAssistant/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,6 @@ const FloatingAssistant: React.FC = () => {
const abortRef = useRef<AbortController | null>(null);
const userScrolledRef = useRef(false);

const [isSuspended, setIsSuspended] = useState(false);
const panelRef = useRef<HTMLDivElement | null>(null);
useEffect(() => {
const handler = (e: CustomEvent<{ suspended: boolean }>) => {
setIsSuspended(e.detail.suspended);
if (e.detail.suspended) {
const active = document.activeElement as HTMLElement | null;
if (active && panelRef.current?.contains(active)) {
active.blur();
}
}
};
window.addEventListener('spotter-code-suspend', handler as EventListener);
return () => window.removeEventListener('spotter-code-suspend', handler as EventListener);
}, []);

useEffect(() => {
setIsOpen(true);
}, []);
Expand Down Expand Up @@ -239,10 +223,10 @@ const FloatingAssistant: React.FC = () => {
};

useEffect(() => {
if (isOpen && !isSuspended && inputRef.current) {
if (isOpen && inputRef.current) {
inputRef.current.focus();
}
}, [isOpen, isSuspended]);
}, [isOpen]);

useEffect(() => {
const el = inputRef.current;
Expand All @@ -252,10 +236,10 @@ const FloatingAssistant: React.FC = () => {
}, [input]);

useEffect(() => {
if (quotedText && !isSuspended) {
if (quotedText) {
setTimeout(() => inputRef.current?.focus(), 100);
}
}, [quotedText, isSuspended]);
}, [quotedText]);

useEffect(() => {
const handler = (e: CustomEvent<{ location: Location }>) => {
Expand Down Expand Up @@ -433,14 +417,13 @@ const FloatingAssistant: React.FC = () => {
<>
{!isOpen && !isClosing && (
<div
className={`floating-assistant__chip-ring${isSuspended ? ' floating-assistant__chip-ring--suspended' : ''}`}
className="floating-assistant__chip-ring"
style={{ top: isEmbedded ? '10px' : '120px' }}
>
<button
className="floating-assistant__chip"
onClick={() => setIsOpen(true)}
aria-label="Open SpotterCode assistant"
disabled={isSuspended}
>
<SparkleIcon />
</button>
Expand All @@ -449,8 +432,7 @@ const FloatingAssistant: React.FC = () => {

{(isOpen || isClosing) && (
<div
ref={panelRef}
className={`floating-assistant__panel${isClosing ? ' closing' : ''}${!isLandingPage ? ' floating-assistant__panel--conversation' : ''}${isEmbedded ? ' floating-assistant__panel--embedded' : ''}${isSuspended ? ' floating-assistant__panel--suspended' : ''}`}
className={`floating-assistant__panel${isClosing ? ' closing' : ''}${!isLandingPage ? ' floating-assistant__panel--conversation' : ''}${isEmbedded ? ' floating-assistant__panel--embedded' : ''}`}
style={{ width: panelWidth }}
>
<div className="floating-assistant__resize-handle" onMouseDown={onResizeMouseDown} />
Expand Down
Loading