Skip to content

Commit 987feac

Browse files
Merge pull request #8 from foundersandcoders/revert-5-send-email
Revert "Boilerplate to send an email"
2 parents 7237379 + e71a5b3 commit 987feac

File tree

9 files changed

+63
-100
lines changed

9 files changed

+63
-100
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ To get started with Beacon, ensure you have the following prerequisites installe
2929
Clone the repository and install the dependencies:
3030

3131
```bash
32-
git clone https://github.com/foundersandcoders/lift-frontend-v2.git
33-
cd lift-frontend-v2
32+
git clone https://github.com/yourusername/beacon.git
33+
cd beacon
3434
npm install
3535
```
3636

src/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ const AppContent: React.FC = () => {
2323
// MainPage and Header receives the username from context.
2424
<>
2525
<Header />
26-
{ data.username ? (<MainPage />) : (<LoginPage onSubmit={handleLoginSubmit} />) }
26+
{data.username ? (
27+
<MainPage />
28+
) : (
29+
<LoginPage onSubmit={handleLoginSubmit} />
30+
)}
2731
</>
2832
);
2933
};
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import { Email } from "../../../../types/emails";
2-
import { Resend } from 'resend';
3-
const resendKey = import.meta.env.VITE_RESEND_KEY;
4-
const resend = new Resend(resendKey);
1+
const RESEND_KEY = import.meta.env.VITE_RESEND_KEY;
2+
import { Resend } from "resend";
3+
import { Email } from "../../types/emails";
4+
5+
const resend = new Resend(RESEND_KEY);
56

67
export async function sendEmail(email: Email) {
78
try {
89
const { data, error } = await resend.emails.send(email);
9-
if (error) { throw new Error(error.message) };
10+
11+
if (error) throw new Error(error.message);
12+
1013
return data;
1114
} catch (error) {
1215
console.error("Error sending email:", error);

src/api/resend/routes/sendTest.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/components/LoginPage.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ const LoginPage: React.FC<LoginPageProps> = ({ onSubmit }) => {
3939
<div className='min-h-screen flex items-center justify-center p-4 bg-gray-50'>
4040
<div className='bg-white shadow-lg rounded-lg p-8 max-w-md w-full'>
4141
<h1 className='text-3xl font-bold mb-6 text-center'>Welcome!</h1>
42-
4342
<p className='mb-6 text-center text-gray-700'>
4443
Please enter your name and, optionally, your line manager's email to
4544
continue.
4645
</p>
47-
4846
<form onSubmit={handleSubmit} className='space-y-4'>
4947
<Input
5048
placeholder='Enter your name'

src/components/MainPage.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ const MainPage: React.FC = () => {
2929
<h1 className='text-3xl font-bold mb-8 text-center'>
3030
Statement builder for {username}
3131
</h1>
32-
3332
<div className='container mx-auto px-4'>
3433
<StatementList username={username} />
3534
</div>
36-
3735
{/* Floating Buttons Container */}
3836
<div className='fixed bottom-8 right-8 flex items-center space-x-4'>
3937
{/* Email Button on the left */}

src/components/ShareEmailModal.tsx

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ import {
1010
} from '../components/ui/dialog';
1111
import { Button } from '../components/ui/button';
1212
import { useEntries } from '../hooks/useEntries';
13-
import { POST } from '../api/resend/routes/sendTest';
1413

1514
const ShareEmailModal: React.FC<{ onClose: () => void }> = ({ onClose }) => {
1615
const { data } = useEntries();
1716
const managerEmail = data.managerEmail;
18-
1917
// Only include public statements that are not resolved.
2018
const publicStatements = data.entries.filter(
2119
(entry) => entry.isPublic && !entry.isResolved
@@ -27,49 +25,57 @@ const ShareEmailModal: React.FC<{ onClose: () => void }> = ({ onClose }) => {
2725
<DialogTitle className='text-lg font-bold'>
2826
Sharing with: {managerEmail || 'No manager email set'}
2927
</DialogTitle>
30-
3128
<DialogDescription className='mt-2'>
3229
Below are your public, unresolved statements and their pending
3330
actions:
3431
</DialogDescription>
35-
3632
<div className='mt-4 space-y-4'>
3733
{publicStatements.length > 0 ? (
38-
publicStatements.map((entry) => (<div
39-
key={entry.id}
40-
className='p-4 border rounded bg-white shadow-sm'
41-
>
42-
<p className='text-base font-semibold'>{entry.input}</p>
43-
{entry.actions && entry.actions.length > 0 && (
44-
<div className='mt-2 space-y-2'>
45-
{entry.actions
46-
.filter((action) => !action.completed)
47-
.map((action) => (
48-
<div
49-
key={action.id}
50-
className='pl-4 border-l-2 border-gray-300'
51-
>
52-
<p className='text-sm'>{action.action}</p>
53-
{action.byDate && action.byDate.trim() !== '' && (
54-
<p className='text-xs text-gray-500'>
55-
Due: {action.byDate}
56-
</p>
57-
)}
58-
</div>
59-
))}
60-
</div>
61-
)}
62-
</div>))
34+
publicStatements.map((entry) => (
35+
<div
36+
key={entry.id}
37+
className='p-4 border rounded bg-white shadow-sm'
38+
>
39+
<p className='text-base font-semibold'>{entry.input}</p>
40+
{entry.actions && entry.actions.length > 0 && (
41+
<div className='mt-2 space-y-2'>
42+
{entry.actions
43+
.filter((action) => !action.completed)
44+
.map((action) => (
45+
<div
46+
key={action.id}
47+
className='pl-4 border-l-2 border-gray-300'
48+
>
49+
<p className='text-sm'>{action.action}</p>
50+
{action.byDate && action.byDate.trim() !== '' && (
51+
<p className='text-xs text-gray-500'>
52+
Due: {action.byDate}
53+
</p>
54+
)}
55+
</div>
56+
))}
57+
</div>
58+
)}
59+
</div>
60+
))
6361
) : (
6462
<p className='text-gray-600'>
6563
No public unresolved statements available.
6664
</p>
6765
)}
6866
</div>
69-
7067
<DialogFooter className='mt-4 flex justify-end space-x-4'>
71-
<Button variant='pink' onClick={() => { POST() }}> Send </Button>
72-
<Button variant='pink' onClick={onClose}> Close </Button>
68+
<Button
69+
variant='pink'
70+
onClick={() => {
71+
/* placeholder for Send */
72+
}}
73+
>
74+
Send
75+
</Button>
76+
<Button variant='pink' onClick={onClose}>
77+
Close
78+
</Button>
7379
</DialogFooter>
7480
</DialogContent>
7581
</Dialog>

src/components/emails/TestEmail.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

types/emails.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
export interface Email {
2-
from: string, /* app email address */
3-
to: string[], /* array containing employer email */
4-
subject: string, /* derp */
5-
html: string /* email body */
6-
}
2+
// app email address
3+
from: string,
74

8-
export interface EmailProps {
9-
firstName: string;
5+
// array containing employer email
6+
to: string[],
7+
8+
// derp
9+
subject: string,
10+
11+
// email body
12+
html: string
1013
}

0 commit comments

Comments
 (0)