feat(send): 'Send now' on the send-delay toast
The post-send undo toast ('scheduled to send' + Cancel send) now also offers a
'Send now' action that reschedules the delayed submission for immediate release,
so you can skip the undo window without waiting it out. Adds an optional
secondaryAction to the toast component and carries identityId on the pending
undo-send state so the reschedule can target the right identity.
This commit is contained in:
@@ -20,7 +20,7 @@ type ScheduledSubmissionMetadata = {
|
||||
|
||||
const VIRTUAL_SCHEDULED_MAILBOX_ID = '__scheduled__';
|
||||
|
||||
type PendingUndoSend = { submissionId: string; emailId?: string; sendAt: string; isSmime: boolean };
|
||||
type PendingUndoSend = { submissionId: string; emailId?: string; identityId?: string; sendAt: string; isSmime: boolean };
|
||||
|
||||
interface EmailStore {
|
||||
emails: Email[];
|
||||
@@ -1287,7 +1287,7 @@ export const useEmailStore = create<EmailStore>((set, get) => ({
|
||||
set({
|
||||
isLoading: false,
|
||||
pendingUndoSend: result.scheduled && result.emailSubmissionId && result.sendAt
|
||||
? { submissionId: result.emailSubmissionId, emailId: result.emailId, sendAt: result.sendAt, isSmime: false }
|
||||
? { submissionId: result.emailSubmissionId, emailId: result.emailId, identityId, sendAt: result.sendAt, isSmime: false }
|
||||
: get().pendingUndoSend,
|
||||
});
|
||||
return result;
|
||||
@@ -1311,7 +1311,7 @@ export const useEmailStore = create<EmailStore>((set, get) => ({
|
||||
set({
|
||||
isLoading: false,
|
||||
pendingUndoSend: result.scheduled && result.emailSubmissionId && result.sendAt
|
||||
? { submissionId: result.emailSubmissionId, emailId: result.emailId, sendAt: result.sendAt, isSmime: true }
|
||||
? { submissionId: result.emailSubmissionId, emailId: result.emailId, identityId, sendAt: result.sendAt, isSmime: true }
|
||||
: get().pendingUndoSend,
|
||||
});
|
||||
return result;
|
||||
|
||||
@@ -38,6 +38,7 @@ export const useToastStore = create<ToastStore>((set) => ({
|
||||
interface ToastOptions {
|
||||
message?: string;
|
||||
action?: ToastAction;
|
||||
secondaryAction?: ToastAction;
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
@@ -48,6 +49,7 @@ function showToast(type: Toast["type"], title: string, options?: string | ToastO
|
||||
title,
|
||||
message: opts?.message,
|
||||
action: opts?.action,
|
||||
secondaryAction: opts?.secondaryAction,
|
||||
duration: opts?.duration ?? defaultDuration,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user