Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: show only 1 onboarding type at a time

thecodrrd55ce4585d05
diff --git a/apps/web/src/app-effects.js b/apps/web/src/app-effects.js
index dab6aae7f..796613b59 100644
--- a/apps/web/src/app-effects.js
+++ b/apps/web/src/app-effects.js
@@ -68,7 +68,6 @@ export default function AppEffects({ setShow }) {
(async function () {
await updateLastSynced();
if (await initUser()) {
- showOnboardingDialog("new");
showUpgradeReminderDialogs();
await sync();
}
diff --git a/apps/web/src/components/dialogs/onboarding-dialog.js b/apps/web/src/components/dialogs/onboarding-dialog.js
index afdcd955c..9eb2d1593 100644
--- a/apps/web/src/components/dialogs/onboarding-dialog.js
+++ b/apps/web/src/components/dialogs/onboarding-dialog.js
@@ -19,6 +19,7 @@ import { usePersistentState } from "../../utils/hooks";
import accents from "../../theme/accents";
import AccentItem from "../accent-item";
import { useCallback, useState } from "react";
+import Config from "../../utils/config";
const newUserSteps = [
{
@@ -78,7 +79,6 @@ const trialUserSteps = [
subtitle: "You 14-day free trial has been activated.",
buttonText: "Start taking notes",
image: <WorkAnywhere width={160} />,
- component: AccentSelector,
},
];
@@ -93,9 +93,9 @@ function OnboardingDialog({ onClose: _onClose, type }) {
const steps = onboarding[type];
const onClose = useCallback(() => {
- setStep(steps.length);
+ Config.set(type, steps.length);
_onClose();
- }, [_onClose, setStep, steps.length]);
+ }, [_onClose, type, steps]);
if (!steps || !steps[step]) return null;
const {
@@ -119,8 +119,9 @@ function OnboardingDialog({ onClose: _onClose, type }) {
{Component && <Component onClose={onClose} />}
{buttonText && (
<Button
- sx={{ borderRadius: 50, px: 30, mb: 4 }}
+ sx={{ borderRadius: 50, px: 30, mb: 4, mt: Component ? 0 : 4 }}
onClick={() => {
+ console.log(step, steps.length);
if (step === steps.length - 1) onClose();
else setStep((s) => ++s);
}}
diff --git a/apps/web/src/stores/user-store.js b/apps/web/src/stores/user-store.js
index 59a533b5f..f93c320e2 100644
--- a/apps/web/src/stores/user-store.js
+++ b/apps/web/src/stores/user-store.js
@@ -88,6 +88,14 @@ class UserStore extends BaseStore {
await db.connectSSE();
}
});
+
+ await showOnboardingDialog(
+ user?.subscription?.type === SUBSCRIPTION_STATUS.TRIAL
+ ? "trial"
+ : isUserPremium()
+ ? "pro"
+ : "new"
+ );
return true;
});
};