All files / src/components/chat Announcement.tsx

100% Statements 88/88
100% Branches 1/1
100% Functions 1/1
100% Lines 88/88

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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 1381x 1x             1x 1x 1x 1x 1x 1x 1x 1x 1x   1x   1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x   1x 1x 1x 1x   1x 1x 1x 1x 1x   1x   1x     1x 1x 2x   2x 2x 2x 2x 2x 2x 2x 2x 2x     2x 2x 2x     2x 2x 2x     2x 2x       2x 2x     2x 2x         2x   2x 2x 2x       2x 2x     2x 2x     2x 2x     2x 2x           2x   1x  
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
import { CSSProperties, memo } from "react"
 
interface AnnouncementProps {
	version: string
	hideAnnouncement: () => void
}
 
const containerStyle: CSSProperties = {
	backgroundColor: "rgba(0, 163, 255, 0.06)",
	border: "1px solid rgba(0, 163, 255, 0.2)",
	borderRadius: "8px",
	padding: "14px 16px",
	margin: "8px 15px",
	position: "relative",
	flexShrink: 0,
}
 
const closeIconStyle: CSSProperties = { position: "absolute", top: "8px", right: "8px" }
 
const titleStyle: CSSProperties = {
	margin: "0 0 10px",
	fontWeight: "bold",
	fontSize: "13px",
	display: "flex",
	alignItems: "center",
	gap: "6px",
}
 
const ulStyle: CSSProperties = {
	margin: "0 0 10px",
	paddingLeft: "14px",
	listStyleType: "disc",
	fontSize: "12px",
	lineHeight: "1.7",
}
 
const hrStyle: CSSProperties = {
	height: "1px",
	background: "rgba(0, 163, 255, 0.15)",
	border: "none",
	margin: "10px 0",
}
 
const teaserStyle: CSSProperties = {
	fontSize: "11.5px",
	color: "rgba(255,255,255,0.55)",
	margin: "0 0 8px",
	lineHeight: "1.6",
}
 
const teaserHighlight: CSSProperties = {
	color: "#00ddff",
	fontWeight: 600,
}
 
const linkRowStyle: CSSProperties = {
	margin: "0",
	fontSize: "11.5px",
	color: "rgba(255,255,255,0.45)",
}
 
const linkStyle: CSSProperties = { display: "inline" }
 
/*
Announcements show automatically when the major.minor version changes (e.g. 0.1.x โ†’ 0.2.x).
The latestAnnouncementId is derived from package.json โ€” patch releases do not trigger new banners.
*/
const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => {
	const minorVersion = version.split(".").slice(0, 2).join(".") // 0.1.3 โ†’ 0.1
 
	return (
		<div style={containerStyle}>
			<VSCodeButton
				appearance="icon"
				data-testid="close-button"
				onClick={hideAnnouncement}
				style={closeIconStyle}
				title="Dismiss">
				<span className="codicon codicon-close" />
			</VSCodeButton>
 
			<h3 style={titleStyle}>
				<span>๐ŸŒŠ</span>
				<span>Welcome to AI-Hydro v{minorVersion}</span>
			</h3>
 
			<ul style={ulStyle}>
				<li>
					<b>26 built-in hydrological tools</b> โ€” watershed delineation, streamflow, signatures, geomorphic analysis,
					HBV-light calibration, LSTM modelling and more, all from a single conversation.
				</li>
				<li>
					<b>Research memory that persists</b> โ€” HydroSession, ProjectSession, and ResearcherProfile remember your gauge
					data, project context, and expertise across every session. Expensive computations run once and are reused
					forever.
				</li>
				<li>
					<b>Reproducibility built in</b> โ€” every tool call auto-generates a citable methods paragraph and BibTeX entry.
					Export your full session provenance for your paper in one command.
				</li>
				<li>
					<b>Community-extensible</b> โ€” register domain tools (flood frequency, sediment transport, groundwater) via
					Python entry points. Your tools become available to every AI-Hydro user instantly.
				</li>
			</ul>
 
			<hr style={hrStyle} />
 
			<p style={teaserStyle}>
				<span style={teaserHighlight}>On the roadmap โ€”</span> Use your existing{" "}
				<span style={teaserHighlight}>ChatGPT Plus or Pro subscription</span> directly in AI-Hydro. No API key, no
				per-token billing. This requires an OpenAI partnership โ€” something we are working toward as the platform grows.
			</p>
 
			<p style={linkRowStyle}>
				<VSCodeLink href="https://ai-hydro.github.io/AI-Hydro/" style={linkStyle}>
					Documentation
				</VSCodeLink>
				{" ยท "}
				<VSCodeLink href="https://github.com/AI-Hydro/AI-Hydro/discussions" style={linkStyle}>
					Community
				</VSCodeLink>
				{" ยท "}
				<VSCodeLink href="https://github.com/AI-Hydro/AI-Hydro/issues" style={linkStyle}>
					Issues
				</VSCodeLink>
				{" ยท "}
				<VSCodeLink href="https://www.youtube.com/channel/UC8RWDhJm61i2tlV9mt982cw" style={linkStyle}>
					YouTube
				</VSCodeLink>
			</p>
		</div>
	)
}
 
export default memo(Announcement)