|
1 | 1 | import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react" |
2 | | -import { memo } from "react" |
| 2 | +import { CSSProperties, memo } from "react" |
3 | 3 | import { getAsVar, VSC_DESCRIPTION_FOREGROUND, VSC_INACTIVE_SELECTION_BACKGROUND } from "../../utils/vscStyles" |
4 | | -import { vscode } from "../../utils/vscode" |
5 | 4 |
|
6 | 5 | interface AnnouncementProps { |
7 | 6 | version: string |
8 | 7 | hideAnnouncement: () => void |
9 | 8 | } |
10 | 9 |
|
| 10 | +const containerStyle: CSSProperties = { |
| 11 | + backgroundColor: getAsVar(VSC_INACTIVE_SELECTION_BACKGROUND), |
| 12 | + borderRadius: "3px", |
| 13 | + padding: "12px 16px", |
| 14 | + margin: "5px 15px 5px 15px", |
| 15 | + position: "relative", |
| 16 | + flexShrink: 0, |
| 17 | +} |
| 18 | +const closeIconStyle: CSSProperties = { position: "absolute", top: "8px", right: "8px" } |
| 19 | +const h3TitleStyle: CSSProperties = { margin: "0 0 8px" } |
| 20 | +const ulStyle: CSSProperties = { margin: "0 0 8px", paddingLeft: "12px" } |
| 21 | +const accountIconStyle: CSSProperties = { fontSize: 11 } |
| 22 | +const hrStyle: CSSProperties = { |
| 23 | + height: "1px", |
| 24 | + background: getAsVar(VSC_DESCRIPTION_FOREGROUND), |
| 25 | + opacity: 0.1, |
| 26 | + margin: "8px 0", |
| 27 | +} |
| 28 | +const linkContainerStyle: CSSProperties = { margin: "0" } |
| 29 | +const linkStyle: CSSProperties = { display: "inline" } |
| 30 | + |
11 | 31 | /* |
12 | 32 | You must update the latestAnnouncementId in ClineProvider for new announcements to show to users. This new id will be compared with whats in state for the 'last announcement shown', and if it's different then the announcement will render. As soon as an announcement is shown, the id will be updated in state. This ensures that announcements are not shown more than once, even if the user doesn't close it themselves. |
13 | 33 | */ |
14 | 34 | const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => { |
15 | 35 | const minorVersion = version.split(".").slice(0, 2).join(".") // 2.0.0 -> 2.0 |
16 | 36 | return ( |
17 | | - <div |
18 | | - style={{ |
19 | | - backgroundColor: getAsVar(VSC_INACTIVE_SELECTION_BACKGROUND), |
20 | | - borderRadius: "3px", |
21 | | - padding: "12px 16px", |
22 | | - margin: "5px 15px 5px 15px", |
23 | | - position: "relative", |
24 | | - flexShrink: 0, |
25 | | - }}> |
26 | | - <VSCodeButton appearance="icon" onClick={hideAnnouncement} style={{ position: "absolute", top: "8px", right: "8px" }}> |
| 37 | + <div style={containerStyle}> |
| 38 | + <VSCodeButton appearance="icon" onClick={hideAnnouncement} style={closeIconStyle}> |
27 | 39 | <span className="codicon codicon-close"></span> |
28 | 40 | </VSCodeButton> |
29 | | - <h3 style={{ margin: "0 0 8px" }}> |
| 41 | + <h3 style={h3TitleStyle}> |
30 | 42 | 🎉{" "}New in v{minorVersion} |
31 | 43 | </h3> |
32 | | - <ul style={{ margin: "0 0 8px", paddingLeft: "12px" }}> |
| 44 | + <ul style={ulStyle}> |
33 | 45 | <li> |
34 | 46 | <b>Add to Cline:</b> Right-click selected text in any file or terminal to quickly add context to your current |
35 | 47 | task! Plus, when you see a lightbulb icon, select 'Fix with Cline' to have Cline fix errors in your code. |
36 | 48 | </li> |
37 | 49 | <li> |
38 | 50 | <b>Billing Dashboard:</b> Track your remaining credits and transaction history right in the extension with a{" "} |
39 | | - <span className="codicon codicon-account" style={{ fontSize: 11 }}></span> Cline account! |
| 51 | + <span className="codicon codicon-account" style={accountIconStyle}></span> Cline account! |
40 | 52 | </li> |
41 | 53 | <li> |
42 | 54 | <b>Faster Inference:</b> Cline/OpenRouter users can sort underlying providers used by throughput, price, and |
@@ -94,24 +106,17 @@ const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => { |
94 | 106 | environments) |
95 | 107 | </li> |
96 | 108 | </ul>*/} |
97 | | - <div |
98 | | - style={{ |
99 | | - height: "1px", |
100 | | - background: getAsVar(VSC_DESCRIPTION_FOREGROUND), |
101 | | - opacity: 0.1, |
102 | | - margin: "8px 0", |
103 | | - }} |
104 | | - /> |
105 | | - <p style={{ margin: "0" }}> |
| 109 | + <div style={hrStyle} /> |
| 110 | + <p style={linkContainerStyle}> |
106 | 111 | Join us on{" "} |
107 | | - <VSCodeLink style={{ display: "inline" }} href="https://x.com/cline"> |
| 112 | + <VSCodeLink style={linkStyle} href="https://x.com/cline"> |
108 | 113 | X, |
109 | 114 | </VSCodeLink>{" "} |
110 | | - <VSCodeLink style={{ display: "inline" }} href="https://discord.gg/cline"> |
| 115 | + <VSCodeLink style={linkStyle} href="https://discord.gg/cline"> |
111 | 116 | discord, |
112 | 117 | </VSCodeLink>{" "} |
113 | 118 | or{" "} |
114 | | - <VSCodeLink style={{ display: "inline" }} href="https://www.reddit.com/r/cline/"> |
| 119 | + <VSCodeLink style={linkStyle} href="https://www.reddit.com/r/cline/"> |
115 | 120 | r/cline |
116 | 121 | </VSCodeLink> |
117 | 122 | for more updates! |
|
0 commit comments