All files / src/components/common InfoBanner.tsx

0% Statements 0/33
0% Branches 0/1
0% Functions 0/1
0% Lines 0/33

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44                                                                                       
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
import { useCallback } from "react"
import { PlatformType } from "@/config/platform.config"
import { usePlatform } from "@/context/PlatformContext"
import { StateServiceClient } from "@/services/grpc-client"
export const CURRENT_INFO_BANNER_VERSION = 1
export const InfoBanner: React.FC = () => {
	const handleClose = useCallback((e: React.MouseEvent) => {
		e.preventDefault()
		e.stopPropagation()
		StateServiceClient.updateInfoBannerVersion({ value: CURRENT_INFO_BANNER_VERSION }).catch(console.error)
	}, [])
	if (usePlatform().type === PlatformType.VSCODE) {
		return (
			<a
				className="bg-banner-background px-3 py-2 flex flex-col gap-1 shrink-0 mb-1 relative text-sm m-4 no-underline transition-colors hover:brightness-120"
				href="https://github.com/AI-Hydro/AI-Hydro#readme"
				rel="noopener noreferrer"
				style={{ color: "var(--vscode-foreground)", outline: "none" }}
				target="_blank">
				<h4 className="m-0" style={{ paddingRight: "18px" }}>
					💡 AI-Hydro in the Right Sidebar
				</h4>
				<p className="m-0">
					Keep your files visible when chatting with AI-Hydro. Drag the AI-Hydro icon to the right sidebar panel for a
					better experience. <span className="text-link cursor-pointer">See how →</span>
				</p>
 
				{/* Close button */}
				<VSCodeButton
					appearance="icon"
					data-testid="info-banner-close-button"
					onClick={handleClose}
					style={{ position: "absolute", top: "6px", right: "6px" }}>
					<span className="codicon codicon-close"></span>
				</VSCodeButton>
			</a>
		)
	}
	return null
}
 
export default InfoBanner