feat(messaging-ui): mail attachment download + scrollable reader (0.1.1)
- Attachment chips in the mail reader are now clickable: new InboxAdapter downloadAttachment() resolves a short-lived URL, opened in a new tab. - Mail reader scrolls again: convert the .miu-detail/.miu-mail height:100% chain to flex fill so a long thread scrolls within the pane instead of being clipped. MockInboxAdapter implements download. Bump to 0.1.1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,8 @@ export interface MailThreadState {
|
||||
reply: (content: string, attachment?: MailAttachment) => Promise<void>;
|
||||
canAttach: boolean;
|
||||
upload: (file: File) => Promise<MailAttachment>;
|
||||
canDownload: boolean;
|
||||
download: (attachment: MailAttachment) => Promise<string>;
|
||||
refetch: () => void;
|
||||
}
|
||||
|
||||
@@ -113,8 +115,25 @@ export function useMailThread(threadId: string | null): MailThreadState {
|
||||
},
|
||||
[adapter],
|
||||
);
|
||||
const download = useCallback(
|
||||
async (attachment: MailAttachment) => {
|
||||
if (!adapter.downloadAttachment) throw new Error('attachment download is not supported by this adapter');
|
||||
return adapter.downloadAttachment(attachment);
|
||||
},
|
||||
[adapter],
|
||||
);
|
||||
|
||||
return { messages, loading, error, reply, canAttach: typeof adapter.uploadAttachment === 'function', upload, refetch };
|
||||
return {
|
||||
messages,
|
||||
loading,
|
||||
error,
|
||||
reply,
|
||||
canAttach: typeof adapter.uploadAttachment === 'function',
|
||||
upload,
|
||||
canDownload: typeof adapter.downloadAttachment === 'function',
|
||||
download,
|
||||
refetch,
|
||||
};
|
||||
}
|
||||
|
||||
export interface ComposeState {
|
||||
|
||||
Reference in New Issue
Block a user