Skip to content

Commit 917433b

Browse files
committed
Introduce <GITPOD_FLEX_INTRODUCTION>
1 parent ea078be commit 917433b

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

components/dashboard/src/AppNotifications.tsx

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { useOrgBillingMode } from "./data/billing-mode/org-billing-mode-query";
2020
import { Organization } from "@gitpod/public-api/lib/gitpod/v1/organization_pb";
2121

2222
const KEY_APP_DISMISSED_NOTIFICATIONS = "gitpod-app-notifications-dismissed";
23-
const PRIVACY_POLICY_LAST_UPDATED = "2024-09-30";
23+
const PRIVACY_POLICY_LAST_UPDATED = "2023-12-20";
2424

2525
interface Notification {
2626
id: string;
@@ -52,6 +52,46 @@ const UPDATED_PRIVACY_POLICY = (updateUser: (user: Partial<UserProtocol>) => Pro
5252
});
5353
}
5454
},
55+
message: (
56+
<span className="text-md">
57+
We've updated our Privacy Policy. You can review it{" "}
58+
<a className="gp-link" href="https://www.gitpod.io/privacy" target="_blank" rel="noreferrer">
59+
here
60+
</a>
61+
.
62+
</span>
63+
),
64+
} as Notification;
65+
};
66+
67+
const GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY = "gitpod_flex_introduction";
68+
const GITPOD_FLEX_INTRODUCTION = (updateUser: (user: Partial<UserProtocol>) => Promise<User>) => {
69+
return {
70+
id: GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY,
71+
type: "info",
72+
preventDismiss: true,
73+
onClose: async () => {
74+
let dismissSuccess = false;
75+
try {
76+
const updatedUser = await updateUser({
77+
additionalData: {
78+
profile: {
79+
coachmarksDismissals: {
80+
[GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY]: new Date().toISOString(),
81+
},
82+
},
83+
},
84+
});
85+
dismissSuccess = !!updatedUser;
86+
} catch (err) {
87+
dismissSuccess = false;
88+
} finally {
89+
trackEvent("coachmark_dismissed", {
90+
name: "gitpod-flex-introduction",
91+
success: dismissSuccess,
92+
});
93+
}
94+
},
5595
message: (
5696
<span className="text-md">
5797
<b>Introducing Gitpod Flex:</b> self-host for free in 3 min, run locally using Gitpod Desktop and
@@ -115,6 +155,10 @@ export function AppNotifications() {
115155
notifications.push(notification);
116156
}
117157
}
158+
159+
if (isGitpodIo() && !user?.profile?.coachmarksDismissals[GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY]) {
160+
notifications.push(GITPOD_FLEX_INTRODUCTION((u: Partial<UserProtocol>) => mutateAsync(u)));
161+
}
118162
}
119163

120164
if (!ignore) {

components/dashboard/src/components/Alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const infoMap: Record<AlertType, AlertInfo> = {
6666
bgCls: "bg-gray-100 dark:bg-gray-700",
6767
txtCls: "text-gray-500 dark:text-gray-300",
6868
icon: <InfoSvg className="w-4 h-4"></InfoSvg>,
69-
iconColor: "text-gray-400",
69+
iconColor: "text-gray-400 dark:text-gray-300",
7070
},
7171
message: {
7272
bgCls: "bg-blue-50 dark:bg-blue-800",

0 commit comments

Comments
 (0)