Skip to content

Commit 96dcc25

Browse files
Updated App notification (#20254)
* New App notification * Introduce `<GITPOD_FLEX_INTRODUCTION>` * Update Copy for App Notification --------- Co-authored-by: Filip Troníček <[email protected]>
1 parent d069ce1 commit 96dcc25

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

components/dashboard/src/AppNotifications.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,50 @@ const UPDATED_PRIVACY_POLICY = (updateUser: (user: Partial<UserProtocol>) => Pro
6464
} as Notification;
6565
};
6666

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+
},
95+
message: (
96+
<span className="text-md">
97+
<b>Introducing Gitpod Flex:</b> self-host for free in 3 min or run locally using Gitpod Desktop |{" "}
98+
<a
99+
className="text-kumquat-ripe font-bold"
100+
href="https://app.gitpod.io"
101+
target="_blank"
102+
rel="noreferrer"
103+
>
104+
Try now
105+
</a>
106+
</span>
107+
),
108+
} as Notification;
109+
};
110+
67111
const INVALID_BILLING_ADDRESS = (stripePortalUrl: string | undefined) => {
68112
return {
69113
id: "invalid-billing-address",
@@ -115,6 +159,10 @@ export function AppNotifications() {
115159
notifications.push(notification);
116160
}
117161
}
162+
163+
if (isGitpodIo() && !user?.profile?.coachmarksDismissals[GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY]) {
164+
notifications.push(GITPOD_FLEX_INTRODUCTION((u: Partial<UserProtocol>) => mutateAsync(u)));
165+
}
118166
}
119167

120168
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)