From b6bb8937dae4dee241b0c31711fcdd215b3f6d76 Mon Sep 17 00:00:00 2001 From: Ahmet Kilinc Date: Fri, 25 Jul 2025 15:14:59 +0100 Subject: [PATCH] fit the design better --- apps/mail/components/create/compose-tabs.tsx | 18 ++++---- .../mail/components/create/email-composer.tsx | 46 +++++++++++++------ apps/mail/components/create/toolbar.tsx | 2 +- apps/mail/components/mail/reply-composer.tsx | 6 +-- 4 files changed, 46 insertions(+), 26 deletions(-) diff --git a/apps/mail/components/create/compose-tabs.tsx b/apps/mail/components/create/compose-tabs.tsx index 9bf152285..f0e897e20 100644 --- a/apps/mail/components/create/compose-tabs.tsx +++ b/apps/mail/components/create/compose-tabs.tsx @@ -83,7 +83,7 @@ function ComposeTabContent({ // Update the tab with the new draft ID updateTab({ id: tabId, updates: { draftId: newDraftId } }); }} - className="h-full" + className="h-full overflow-hidden rounded-2xl border-[1px] border-[#313131] bg-[#313131]" autofocus={true} settingsLoading={settingsLoading} isFullscreen={isFullscreen} @@ -215,7 +215,7 @@ export function ComposeTabs() { return ( <> -
+
{Array.from(composeTabs.values()).map((tab) => { const index = Array.from(composeTabs.values()).indexOf(tab); @@ -230,7 +230,7 @@ export function ComposeTabs() { opacity: 1, scale: 1, y: 0, - width: tab.isMinimized ? 'auto' : '450px', + width: tab.isMinimized ? 'auto' : '500px', height: tab.isMinimized ? 'auto' : '600px', }} exit={{ opacity: 0, scale: 0.8, y: 20 }} @@ -248,7 +248,7 @@ export function ComposeTabs() { className={ tab.isMinimized ? 'cursor-pointer' - : 'bg-background overflow-hidden rounded-lg border shadow-2xl' + : 'bg-background overflow-hidden rounded-2xl border shadow-2xl dark:bg-[#313131]' } > @@ -259,7 +259,7 @@ export function ComposeTabs() { animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.15 }} - className="hover:bg-accent flex h-10 items-center gap-2 rounded-lg border bg-[#FFFFFF] px-4 py-2 shadow-lg dark:bg-[#202020]" + className="hover:bg-accent flex h-10 items-center gap-2 rounded-2xl border bg-[#FFFFFF] py-2 pl-4 pr-2.5 shadow-lg dark:bg-[#313131]" onClick={() => toggleMinimize(tab.id)} > @@ -290,7 +290,7 @@ export function ComposeTabs() { className="flex h-full flex-col" onClick={() => setActiveTabId(tab.id)} > -
+

{tab.subject || 'New Email'}

-
+
- + {/* - + */}
); diff --git a/apps/mail/components/create/email-composer.tsx b/apps/mail/components/create/email-composer.tsx index eaacd5ef8..32b3b1830 100644 --- a/apps/mail/components/create/email-composer.tsx +++ b/apps/mail/components/create/email-composer.tsx @@ -93,6 +93,18 @@ interface EmailComposerProps { isFullscreen?: boolean; } +type FormData = { + to: string[]; + subject: string; + message: string; + attachments?: File[]; + headers?: any; + cc?: string[]; + bcc?: string[]; + threadId?: string; + fromEmail?: string; +}; + const schema = z.object({ to: z.array(z.string().email()).min(1), subject: z.string().min(1), @@ -234,7 +246,7 @@ function EmailComposerBase({ trpc.ai.generateEmailSubject.mutationOptions(), ); - const form = useForm>({ + const form = useForm({ resolver: zodResolver(schema), defaultValues: { to: initialTo, @@ -542,9 +554,19 @@ function EmailComposerBase({ }; // Debounced onChange to prevent excessive re-renders - const debouncedOnChange = useDebounce((updates: any) => { - onChange?.(updates); - }, 500); + const debouncedOnChange = useDebounce( + (updates: { + to?: string[]; + cc?: string[]; + bcc?: string[]; + subject?: string; + body?: string; + attachments?: File[]; + }) => { + onChange?.(updates); + }, + 500, + ); // Add useEffect to notify parent of changes useEffect(() => { @@ -669,18 +691,16 @@ function EmailComposerBase({ return (
-
+
{/* To, Cc, Bcc */} -
+

To:

@@ -811,7 +831,7 @@ function EmailComposerBase({ -
+
{aiGeneratedMessage !== null ? ( {/* Message Content */} -
+
{ editor.commands.focus(); @@ -883,7 +903,7 @@ function EmailComposerBase({
{/* Bottom Actions */} -
+