source dump of claude code
at main 31 lines 696 B view raw
1import { useEffect, useState } from 'react' 2 3const HINT_DISPLAY_DURATION_MS = 5000 4 5let hasShownThisSession = false 6 7/** 8 * Hook to manage the /fast hint display next to the fast icon. 9 * Shows the hint for 5 seconds once per session. 10 */ 11export function useShowFastIconHint(showFastIcon: boolean): boolean { 12 const [showHint, setShowHint] = useState(false) 13 14 useEffect(() => { 15 if (hasShownThisSession || !showFastIcon) { 16 return 17 } 18 19 hasShownThisSession = true 20 setShowHint(true) 21 22 const timer = setTimeout(setShowHint, HINT_DISPLAY_DURATION_MS, false) 23 24 return () => { 25 clearTimeout(timer) 26 setShowHint(false) 27 } 28 }, [showFastIcon]) 29 30 return showHint 31}