Skip to content

Commit 6bc053e

Browse files
Add AWS re:Invent 2024 notification (#20323)
* feat: Add AWS re:Invent 2024 notification * Update copy
1 parent 9442b52 commit 6bc053e

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

components/dashboard/src/AppNotifications.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,61 @@ const INVALID_BILLING_ADDRESS = (stripePortalUrl: string | undefined) => {
131131
} as Notification;
132132
};
133133

134+
const GENERAL_NOTIFICATION = (
135+
id: string,
136+
message: JSX.Element,
137+
updateUser: (user: Partial<UserProtocol>) => Promise<User>,
138+
eventName: string = "general_notification",
139+
) => {
140+
return {
141+
id,
142+
type: "info",
143+
preventDismiss: true,
144+
onClose: async () => {
145+
let dismissSuccess = false;
146+
try {
147+
const updatedUser = await updateUser({
148+
additionalData: {
149+
profile: {
150+
coachmarksDismissals: {
151+
[id]: new Date().toISOString(),
152+
},
153+
},
154+
},
155+
});
156+
dismissSuccess = !!updatedUser;
157+
} catch (err) {
158+
dismissSuccess = false;
159+
} finally {
160+
trackEvent("coachmark_dismissed", {
161+
name: eventName,
162+
success: dismissSuccess,
163+
});
164+
}
165+
},
166+
message,
167+
} as Notification;
168+
};
169+
170+
const AWS_REINVENT_NOTIFICATION = (updateUser: (user: Partial<UserProtocol>) => Promise<User>) => {
171+
return GENERAL_NOTIFICATION(
172+
"aws_reinvent_2024",
173+
<span className="text-md">
174+
<b>See you at re:Invent!</b> Book a demo with us, and join our developer productivity leaders roundtable (limited tickets) |{" "}
175+
<a
176+
className="text-kumquat-ripe font-bold"
177+
href="https://www.gitpod.io/aws-reinvent-24"
178+
target="_blank"
179+
rel="noreferrer"
180+
>
181+
Learn more
182+
</a>
183+
</span>,
184+
updateUser,
185+
"aws_reinvent_notification",
186+
);
187+
};
188+
134189
export function AppNotifications() {
135190
const [topNotification, setTopNotification] = useState<Notification | undefined>(undefined);
136191
const { user, loading } = useUserLoader();
@@ -163,6 +218,10 @@ export function AppNotifications() {
163218
if (isGitpodIo() && !user?.profile?.coachmarksDismissals[GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY]) {
164219
notifications.push(GITPOD_FLEX_INTRODUCTION((u: Partial<UserProtocol>) => mutateAsync(u)));
165220
}
221+
222+
if (isGitpodIo() && !user?.profile?.coachmarksDismissals["aws_reinvent_2024"]) {
223+
notifications.push(AWS_REINVENT_NOTIFICATION((u: Partial<UserProtocol>) => mutateAsync(u)));
224+
}
166225
}
167226

168227
if (!ignore) {

0 commit comments

Comments
 (0)