Skip to content

Commit b2567f6

Browse files
committed
feat: ✨ test email function
1 parent 8476930 commit b2567f6

File tree

7 files changed

+44
-52
lines changed

7 files changed

+44
-52
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/yourusername/beacon.git
33-
cd beacon
32+
git clone https://github.com/foundersandcoders/lift-frontend-v2.git
33+
cd lift-frontend-v2
3434
npm install
3535
```
3636

src/App.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ const AppContent: React.FC = () => {
2323
// MainPage and Header receives the username from context.
2424
<>
2525
<Header />
26-
{data.username ? (
27-
<MainPage />
28-
) : (
29-
<LoginPage onSubmit={handleLoginSubmit} />
30-
)}
26+
{ data.username ? (<MainPage />) : (<LoginPage onSubmit={handleLoginSubmit} />) }
3127
</>
3228
);
3329
};

src/api/resend/routes/sendTest.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { EmailTest } from '../../../components/emails/TestEmail';
22
import { Resend } from 'resend';
3-
4-
const RESEND_KEY = import.meta.env.VITE_RESEND_KEY;
5-
const resend = new Resend(RESEND_KEY);
3+
const resendKey = import.meta.env.VITE_RESEND_KEY;
4+
const resend = new Resend(resendKey);
65

76
const facTeam= {
87
to: [

src/api/resend/utils/emailSender.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { Resend } from "resend";
21
import { Email } from "../../../../types/emails";
3-
4-
const RESEND_KEY = import.meta.env.VITE_RESEND_KEY;
5-
const resend = new Resend(RESEND_KEY);
2+
import { Resend } from 'resend';
3+
const resendKey = import.meta.env.VITE_RESEND_KEY;
4+
const resend = new Resend(resendKey);
65

76
export async function sendEmail(email: Email) {
87
try {

src/components/LoginPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ 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+
4243
<p className='mb-6 text-center text-gray-700'>
4344
Please enter your name and, optionally, your line manager's email to
4445
continue.
4546
</p>
47+
4648
<form onSubmit={handleSubmit} className='space-y-4'>
4749
<Input
4850
placeholder='Enter your name'

src/components/MainPage.tsx

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

src/components/ShareEmailModal.tsx

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ 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';
1314

1415
const ShareEmailModal: React.FC<{ onClose: () => void }> = ({ onClose }) => {
1516
const { data } = useEntries();
1617
const managerEmail = data.managerEmail;
18+
1719
// Only include public statements that are not resolved.
1820
const publicStatements = data.entries.filter(
1921
(entry) => entry.isPublic && !entry.isResolved
@@ -25,57 +27,49 @@ const ShareEmailModal: React.FC<{ onClose: () => void }> = ({ onClose }) => {
2527
<DialogTitle className='text-lg font-bold'>
2628
Sharing with: {managerEmail || 'No manager email set'}
2729
</DialogTitle>
30+
2831
<DialogDescription className='mt-2'>
2932
Below are your public, unresolved statements and their pending
3033
actions:
3134
</DialogDescription>
35+
3236
<div className='mt-4 space-y-4'>
3337
{publicStatements.length > 0 ? (
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-
))
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>))
6163
) : (
6264
<p className='text-gray-600'>
6365
No public unresolved statements available.
6466
</p>
6567
)}
6668
</div>
69+
6770
<DialogFooter className='mt-4 flex justify-end space-x-4'>
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>
71+
<Button variant='pink' onClick={() => { POST() }}> Send </Button>
72+
<Button variant='pink' onClick={onClose}> Close </Button>
7973
</DialogFooter>
8074
</DialogContent>
8175
</Dialog>

0 commit comments

Comments
 (0)