fix automation navigation bug

This commit is contained in:
Connor Yoh 2025-09-05 15:22:08 +01:00
parent a63708bb3f
commit 022d7ec8a2
3 changed files with 9 additions and 6 deletions

View File

@ -93,7 +93,7 @@ export default function ToolSelector({
const renderedTools = useMemo(() => const renderedTools = useMemo(() =>
displayGroups.map((subcategory) => displayGroups.map((subcategory) =>
renderToolButtons(t, subcategory, null, handleToolSelect, !isSearching) renderToolButtons(t, subcategory, null, handleToolSelect, !isSearching, true)
), [displayGroups, handleToolSelect, isSearching, t] ), [displayGroups, handleToolSelect, isSearching, t]
); );
@ -150,7 +150,7 @@ export default function ToolSelector({
<div onClick={handleSearchFocus} style={{ cursor: 'pointer', <div onClick={handleSearchFocus} style={{ cursor: 'pointer',
borderRadius: "var(--mantine-radius-lg)" }}> borderRadius: "var(--mantine-radius-lg)" }}>
<ToolButton id='tool' tool={toolRegistry[selectedValue]} isSelected={false} <ToolButton id='tool' tool={toolRegistry[selectedValue]} isSelected={false}
onSelect={()=>{}} rounded={true}></ToolButton> onSelect={()=>{}} rounded={true} disableNavigation={true}></ToolButton>
</div> </div>
) : ( ) : (
// Show search input when no tool selected OR when dropdown is opened // Show search input when no tool selected OR when dropdown is opened

View File

@ -12,7 +12,8 @@ export const renderToolButtons = (
subcategory: SubcategoryGroup, subcategory: SubcategoryGroup,
selectedToolKey: string | null, selectedToolKey: string | null,
onSelect: (id: string) => void, onSelect: (id: string) => void,
showSubcategoryHeader: boolean = true showSubcategoryHeader: boolean = true,
disableNavigation: boolean = false
) => ( ) => (
<Box key={subcategory.subcategoryId} w="100%"> <Box key={subcategory.subcategoryId} w="100%">
{showSubcategoryHeader && ( {showSubcategoryHeader && (
@ -26,6 +27,7 @@ export const renderToolButtons = (
tool={tool} tool={tool}
isSelected={selectedToolKey === id} isSelected={selectedToolKey === id}
onSelect={onSelect} onSelect={onSelect}
disableNavigation={disableNavigation}
/> />
))} ))}
</div> </div>

View File

@ -12,9 +12,10 @@ interface ToolButtonProps {
isSelected: boolean; isSelected: boolean;
onSelect: (id: string) => void; onSelect: (id: string) => void;
rounded?: boolean; rounded?: boolean;
disableNavigation?: boolean;
} }
const ToolButton: React.FC<ToolButtonProps> = ({ id, tool, isSelected, onSelect }) => { const ToolButton: React.FC<ToolButtonProps> = ({ id, tool, isSelected, onSelect, disableNavigation = false }) => {
const isUnavailable = !tool.component && !tool.link; const isUnavailable = !tool.component && !tool.link;
const { getToolNavigation } = useToolNavigation(); const { getToolNavigation } = useToolNavigation();
@ -29,8 +30,8 @@ const ToolButton: React.FC<ToolButtonProps> = ({ id, tool, isSelected, onSelect
onSelect(id); onSelect(id);
}; };
// Get navigation props for URL support // Get navigation props for URL support (only if navigation is not disabled)
const navProps = !isUnavailable && !tool.link ? getToolNavigation(id, tool) : null; const navProps = !isUnavailable && !tool.link && !disableNavigation ? getToolNavigation(id, tool) : null;
const tooltipContent = isUnavailable const tooltipContent = isUnavailable
? (<span><strong>Coming soon:</strong> {tool.description}</span>) ? (<span><strong>Coming soon:</strong> {tool.description}</span>)