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