From d956fbf79dbbd62b722fcc51cca298eae609cfbd Mon Sep 17 00:00:00 2001 From: andrewwallacespeckle <139135120+andrewwallacespeckle@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:10:21 +0100 Subject: [PATCH] refactor(fe2): Change workspace creation triggers (#3211) * Tasks from ticket * Update copy * Add confirm dialog to cancel button * Show Workspace create dialog when on explainer page * Reorder * Add new mixpanel event * Use 1 confirm modal --- .../components/common/ConfirmDialog.vue | 37 ++++++++ .../components/dashboard/Sidebar.vue | 43 +++++---- .../components/projects/AddDialog.vue | 88 +++++++++++++------ .../frontend-2/components/settings/Dialog.vue | 24 +++-- 4 files changed, 135 insertions(+), 57 deletions(-) create mode 100644 packages/frontend-2/components/common/ConfirmDialog.vue diff --git a/packages/frontend-2/components/common/ConfirmDialog.vue b/packages/frontend-2/components/common/ConfirmDialog.vue new file mode 100644 index 000000000..8011670ee --- /dev/null +++ b/packages/frontend-2/components/common/ConfirmDialog.vue @@ -0,0 +1,37 @@ + + + Discard changes? + {{ text }} + You have unsaved changes. Are you sure you want to leave? + + + diff --git a/packages/frontend-2/components/dashboard/Sidebar.vue b/packages/frontend-2/components/dashboard/Sidebar.vue index df3cc5423..1864b3e45 100644 --- a/packages/frontend-2/components/dashboard/Sidebar.vue +++ b/packages/frontend-2/components/dashboard/Sidebar.vue @@ -58,16 +58,10 @@ v-if="isWorkspacesEnabled" collapsible title="Workspaces" - :plus-click=" - isNotGuest - ? () => { - openWorkspaceCreateDialog() - } - : undefined - " + :plus-click="isNotGuest ? handlePlusClick : undefined" plus-text="Create workspace" > - + : [] ) -const openWorkspaceCreateDialog = () => { - showWorkspaceCreateDialog.value = true - mixpanel.track('Create Workspace Button Clicked', { - source: 'sidebar' - }) -} - onWorkspaceResult((result) => { if (result.data?.activeUser) { const workspaceIds = result.data.activeUser.workspaces.items.map( @@ -273,4 +261,29 @@ const openFeedbackDialog = () => { showFeedbackDialog.value = true isOpenMobile.value = false } + +const openWorkspaceCreateDialog = () => { + showWorkspaceCreateDialog.value = true + mixpanel.track('Create Workspace Button Clicked', { + source: 'sidebar' + }) +} + +const handlePlusClick = () => { + if (route.path === workspacesRoute) { + openWorkspaceCreateDialog() + } else { + mixpanel.track('Clicked Link to Workspace Explainer', { + source: 'sidebar' + }) + router.push(workspacesRoute) + } +} + +const handleIntroducingWorkspacesClick = () => { + isOpenMobile.value = false + mixpanel.track('Clicked Link to Workspace Explainer', { + source: 'sidebar' + }) +} diff --git a/packages/frontend-2/components/projects/AddDialog.vue b/packages/frontend-2/components/projects/AddDialog.vue index 935dfe4d0..50df3bb00 100644 --- a/packages/frontend-2/components/projects/AddDialog.vue +++ b/packages/frontend-2/components/projects/AddDialog.vue @@ -1,5 +1,11 @@ - + Create a new project @@ -28,7 +34,7 @@ - + Workspace @@ -39,31 +45,31 @@ disabled-item-tooltip="You dont have rights to create projects in this workspace" class="flex-1" /> - + + + - + New workspace - Workspace offers better project management and higher data security. + Workspaces offer better project management and higher data security. - +
{{ text }}
You have unsaved changes. Are you sure you want to leave?
Workspace
- Workspace offers better project management and higher data security. + Workspaces offer better project management and higher data security.