π File detail
components/PromptInput/useShowFastIconHint.ts
π§© .tsπ 32 linesπΎ 696 bytesπ text
β Back to All Filesπ― Use case
This file lives under βcomponents/β, which covers shared React UI pieces. On the API surface it exposes useShowFastIconHint β mainly functions, hooks, or classes. Dependencies touch React UI.
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
import { useEffect, useState } from 'react' const HINT_DISPLAY_DURATION_MS = 5000 let hasShownThisSession = false
π€ Exports (heuristic)
useShowFastIconHint
π External import roots
Package roots from from "β¦" (relative paths omitted).
react
π₯οΈ Source preview
import { useEffect, useState } from 'react'
const HINT_DISPLAY_DURATION_MS = 5000
let hasShownThisSession = false
/**
* Hook to manage the /fast hint display next to the fast icon.
* Shows the hint for 5 seconds once per session.
*/
export function useShowFastIconHint(showFastIcon: boolean): boolean {
const [showHint, setShowHint] = useState(false)
useEffect(() => {
if (hasShownThisSession || !showFastIcon) {
return
}
hasShownThisSession = true
setShowHint(true)
const timer = setTimeout(setShowHint, HINT_DISPLAY_DURATION_MS, false)
return () => {
clearTimeout(timer)
setShowHint(false)
}
}, [showFastIcon])
return showHint
}