From 24ae79345ba180d81a3fd35919475c0c5ee9fda6 Mon Sep 17 00:00:00 2001 From: Jeremy Wharton Date: Tue, 17 Oct 2023 03:34:07 -0500 Subject: [PATCH] web/satellite{/vuetify-poc}: show upgrade dialog when trying to invite This change displays a dialog prompting free tier users to upgrade when the button to invite project members is clicked. Also, the Create New Project dialog in the Vuetify UI now opens the upgrade dialog when its Upgrade button is clicked. Change-Id: I6e233bd15fd14a486a3e9008bbc6fba3e669d67e --- .../components/modals/AddTeamMemberModal.vue | 41 ++++- .../src/components/BrowserTableComponent.vue | 2 +- .../dialogs/AddTeamMemberDialog.vue | 147 ++++++++++++------ .../dialogs/CreateProjectDialog.vue | 34 +++- .../components/dialogs/DeleteAccessDialog.vue | 2 +- .../dialogs/GeographicDistributionDialog.vue | 2 +- .../dialogs/ManagePassphraseDialog.vue | 2 +- .../src/components/dialogs/ShareDialog.vue | 2 +- .../UpgradeAccountDialog.vue | 18 ++- .../src/layouts/default/Account.vue | 4 +- .../src/layouts/default/AllProjects.vue | 6 +- .../src/layouts/default/Default.vue | 2 +- .../vuetify-poc/src/styles/styles.scss | 6 +- 13 files changed, 191 insertions(+), 77 deletions(-) diff --git a/web/satellite/src/components/modals/AddTeamMemberModal.vue b/web/satellite/src/components/modals/AddTeamMemberModal.vue index caf517f35..b332487a5 100644 --- a/web/satellite/src/components/modals/AddTeamMemberModal.vue +++ b/web/satellite/src/components/modals/AddTeamMemberModal.vue @@ -7,14 +7,22 @@ @@ -60,12 +72,14 @@ import { useAppStore } from '@/store/modules/appStore'; import { useProjectsStore } from '@/store/modules/projectsStore'; import { useAnalyticsStore } from '@/store/modules/analyticsStore'; import { useLoading } from '@/composables/useLoading'; +import { MODALS } from '@/utils/constants/appStatePopUps'; import VButton from '@/components/common/VButton.vue'; import VModal from '@/components/common/VModal.vue'; import VInput from '@/components/common/VInput.vue'; import TeamMembersIcon from '@/../static/images/team/teamMembers.svg'; +import ArrowIcon from '@/../static/images/onboardingTour/arrowRight.svg'; const analyticsStore = useAnalyticsStore(); const appStore = useAppStore(); @@ -84,6 +98,7 @@ const email = ref(''); * or a message describing the validation error. */ const formError = computed(() => { + if (!isPaidTier.value) return false; if (!email.value) return true; if (email.value.toLocaleLowerCase() === usersStore.state.user.email.toLowerCase()) { return `You can't add yourself to the project.`; @@ -95,9 +110,21 @@ const formError = computed(() => { }); /** - * Tries to add the user with the input email to the current project. + * Returns user's paid tier status from store. */ -async function onInviteClick(): Promise { +const isPaidTier = computed(() => { + return usersStore.state.user.paidTier; +}); + +/** + * Handles primary button click. + */ +async function onPrimaryClick(): Promise { + if (!isPaidTier.value) { + appStore.updateActiveModal(MODALS.upgradeAccount); + return; + } + await withLoading(async () => { try { await pmStore.inviteMember(email.value, projectsStore.state.selectedProject.id); diff --git a/web/satellite/vuetify-poc/src/components/BrowserTableComponent.vue b/web/satellite/vuetify-poc/src/components/BrowserTableComponent.vue index c6bf5f77a..b9778c0fc 100644 --- a/web/satellite/vuetify-poc/src/components/BrowserTableComponent.vue +++ b/web/satellite/vuetify-poc/src/components/BrowserTableComponent.vue @@ -37,7 +37,7 @@ @update:itemsPerPage="onLimitChange" >