From 948e27f36b3b3431b408458b115f61774a0c709c Mon Sep 17 00:00:00 2001 From: mustard Date: Tue, 24 May 2022 15:47:43 +0000 Subject: [PATCH] [dashboard] add modal_dismiss tracking event --- components/dashboard/src/Setup.tsx | 1 + components/dashboard/src/components/Modal.tsx | 28 ++++++++++++--- .../src/feedback-form/FeedbackModal.tsx | 1 + .../src/projects/ProjectVariables.tsx | 1 + .../src/settings/EnvironmentVariables.tsx | 1 + .../dashboard/src/settings/Integrations.tsx | 2 ++ components/dashboard/src/settings/Plans.tsx | 4 +++ .../src/settings/SelectAccountModal.tsx | 1 + .../dashboard/src/settings/SelectIDE.tsx | 2 +- .../dashboard/src/settings/SelectIDEModal.tsx | 34 +++++++++---------- components/dashboard/src/settings/Teams.tsx | 6 +++- .../dashboard/src/start/CreateWorkspace.tsx | 2 ++ components/dashboard/src/teams/Members.tsx | 1 + .../dashboard/src/whatsnew/WhatsNew.tsx | 1 + .../src/workspaces/ConnectToSSHModal.tsx | 1 + .../src/workspaces/StartWorkspaceModal.tsx | 1 + .../src/workspaces/WorkspaceEntry.tsx | 1 + 17 files changed, 65 insertions(+), 23 deletions(-) diff --git a/components/dashboard/src/Setup.tsx b/components/dashboard/src/Setup.tsx index f4f455d5f5bffc..3bb39c430fedcb 100644 --- a/components/dashboard/src/Setup.tsx +++ b/components/dashboard/src/Setup.tsx @@ -38,6 +38,7 @@ export default function Setup() { return (
{!showModal && ( + // TODO: Use title and buttons props {}} closeable={false}>

Welcome to Gitpod 🎉

diff --git a/components/dashboard/src/components/Modal.tsx b/components/dashboard/src/components/Modal.tsx index 671caacffbb645..70484bfcb2d0d0 100644 --- a/components/dashboard/src/components/Modal.tsx +++ b/components/dashboard/src/components/Modal.tsx @@ -5,8 +5,13 @@ */ import { useEffect } from "react"; +import { getGitpodService } from "../service/service"; + +type CloseModalManner = "esc" | "enter" | "x"; export default function Modal(props: { + // specify a key if having the same title and window.location + specify?: string; title?: string; buttons?: React.ReactChild[] | React.ReactChild; children: React.ReactChild[] | React.ReactChild; @@ -16,20 +21,35 @@ export default function Modal(props: { onClose: () => void; onEnter?: () => boolean; }) { + const closeModal = (manner: CloseModalManner) => { + props.onClose(); + getGitpodService() + .server.trackEvent({ + event: "modal_dismiss", + properties: { + manner, + title: props.title, + specify: props.specify, + path: window.location.pathname, + }, + }) + .then() + .catch(console.error); + }; const handler = (evt: KeyboardEvent) => { if (evt.defaultPrevented) { return; } if (evt.key === "Escape") { - props.onClose(); + closeModal("esc"); } if (evt.key === "Enter") { if (props.onEnter) { if (props.onEnter()) { - props.onClose(); + closeModal("enter"); } } else { - props.onClose(); + closeModal("enter"); } } }; @@ -60,7 +80,7 @@ export default function Modal(props: { {props.closeable !== false && (
closeModal("x")} > diff --git a/components/dashboard/src/feedback-form/FeedbackModal.tsx b/components/dashboard/src/feedback-form/FeedbackModal.tsx index c33a4a00849a6b..5aa8575f1c9a58 100644 --- a/components/dashboard/src/feedback-form/FeedbackModal.tsx +++ b/components/dashboard/src/feedback-form/FeedbackModal.tsx @@ -13,6 +13,7 @@ function FeedbackFormModal(props: { onClose: () => void }) { }; return ( + // TODO: Use title and buttons props void }) { }; return ( + // TODO: Use title and buttons props

{isNew ? "New" : "Edit"} Variable

diff --git a/components/dashboard/src/settings/Integrations.tsx b/components/dashboard/src/settings/Integrations.tsx index 300daecafcec33..099e7340c7ebff 100644 --- a/components/dashboard/src/settings/Integrations.tsx +++ b/components/dashboard/src/settings/Integrations.tsx @@ -294,6 +294,7 @@ function GitProviders() { )} {editModal && ( + // TODO: Use title and buttons props setEditModal(undefined)}>

Edit Permissions

@@ -744,6 +745,7 @@ export function GitIntegrationModal( }; return ( + // TODO: Use title and buttons props

{mode === "new" ? "New Git Integration" : "Git Integration"}

diff --git a/components/dashboard/src/settings/Plans.tsx b/components/dashboard/src/settings/Plans.tsx index 281d777cbb1698..6be4a0e5b9d393 100644 --- a/components/dashboard/src/settings/Plans.tsx +++ b/components/dashboard/src/settings/Plans.tsx @@ -727,6 +727,7 @@ export default function () { {!!confirmUpgradeToPlan && ( + // TODO: Use title and buttons props setConfirmUpgradeToPlan(undefined)}>

Upgrade to {confirmUpgradeToPlan.name}

@@ -755,6 +756,7 @@ export default function () { )} {!!confirmDowngradeToPlan && ( + // TODO: Use title and buttons props setConfirmDowngradeToPlan(undefined)}>

Downgrade to {confirmDowngradeToPlan.name}

@@ -784,6 +786,7 @@ export default function () { )} {isConfirmCancelDowngrade && ( + // TODO: Use title and buttons props setIsConfirmCancelDowngrade(false)}>

Cancel downgrade and stay with {currentPlan.name}

@@ -800,6 +803,7 @@ export default function () { )} {!!teamClaimModal && ( + // TODO: Use title and buttons props setTeamClaimModal(undefined)}>

Team Invitation

diff --git a/components/dashboard/src/settings/SelectAccountModal.tsx b/components/dashboard/src/settings/SelectAccountModal.tsx index 48a36b48ef22e6..458f0a1213d780 100644 --- a/components/dashboard/src/settings/SelectAccountModal.tsx +++ b/components/dashboard/src/settings/SelectAccountModal.tsx @@ -45,6 +45,7 @@ export function SelectAccountModal( }; return ( + // TODO: Use title and buttons props

Select Account

diff --git a/components/dashboard/src/settings/SelectIDE.tsx b/components/dashboard/src/settings/SelectIDE.tsx index 9d227eecc64668..247468cae7a34c 100644 --- a/components/dashboard/src/settings/SelectIDE.tsx +++ b/components/dashboard/src/settings/SelectIDE.tsx @@ -109,7 +109,7 @@ export default function SelectIDE(props: SelectIDEProps) { )} -

+

The JetBrains desktop IDEs are currently in beta.{" "} -

Select Editor

-
-

- Choose the editor for opening workspaces. You can always change later the editor in{" "} - - user preferences - - . -

- -
-
- -
+ Continue} + > +

+ Choose the editor for opening workspaces. You can always change later the editor in{" "} + + user preferences + + . +

+
); } diff --git a/components/dashboard/src/settings/Teams.tsx b/components/dashboard/src/settings/Teams.tsx index 378adb74d292f5..d5e711d6e4735f 100644 --- a/components/dashboard/src/settings/Teams.tsx +++ b/components/dashboard/src/settings/Teams.tsx @@ -514,7 +514,7 @@ function AllTeams() {
Learn more @@ -649,6 +649,7 @@ function InviteMembersModal(props: { sub: TeamSubscription; onClose: () => void }; return ( + // TODO: Use title and buttons props

Invite Members

@@ -707,6 +708,7 @@ function AddMembersModal(props: { }; return ( + // TODO: Use title and buttons props

Add Members

@@ -772,6 +774,7 @@ function NewTeamModal(props: { }; return ( + // TODO: Use title and buttons props

New Team Plan

@@ -851,6 +854,7 @@ function ManageTeamModal(props: { slots: Slot[]; slotInputHandler: SlotInputHand }, [props.slots]); return ( + // TODO: Use title and buttons props

Manage Team

diff --git a/components/dashboard/src/start/CreateWorkspace.tsx b/components/dashboard/src/start/CreateWorkspace.tsx index 63bcac75a0c4a0..4221d6bfa0ade2 100644 --- a/components/dashboard/src/start/CreateWorkspace.tsx +++ b/components/dashboard/src/start/CreateWorkspace.tsx @@ -202,6 +202,7 @@ export default class CreateWorkspace extends React.Component; } else if (result?.existingWorkspaces) { statusMessage = ( + // TODO: Use title and buttons props {}}>

Running Workspaces

@@ -294,6 +295,7 @@ export default class CreateWorkspace extends React.Component {}}>

Limit Reached diff --git a/components/dashboard/src/teams/Members.tsx b/components/dashboard/src/teams/Members.tsx index 9f012b93720f45..4510d546a2dea2 100644 --- a/components/dashboard/src/teams/Members.tsx +++ b/components/dashboard/src/teams/Members.tsx @@ -273,6 +273,7 @@ export default function () {

{genericInvite && showInviteModal && ( + // TODO: Use title and buttons props setShowInviteModal(false)}>

Invite Members

diff --git a/components/dashboard/src/whatsnew/WhatsNew.tsx b/components/dashboard/src/whatsnew/WhatsNew.tsx index 9ac61f18b68d5c..4967b8aa088f51 100644 --- a/components/dashboard/src/whatsnew/WhatsNew.tsx +++ b/components/dashboard/src/whatsnew/WhatsNew.tsx @@ -68,6 +68,7 @@ export function WhatsNew(props: { onClose: () => void }) { }; return ( + // TODO: Use title and buttons props

What's New 🎁

<>{visibleEntry && user ? visibleEntry.children(user, setUser) : <>} diff --git a/components/dashboard/src/workspaces/ConnectToSSHModal.tsx b/components/dashboard/src/workspaces/ConnectToSSHModal.tsx index 443da0df17ee9e..795fede929dde2 100644 --- a/components/dashboard/src/workspaces/ConnectToSSHModal.tsx +++ b/components/dashboard/src/workspaces/ConnectToSSHModal.tsx @@ -99,6 +99,7 @@ export default function ConnectToSSHModal(props: { onClose: () => void; }) { return ( + // TODO: Use title and buttons props

Connect via SSH

diff --git a/components/dashboard/src/workspaces/StartWorkspaceModal.tsx b/components/dashboard/src/workspaces/StartWorkspaceModal.tsx index b9b30415713450..bae3b288159a1e 100644 --- a/components/dashboard/src/workspaces/StartWorkspaceModal.tsx +++ b/components/dashboard/src/workspaces/StartWorkspaceModal.tsx @@ -20,6 +20,7 @@ export function StartWorkspaceModal() { }, [location]); return ( + // TODO: Use title and buttons props setIsStartWorkspaceModalVisible(false)} onEnter={() => false} diff --git a/components/dashboard/src/workspaces/WorkspaceEntry.tsx b/components/dashboard/src/workspaces/WorkspaceEntry.tsx index f0522e34b0a11e..e45f9b62f7cb7c 100644 --- a/components/dashboard/src/workspaces/WorkspaceEntry.tsx +++ b/components/dashboard/src/workspaces/WorkspaceEntry.tsx @@ -207,6 +207,7 @@ export function WorkspaceEntry({ desc, model, isAdmin, stopWorkspace }: Props) { onConfirm={() => model.deleteWorkspace(ws.id)} /> )} + {/* TODO: Use title and buttons props */} setRenameModalVisible(false)}