Skip to content

Commit

Permalink
(fix:search) change toolkit info
Browse files Browse the repository at this point in the history
  • Loading branch information
ManishMadan2882 committed Nov 22, 2024
1 parent ea4ef40 commit 1595e02
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions extensions/react-widget/src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,13 @@ export const SearchBar = ({
return 'ontouchstart' in window;
}
const isTouch = isTouchDevice();

const getKeyboardInstruction = () => {
if (isResultVisible) return "Enter"
if (browserOS === 'mac')
return "⌘ K"
else
return "Ctrl K"
}
React.useEffect(() => {
const handleFocusSearch = (event: KeyboardEvent) => {
if (
Expand Down Expand Up @@ -361,11 +367,22 @@ export const SearchBar = ({
</SearchResults>
)
}
<Toolkit onClick={() => {
setIsWidgetOpen(true)
}} title={`${isTouch ? "Tap" : "Press Enter"} to Ask the AI`}>
{isTouch ? "Tap" : "Enter"}
</Toolkit>
{
isTouch ?

<Toolkit
onClick={() => {
setIsWidgetOpen(true)
}}
title={"Tap to Ask the AI"}>
Tap
</Toolkit>
:
<Toolkit
title={getKeyboardInstruction() === "Enter" ? "Press Enter to Ask AI" : ""}>
{getKeyboardInstruction()}
</Toolkit>
}
</Container>
<WidgetCore
theme={theme}
Expand Down

0 comments on commit 1595e02

Please sign in to comment.