Skip to content
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
Binary file added public/email-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions public/email-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/app/api/workspaces/[id]/collaborators/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ async function handlePOST(
inviterName: currentUser.name || 'A user',
workspaceName: ws.name || 'Workspace',
workspaceUrl,
permissionLevel,
}),

});
if (error) console.error("Failed to send invitation email:", error);
} catch (emailError) {
Expand Down
183 changes: 154 additions & 29 deletions src/components/email/invite-email.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,171 @@
import * as React from 'react';

const FONT =
'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
const BRAND_FONT =
'Outfit, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
const BG = '#111113';

interface InviteEmailTemplateProps {
inviterName?: string;
workspaceName: string;
workspaceUrl: string;
permissionLevel?: string;
}

export function InviteEmailTemplate({
inviterName,
workspaceName,
workspaceUrl,
permissionLevel,
}: Readonly<InviteEmailTemplateProps>): React.ReactElement {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
const roleText = permissionLevel === 'viewer' ? 'a Viewer' : 'an Editor';

return (
<div style={{ fontFamily: 'sans-serif', padding: '20px', color: '#333' }}>
<h1 style={{ fontSize: '20px', marginBottom: '16px' }}>
You've been invited to collaborate!
</h1>
<p style={{ fontSize: '16px', lineHeight: '1.5' }}>
<strong>{inviterName || 'Someone'}</strong> has invited you to collaborate on the workspace <strong>{workspaceName}</strong>.
</p>
<div style={{ marginTop: '24px', marginBottom: '24px' }}>
<a
href={workspaceUrl}
style={{
backgroundColor: '#000',
color: '#fff',
padding: '12px 24px',
borderRadius: '6px',
textDecoration: 'none',
fontSize: '16px',
display: 'inline-block',
}}
>
Join Workspace
</a>
</div>
<p style={{ fontSize: '14px', color: '#666' }}>
or copy and paste this link into your browser: <br />
<a href={workspaceUrl} style={{ color: '#0070f3', wordBreak: 'break-all' }}>
{workspaceUrl}
</a>
</p>
<div style={{ backgroundColor: BG, margin: 0, padding: 0, width: '100%' }}>
<table
width="100%"
cellPadding={0}
cellSpacing={0}
style={{ borderCollapse: 'collapse' as const }}
>
<tr>
<td align="center" style={{ padding: '40px 5%' }}>
<table
cellPadding={0}
cellSpacing={0}
style={{
maxWidth: '100%',
width: '100%',
borderCollapse: 'collapse' as const,
}}
>
{/* Heading + Body text */}
<tr>
<td style={{ paddingTop: '32px' }}>
<h1
style={{
fontFamily: BRAND_FONT,
fontSize: '26px',
fontWeight: 600,
color: '#FFFFFF',
lineHeight: '1.3',
margin: '0 0 16px 0',
}}
>
You&apos;re invited to collaborate!
</h1>
<p
style={{
fontFamily: FONT,
fontSize: '15px',
fontWeight: 400,
color: '#FFFFFF',
lineHeight: '1.6',
margin: 0,
}}
>
<strong style={{ color: '#FFFFFF' }}>{inviterName || 'Someone'}</strong> has invited you to join the workspace{' '}
<strong style={{ color: '#FFFFFF' }}>&ldquo;{workspaceName}&rdquo;</strong>
{permissionLevel ? ` as ${roleText}` : ''}.
</p>
</td>
</tr>

{/* CTA Button */}
<tr>
<td align="center" style={{ paddingTop: '24px', paddingBottom: '24px' }}>
<a
href={workspaceUrl}
style={{
display: 'inline-block',
backgroundColor: '#FFFFFF',
color: '#1F1F1F',
padding: '14px 40px',
borderRadius: '9999px',
textDecoration: 'none',
fontSize: '15px',
fontWeight: 600,
fontFamily: FONT,
textAlign: 'center' as const,
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.3)',
}}
>
Join Workspace
</a>
</td>
</tr>

{/* Fallback URL */}
<tr>
<td style={{ paddingBottom: '32px' }}>
<p
style={{
fontFamily: FONT,
fontSize: '12px',
color: 'rgba(255, 255, 255, 0.5)',
margin: 0,
lineHeight: '1.5',
}}
>
or copy and paste this link into your browser:
<br />
<a
href={workspaceUrl}
style={{
color: '#A78BFA',
textDecoration: 'underline',
wordBreak: 'break-all' as const,
fontSize: '12px',
}}
>
{workspaceUrl}
</a>
</p>
</td>
</tr>

{/* Footer */}
<tr>
<td style={{ paddingTop: '24px', paddingBottom: '40px' }}>
<p
style={{
fontFamily: FONT,
fontSize: '12px',
fontStyle: 'italic' as const,
color: 'rgba(255, 255, 255, 0.5)',
margin: '4px 0 0 0',
}}
>
The Workspace That Thinks With You
</p>
<p
style={{
fontFamily: FONT,
fontSize: '11px',
color: 'rgba(255, 255, 255, 0.5)',
lineHeight: '1.5',
margin: '16px 0 0 0',
}}
>
You received this email because {inviterName || 'someone'} invited you to collaborate on ThinkEx. If you believe this was sent in error, you can safely ignore this email.
</p>
<p
style={{
fontFamily: FONT,
fontSize: '11px',
color: 'rgba(255, 255, 255, 0.35)',
margin: '12px 0 0 0',
}}
>
&copy; {new Date().getFullYear()} ThinkEx
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
);
}
Expand Down