Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/teams/onboarding/WelcomeMessagePreview.tsx
2506 views
1
/**
2
* Copyright (c) 2025 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { Button } from "@podkit/buttons/Button";
8
import { Heading1, Heading2, Heading3, Subheading } from "@podkit/typography/Headings";
9
import Markdown from "react-markdown";
10
import { useOrgSettingsQuery } from "../../data/organizations/org-settings-query";
11
import { gitpodWelcomeSubheading } from "./WelcomeMessageConfigurationField";
12
13
type Props = {
14
disabled?: boolean;
15
hideHeader?: boolean;
16
setWelcomeMessageEditorOpen?: (open: boolean) => void;
17
};
18
export const WelcomeMessagePreview = ({ disabled, setWelcomeMessageEditorOpen, hideHeader }: Props) => {
19
const { data: settings } = useOrgSettingsQuery();
20
const avatarUrl = settings?.onboardingSettings?.welcomeMessage?.featuredMemberResolvedAvatarUrl;
21
const welcomeMessage = settings?.onboardingSettings?.welcomeMessage?.message;
22
23
return (
24
<div className="max-w-2xl mx-auto">
25
<div className="flex justify-between gap-2 items-center">
26
{!hideHeader && <Heading2 className="py-6">Welcome to Gitpod</Heading2>}
27
{setWelcomeMessageEditorOpen && (
28
<Button variant="secondary" onClick={() => setWelcomeMessageEditorOpen(true)} disabled={disabled}>
29
Edit
30
</Button>
31
)}
32
</div>
33
<Subheading>{gitpodWelcomeSubheading}</Subheading>
34
{welcomeMessage && (
35
<article className="p-8 my-4 bg-pk-surface-secondary text-pk-content-primary rounded-xl flex flex-col gap-5 items-center justify-center">
36
{avatarUrl && <img src={avatarUrl} alt="" className="w-12 h-12 rounded-full" />}
37
<Markdown
38
className="space-y-4 text-center bg-pk-surface-secondary"
39
components={{
40
ul: ({ children }) => <ul className="list-disc list-inside">{children}</ul>,
41
ol: ({ children }) => <ol className="list-decimal list-inside">{children}</ol>,
42
img: ({ src, alt }) => <img src={src} alt={alt} className="w-full rounded-lg" />,
43
h1: ({ children }) => <Heading1 className="text-left text-2xl">{children}</Heading1>,
44
h2: ({ children }) => <Heading2 className="text-left text-xl">{children}</Heading2>,
45
h3: ({ children }) => <Heading3 className="text-left text-lg">{children}</Heading3>,
46
}}
47
>
48
{welcomeMessage}
49
</Markdown>
50
</article>
51
)}
52
</div>
53
);
54
};
55
56