Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App: ✨ Add description field to demo request form #2716

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/api/src/graphql/emails.sdl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const schema = gql`
name: String
subject: String
title: String
description: String
}

type EmailResponse {
Expand Down
5 changes: 4 additions & 1 deletion app/api/src/mail/DemoRequest/DemoRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@react-email/components';
import { Tailwind } from '@react-email/tailwind';

export function DemoRequest({ from, name, title, when }) {
export function DemoRequest({ description, from, name, title, when }) {
return (
<Html>
<Head />
Expand Down Expand Up @@ -55,6 +55,9 @@ export function DemoRequest({ from, name, title, when }) {
<Text className="text-base">
{`new demo request on ${when}`}
</Text>
<Text className="text-base">
{`Customer needs help with: ${description}`}
</Text>
</Row>
</Section>

Expand Down
4 changes: 2 additions & 2 deletions app/api/src/services/emails/emails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export const sendDemoRequest: QueryResolvers['sendDemoRequest'] = async ({
logger.debug(input, 'creating demo email ...');

try {
const { from, name, subject, title } = input;
const { description, from, name, subject, title } = input;
const to = defaultEmail;
const when = new Date().toLocaleString();

logger.debug({ ...input, to, when }, 'sending email ....');

const data: MailResult = await mailer.send(
DemoRequest({ from, name, title, when }),
DemoRequest({ description, from, name, title, when }),
{
from,
to,
Expand Down
1 change: 1 addition & 0 deletions app/api/types/graphql.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export type CreateUserInput = {
};

export type DemoEmailInput = {
description?: InputMaybe<Scalars['String']>;
from: Scalars['String'];
name?: InputMaybe<Scalars['String']>;
subject?: InputMaybe<Scalars['String']>;
Expand Down
28 changes: 21 additions & 7 deletions app/web/src/components/DemoDialog/DemoDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useLazyQuery } from '@apollo/client';

import {
Form,
TextAreaField,
TextField,
EmailField,
FieldError,
Expand Down Expand Up @@ -65,10 +66,10 @@ const DemoDialog = () => {
Name
</label>
<TextField
className="w-full rounded-lg border border-solid border-gray-300 p-[10px] font-bold shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] outline-none transition-all focus:translate-x-[3px] focus:translate-y-[3px] focus:shadow-none"
className="w-full border border-solid border-gray-300 p-[10px] font-bold shadow-default outline-none transition-all focus:translate-x-[3px] focus:translate-y-[3px] focus:shadow-none"
name="name"
placeholder="First Last"
errorClassName="w-full rounded-lg border border-solid border-red-500 p-[10px] font-bold outline-none"
errorClassName="w-full border border-solid border-red-500 p-[10px] font-bold outline-none"
validation={{ required: true }}
/>
<FieldError
Expand All @@ -84,9 +85,9 @@ const DemoDialog = () => {
Email
</label>
<EmailField
className="w-full rounded-lg border border-solid border-gray-300 p-[10px] font-bold shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] outline-none transition-all focus:translate-x-[3px] focus:translate-y-[3px] focus:shadow-none"
className="w-full border border-solid border-gray-300 p-[10px] font-bold shadow-default outline-none transition-all focus:translate-x-[3px] focus:translate-y-[3px] focus:shadow-none"
name="email"
errorClassName="w-full rounded-lg border border-solid border-red-500 p-[10px] font-bold outline-none"
errorClassName="w-full border border-solid border-red-500 p-[10px] font-bold outline-none"
validation={{ required: true }}
/>
<FieldError
Expand All @@ -102,24 +103,37 @@ const DemoDialog = () => {
Job Title
</label>
<TextField
className="w-full rounded-lg border border-solid border-gray-300 p-[10px] font-bold shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] outline-none transition-all focus:translate-x-[3px] focus:translate-y-[3px] focus:shadow-none"
className="w-full border border-solid border-gray-300 p-[10px] font-bold shadow-default outline-none transition-all focus:translate-x-[3px] focus:translate-y-[3px] focus:shadow-none"
name="title"
errorClassName="w-full rounded-lg border border-solid border-red-500 p-[10px] font-bold outline-none"
errorClassName="w-full border border-solid border-red-500 p-[10px] font-bold outline-none"
validation={{ required: true }}
/>
<FieldError
className="pl-2 text-xs italic text-red-500"
name="title"
/>
</div>
<div className="mb-4">
<label
className="mb-1 block text-md font-bold text-gray-800"
htmlFor="description"
>
How can we help you? What are your goals?
</label>
<TextAreaField
className="w-full border border-solid border-gray-300 p-[10px] font-bold shadow-default outline-none transition-all focus:translate-x-[3px] focus:translate-y-[3px] focus:shadow-none"
name="description"
/>

</div>
<div className="flex justify-center">
<button
className="text-primary-foreground hover:bg-primary/80 mr-2 mt-2 flex cursor-pointer items-center justify-center rounded-md border-2 border-black bg-white px-10 py-3 font-bold shadow-default transition-all hover:translate-x-[3px] hover:translate-y-[3px] hover:shadow-none"
onClick={closeDialog}
>
Cancel
</button>
<Submit className="bg-primary text-primary-foreground hover:bg-primary/80 mt-2 flex cursor-pointer items-center justify-center rounded-md border-2 border-black bg-[#bc95d4] px-10 py-3 font-bold shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] transition-all hover:translate-x-[3px] hover:translate-y-[3px] hover:shadow-none">
<Submit className="bg-primary text-primary-foreground hover:bg-primary/80 mt-2 flex cursor-pointer items-center justify-center rounded-md border-2 border-black bg-[#bc95d4] px-10 py-3 font-bold shadow-default transition-all hover:translate-x-[3px] hover:translate-y-[3px] hover:shadow-none">
Submit Info
</Submit>
</div>
Expand Down