Skip to content

Commit

Permalink
refactor: revamped signup flow
Browse files Browse the repository at this point in the history
  • Loading branch information
BreadGenie committed Dec 18, 2024
1 parent d26510e commit 2217d78
Show file tree
Hide file tree
Showing 23 changed files with 614 additions and 140 deletions.
8 changes: 3 additions & 5 deletions dashboard/src2/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ const route = useRoute();
const team = getTeam();
const isHideSidebar = computed(() => {
// return false;
if (!session.user) return false;
return (
// using window.location.pathname as router is undefined initially
(window.location.pathname === '/dashboard/welcome' ||
route.name === 'Welcome') &&
session.user &&
team?.doc?.hide_sidebar === true
route.meta.hideSidebar || (session.user && team?.doc?.hide_sidebar === true)
);
});
Expand Down
8 changes: 6 additions & 2 deletions dashboard/src2/components/NavigationItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export default {
'Deploy Candidate'
].includes(routeName) ||
routeName.startsWith('Release Group Detail'),
disabled: !onboardingComplete || enforce2FA
condition: onboardingComplete,
disabled: enforce2FA
},
{
name: 'Servers',
Expand All @@ -101,7 +102,8 @@ export default {
isActive:
['New Server'].includes(routeName) ||
routeName.startsWith('Server'),
disabled: !onboardingComplete || enforce2FA
condition: onboardingComplete,
disabled: enforce2FA
},
{
name: 'Marketplace',
Expand All @@ -117,6 +119,8 @@ export default {
name: 'Dev Tools',
icon: () => h(Code),
route: '/devtools',
condition: onboardingComplete,
disabled: enforce2FA,
children: [
{
name: 'SQL Playground',
Expand Down
40 changes: 38 additions & 2 deletions dashboard/src2/components/OnboardingAppSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div
v-for="app in apps"
class="flex cursor-pointer flex-col gap-2.5 rounded-md border border-gray-300 p-4 transition duration-300 hover:border-gray-400"
@click.capture="() => openInstallAppPage(app.name)"
@click.capture="() => openInstallAppPage(app)"
>
<img :src="app.image" class="h-6 w-6" />
<div class="flex flex-col gap-1">
Expand Down Expand Up @@ -37,9 +37,45 @@ export default {
components: {
DownloadIcon
},
resources: {
// TODO: if only saas app use account_request
// TODO: handle the same for apps that aren't saas-ified (either make em all saas or handle case for it)
productTrialSignup() {
return {
url: 'press.api.product_trial.signup'
// onSuccess(account_request) {
// this.$router.push({
// name: 'SaaSSignupVerifyEmail',
// query: {
// email: this.email,
// account_request: account_request
// }
// });
// }
};
}
},
methods: {
openInstallAppPage(app) {
this.$router.push(`/install-app/${app}`);
this.$resources.productTrialSignup
.submit({
email: this.$team.doc.user_info.email,
first_name: this.$team.doc.user_info.first_name,
last_name: this.$team.doc.user_info.last_name,
country: this.$team.doc.country,
product: app.product_id,
terms_accepted: true
})
.then(account_request =>
this.$router.push({
name: 'SaaSSignupSetup',
params: { productId: app.product_id },
query: {
account_request: account_request
}
})
);
}
}
};
Expand Down
7 changes: 6 additions & 1 deletion dashboard/src2/components/auth/SaaSLoginBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
class="flex flex-col items-center"
@dblclick="redirectForFrappeioAuth"
>
<img class="inline-block h-12 w-12 rounded-md" :src="logo" />
<img
v-if="logo"
class="inline-block h-12 w-12 rounded-md"
:src="logo"
/>
<FCLogo v-else class="inline-block h-12 w-12" />
</div>
<!-- card -->
<div
Expand Down
82 changes: 0 additions & 82 deletions dashboard/src2/components/marketplace/ReviewMarketplaceApp.vue

This file was deleted.

8 changes: 4 additions & 4 deletions dashboard/src2/objects/common/patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ export function getPatchesTab(forBench: boolean) {
}
] satisfies FilterField[],
columns: getPatchesTabColumns(forBench),
primaryAction({ listResource: apps, documentResource: releaseGroup }) {
primaryAction({ listResource: apps, documentResource: doc }) {
return {
label: 'Apply Patch',
slots: {
prefix: icon('plus')
},
onClick() {
renderDialog(
h(PatchAppDialog, { group: releaseGroup.name, app: '' })
);
const group = doc.doctype === 'Bench' ? doc.doc.group : doc.name;

renderDialog(h(PatchAppDialog, { group: group, app: '' }));
}
};
},
Expand Down
8 changes: 8 additions & 0 deletions dashboard/src2/pages/InstallApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,14 @@ export default {
params: { app: this.app },
query: { siteGroupDeployName: doc.name }
});
} else if (doc.doctype === 'Product Trial Request') {
this.$router.push({
name: 'SaaSSignupSetup',
params: { productId: doc.product_trial },
query: {
account_request: doc.account_request
}
});
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src2/pages/LoginSignup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ export default {
onSuccess: res => {
let loginRoute = `/dashboard${res.dashboard_route || '/'}`;
if (this.$route.query.product) {
loginRoute = `/dashboard/app-trial/setup/${this.$route.query.product}`;
loginRoute = `/dashboard/start-center?product=${this.$route.query.product}`;
}
localStorage.setItem('login_email', this.email);
window.location.href = loginRoute;
Expand Down Expand Up @@ -582,7 +582,7 @@ export default {
return 'Sign in to your account';
} else {
if (this.saasProduct) {
return `Sign up to create ${this.saasProduct.title} site`;
return `Sign up to create a ${this.saasProduct.title} site`;
}
return 'Create a new account';
}
Expand Down
13 changes: 11 additions & 2 deletions dashboard/src2/pages/SetupAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,21 @@ export default {
oauth_signup: this.oauthSignup,
oauth_domain: this.oauthDomain
},
onSuccess() {
onSuccess(account_request) {
let path = '/dashboard';
if (this.saasProduct) {
path = `/dashboard/app-trial/setup/${this.saasProduct.name}`;
path = `/dashboard/create-site/${this.saasProduct}/setup?account_request=${account_request}`;
}
window.location.href = path;
// if (this.saasProduct) {
// this.$router.push({
// name: 'SaaSSignupSetup',
// params: { productId: this.saasProduct },
// query: {
// account_request: account_request
// }
// });
// } else this.$router.push({ name: 'Home' });
}
};
}
Expand Down
Loading

0 comments on commit 2217d78

Please sign in to comment.