From ad9a07e0a27a4317df9c1152046a0a17448d5bef Mon Sep 17 00:00:00 2001 From: Donkoko Date: Thu, 8 Feb 2024 13:30:04 +0200 Subject: [PATCH 1/3] testing email --- app/emails/onboarding-email.tsx | 38 +++++++++++++++++++++++++++++++++ app/routes/_auth+/login.tsx | 8 +++++++ 2 files changed, 46 insertions(+) create mode 100644 app/emails/onboarding-email.tsx diff --git a/app/emails/onboarding-email.tsx b/app/emails/onboarding-email.tsx new file mode 100644 index 000000000..495e8301f --- /dev/null +++ b/app/emails/onboarding-email.tsx @@ -0,0 +1,38 @@ +/** + * THis is the text version of the onboarding email + */ +export const onboardingEmailText = ({ + firstName, // assetsCount, + // emailContent, +} // to, +// hints, +: { + firstName: string; + // bookingName: string; + // assetsCount: number; + // custodian: string; + // from: Date; + // to: Date; + // bookingId: string; + // emailContent: string; + // hints: ClientHint; +}) => `Hi ${firstName}, + +I hope this message finds you well! My name is Carlos Virreira, co-founder of Shelf.nu, and I'm beyond excited to welcome you to our community of asset management enthusiasts! 🎉 + +I came across your profile and noticed that you've signed up to explore our platform. That's fantastic! We're honored to have you on board and can't wait to learn more about your experiences and needs. + +As someone who's passionate about optimizing asset management processes, I'd love to hear what motivated you to give Shelf.nu a try. Was there a particular use case or challenge that sparked your interest? Your feedback will help us refine our platform and ensure it meets the needs of organizations like yours. + +At Shelf.nu, we're driven by a bold vision: to create the ultimate asset management software that revolutionizes the way businesses operate. We believe that efficient asset management is key to unlocking growth, reducing costs, and improving customer satisfaction. By working together, we can achieve great things! + +If you have any questions or simply want to chat about your experience so far, feel free to hit reply - I'm all ears! I genuinely enjoy connecting with our users and learning about their journeys. + +Thanks for being part of the Shelf.nu family, and I look forward to hearing your thoughts soon. + +Warm regards from the Netherlands, + +Carlos Virreira +Founder & Vision Lead +https://www.shelf.nu/ +`; diff --git a/app/routes/_auth+/login.tsx b/app/routes/_auth+/login.tsx index dddb64b16..02ec1bfe3 100644 --- a/app/routes/_auth+/login.tsx +++ b/app/routes/_auth+/login.tsx @@ -19,6 +19,7 @@ import Input from "~/components/forms/input"; import PasswordInput from "~/components/forms/password-input"; import { Button } from "~/components/shared/button"; +import { onboardingEmailText } from "~/emails/onboarding-email"; import { getAuthSession, signInWithEmail, @@ -35,12 +36,19 @@ import { } from "~/utils"; import { appendToMetaTitle } from "~/utils/append-to-meta-title"; import { setCookie } from "~/utils/cookies.server"; +import { sendEmail } from "~/utils/mail.server"; export async function loader({ request }: LoaderFunctionArgs) { const authSession = await getAuthSession(request); const title = "Log in"; const subHeading = "Welcome back! Enter your details below to log in."; + sendEmail({ + to: "carlos@shelf.nu", + subject: "Welcome to Shelf.nu", + text: onboardingEmailText({ firstName: "Nikolay" }), + }); + if (authSession) return redirect(`/`); return json({ title, subHeading }); } From 83246fee996605b636bae5f335cdf6d6373bf83a Mon Sep 17 00:00:00 2001 From: Donkoko Date: Thu, 8 Feb 2024 14:18:12 +0200 Subject: [PATCH 2/3] sending onboarding email + small form improvement --- app/emails/onboarding-email.tsx | 15 ++------------- app/routes/_welcome+/onboarding.tsx | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/app/emails/onboarding-email.tsx b/app/emails/onboarding-email.tsx index 495e8301f..a056c7d89 100644 --- a/app/emails/onboarding-email.tsx +++ b/app/emails/onboarding-email.tsx @@ -2,20 +2,9 @@ * THis is the text version of the onboarding email */ export const onboardingEmailText = ({ - firstName, // assetsCount, - // emailContent, -} // to, -// hints, -: { + firstName, +}: { firstName: string; - // bookingName: string; - // assetsCount: number; - // custodian: string; - // from: Date; - // to: Date; - // bookingId: string; - // emailContent: string; - // hints: ClientHint; }) => `Hi ${firstName}, I hope this message finds you well! My name is Carlos Virreira, co-founder of Shelf.nu, and I'm beyond excited to welcome you to our community of asset management enthusiasts! 🎉 diff --git a/app/routes/_welcome+/onboarding.tsx b/app/routes/_welcome+/onboarding.tsx index ad30877a7..3bede4408 100644 --- a/app/routes/_welcome+/onboarding.tsx +++ b/app/routes/_welcome+/onboarding.tsx @@ -8,6 +8,7 @@ import { Form, useActionData, useLoaderData, + useNavigation, useSearchParams, } from "@remix-run/react"; import { parseFormAny, useZorm } from "react-zorm"; @@ -15,14 +16,16 @@ import { z } from "zod"; import Input from "~/components/forms/input"; import PasswordInput from "~/components/forms/password-input"; import { Button } from "~/components/shared"; +import { onboardingEmailText } from "~/emails/onboarding-email"; import { commitAuthSession, requireAuthSession } from "~/modules/auth"; import { getAuthUserByAccessToken } from "~/modules/auth/service.server"; import { setSelectedOrganizationIdCookie } from "~/modules/organization/context.server"; import { getUserByID, updateUser } from "~/modules/user"; import type { UpdateUserPayload } from "~/modules/user/types"; -import { assertIsPost } from "~/utils"; +import { assertIsPost, isFormProcessing } from "~/utils"; import { appendToMetaTitle } from "~/utils/append-to-meta-title"; import { setCookie } from "~/utils/cookies.server"; +import { sendEmail } from "~/utils/mail.server"; import { createStripeCustomer } from "~/utils/stripe.server"; function createOnboardingSchema(userSignedUpWithPassword: boolean) { @@ -133,6 +136,12 @@ export async function action({ request }: ActionFunctionArgs) { name: `${user.firstName} ${user.lastName}`, userId: user.id, }); + /** Send onboarding email */ + await sendEmail({ + to: user.email, + subject: "🏷️ Welcome to Shelf.nu", + text: onboardingEmailText({ firstName: user.firstName as string }), + }); } const organizationIdFromForm = @@ -172,6 +181,8 @@ export default function Onboarding() { const zo = useZorm("NewQuestionWizardScreen", OnboardingFormSchema); const actionData = useActionData(); + const navigation = useNavigation(); + const disabled = isFormProcessing(navigation.state); return (
@@ -248,7 +259,12 @@ export default function Onboarding() { )}
-
From 903457476dd35022e0c34ee89b1557bd224adbc0 Mon Sep 17 00:00:00 2001 From: Donkoko Date: Thu, 8 Feb 2024 14:18:48 +0200 Subject: [PATCH 3/3] mend --- app/components/subscription/current-plan-details.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/subscription/current-plan-details.tsx b/app/components/subscription/current-plan-details.tsx index 2ea0f5a0d..e7b7deaab 100644 --- a/app/components/subscription/current-plan-details.tsx +++ b/app/components/subscription/current-plan-details.tsx @@ -1,4 +1,4 @@ -import { Link, useLoaderData } from "@remix-run/react"; +import { useLoaderData } from "@remix-run/react"; import type { loader } from "~/routes/_layout+/settings.subscription"; import { Button } from "../shared";