-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Expand file tree
/
Copy pathAnnouncement.tsx
More file actions
106 lines (94 loc) · 3.22 KB
/
Announcement.tsx
File metadata and controls
106 lines (94 loc) · 3.22 KB
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
import { memo, type ReactNode, useState } from "react"
import { Trans } from "react-i18next"
import { SiDiscord, SiReddit, SiX } from "react-icons/si"
import { VSCodeLink } from "@vscode/webview-ui-toolkit/react"
import { Package } from "@roo/package"
import { useAppTranslation } from "@src/i18n/TranslationContext"
import { vscode } from "@src/utils/vscode"
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@src/components/ui"
interface AnnouncementProps {
hideAnnouncement: () => void
}
/**
* You must update the `latestAnnouncementId` in ClineProvider for new
* announcements to show to users. This new id will be compared with what's 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.
*/
const Announcement = ({ hideAnnouncement }: AnnouncementProps) => {
const { t } = useAppTranslation()
const [open, setOpen] = useState(true)
return (
<Dialog
open={open}
onOpenChange={(open) => {
setOpen(open)
if (!open) {
hideAnnouncement()
}
}}>
<DialogContent>
<DialogHeader>
<DialogTitle>{t("chat:announcement.title", { version: Package.version })}</DialogTitle>
</DialogHeader>
<div>
{/* Regular Release Highlights */}
<div className="mb-4">
<p className="mb-3">{t("chat:announcement.release.heading")}</p>
<ul className="list-disc list-inside text-sm space-y-1.5">
<li>{t("chat:announcement.release.gpt54")}</li>
<li>{t("chat:announcement.release.slashSkills")}</li>
</ul>
</div>
<div className="mt-4 text-sm text-center text-vscode-descriptionForeground">
<div className="flex items-center justify-center gap-4">
<SocialLink
icon={<SiX className="w-4 h-4" aria-hidden />}
label="X"
href="https://x.com/roocode"
/>
<SocialLink
icon={<SiDiscord className="w-4 h-4" aria-hidden />}
label="Discord"
href="https://discord.gg/rCQcvT7Fnt"
/>
<SocialLink
icon={<SiReddit className="w-4 h-4" aria-hidden />}
label="Reddit"
href="https://www.reddit.com/r/RooCode/"
/>
</div>
</div>
<div className="mt-3 text-sm text-center text-vscode-descriptionForeground">
<Trans i18nKey="chat:announcement.support" components={{ githubLink: <GitHubLink /> }} />
</div>
</div>
</DialogContent>
</Dialog>
)
}
const SocialLink = ({ icon, label, href }: { icon: ReactNode; label: string; href: string }) => (
<VSCodeLink
href={href}
className="inline-flex items-center gap-1"
onClick={(e) => {
e.preventDefault()
vscode.postMessage({ type: "openExternal", url: href })
}}>
{icon}
<span className="sr-only">{label}</span>
</VSCodeLink>
)
const GitHubLink = ({ children }: { children?: ReactNode }) => (
<VSCodeLink
href="https://github.com/RooCodeInc/Roo-Code"
onClick={(e) => {
e.preventDefault()
vscode.postMessage({ type: "openExternal", url: "https://github.com/RooCodeInc/Roo-Code" })
}}>
{children}
</VSCodeLink>
)
export default memo(Announcement)