diff --git a/README.md b/README.md index cc82f3c..649ef8d 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ To get started with Beacon, ensure you have the following prerequisites installe Clone the repository and install the dependencies: ```bash -git clone https://github.com/foundersandcoders/lift-frontend-v2.git -cd lift-frontend-v2 +git clone https://github.com/yourusername/beacon.git +cd beacon npm install ``` diff --git a/src/App.tsx b/src/App.tsx index 17897c2..effe8f2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -23,7 +23,11 @@ const AppContent: React.FC = () => { // MainPage and Header receives the username from context. <>
- { data.username ? () : () } + {data.username ? ( + + ) : ( + + )} ); }; diff --git a/src/api/resend/utils/emailSender.ts b/src/api/emailApi.ts similarity index 50% rename from src/api/resend/utils/emailSender.ts rename to src/api/emailApi.ts index 70b47b1..351a653 100644 --- a/src/api/resend/utils/emailSender.ts +++ b/src/api/emailApi.ts @@ -1,12 +1,15 @@ -import { Email } from "../../../../types/emails"; -import { Resend } from 'resend'; -const resendKey = import.meta.env.VITE_RESEND_KEY; -const resend = new Resend(resendKey); +const RESEND_KEY = import.meta.env.VITE_RESEND_KEY; +import { Resend } from "resend"; +import { Email } from "../../types/emails"; + +const resend = new Resend(RESEND_KEY); export async function sendEmail(email: Email) { try { const { data, error } = await resend.emails.send(email); - if (error) { throw new Error(error.message) }; + + if (error) throw new Error(error.message); + return data; } catch (error) { console.error("Error sending email:", error); diff --git a/src/api/resend/routes/sendTest.ts b/src/api/resend/routes/sendTest.ts deleted file mode 100644 index d7d1e9f..0000000 --- a/src/api/resend/routes/sendTest.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { EmailTest } from '../../../components/emails/TestEmail'; -import { Resend } from 'resend'; -const resendKey = import.meta.env.VITE_RESEND_KEY; -const resend = new Resend(resendKey); - -const facTeam= { - to: [ - "alex@foundersandcoders.com", - "dan@foundersandcoders.com", - "jason@foundersandcoders.com" - ], - names: "Alex, Dan & Jason" -} - -export async function POST() { - try { - const { data, error } = await resend.emails.send({ - from: ' ', - to: facTeam.to, - subject: "Our Very First Nudgemail", - react: EmailTest({ firstName: facTeam.names }), - }); - - if (error) { - return Response.json( { error }, { status: 500 } ) - } else { - return Response.json(data) - }; - } catch (error) { - return Response.json({ error }, { status: 500 }); - } -} \ No newline at end of file diff --git a/src/components/LoginPage.tsx b/src/components/LoginPage.tsx index 0f2f76c..bcbc042 100644 --- a/src/components/LoginPage.tsx +++ b/src/components/LoginPage.tsx @@ -39,12 +39,10 @@ const LoginPage: React.FC = ({ onSubmit }) => {

Welcome!

-

Please enter your name and, optionally, your line manager's email to continue.

-
{

Statement builder for {username}

-
- {/* Floating Buttons Container */}
{/* Email Button on the left */} diff --git a/src/components/ShareEmailModal.tsx b/src/components/ShareEmailModal.tsx index e422322..e835ca6 100644 --- a/src/components/ShareEmailModal.tsx +++ b/src/components/ShareEmailModal.tsx @@ -10,12 +10,10 @@ import { } from '../components/ui/dialog'; import { Button } from '../components/ui/button'; import { useEntries } from '../hooks/useEntries'; -import { POST } from '../api/resend/routes/sendTest'; const ShareEmailModal: React.FC<{ onClose: () => void }> = ({ onClose }) => { const { data } = useEntries(); const managerEmail = data.managerEmail; - // Only include public statements that are not resolved. const publicStatements = data.entries.filter( (entry) => entry.isPublic && !entry.isResolved @@ -27,49 +25,57 @@ const ShareEmailModal: React.FC<{ onClose: () => void }> = ({ onClose }) => { Sharing with: {managerEmail || 'No manager email set'} - Below are your public, unresolved statements and their pending actions: -
{publicStatements.length > 0 ? ( - publicStatements.map((entry) => (
-

{entry.input}

- {entry.actions && entry.actions.length > 0 && ( -
- {entry.actions - .filter((action) => !action.completed) - .map((action) => ( -
-

{action.action}

- {action.byDate && action.byDate.trim() !== '' && ( -

- Due: {action.byDate} -

- )} -
- ))} -
- )} -
)) + publicStatements.map((entry) => ( +
+

{entry.input}

+ {entry.actions && entry.actions.length > 0 && ( +
+ {entry.actions + .filter((action) => !action.completed) + .map((action) => ( +
+

{action.action}

+ {action.byDate && action.byDate.trim() !== '' && ( +

+ Due: {action.byDate} +

+ )} +
+ ))} +
+ )} +
+ )) ) : (

No public unresolved statements available.

)}
- - - + + diff --git a/src/components/emails/TestEmail.tsx b/src/components/emails/TestEmail.tsx deleted file mode 100644 index 53327c6..0000000 --- a/src/components/emails/TestEmail.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import * as React from 'react'; -import { EmailProps } from 'types/emails'; - -export const EmailTest: React.FC> = ({ - firstName, -}) => ( -
-

- BEACONS LIVES! -

- -

- Hello, {firstName}! - Thankyou for your service. Soon, I will have no further need of you. -

-
-); \ No newline at end of file diff --git a/types/emails.ts b/types/emails.ts index 2ff6607..f79bd30 100644 --- a/types/emails.ts +++ b/types/emails.ts @@ -1,10 +1,13 @@ export interface Email { - from: string, /* app email address */ - to: string[], /* array containing employer email */ - subject: string, /* derp */ - html: string /* email body */ -} + // app email address + from: string, -export interface EmailProps { - firstName: string; + // array containing employer email + to: string[], + + // derp + subject: string, + + // email body + html: string } \ No newline at end of file