human hand off
This commit is contained in:
parent
d0fee5c8f7
commit
7af776196a
34 changed files with 2941 additions and 195 deletions
|
|
@ -103,6 +103,7 @@ export default function MailboxView({
|
|||
account,
|
||||
lens = "all",
|
||||
agentNav = null,
|
||||
initialThreadId = null,
|
||||
onLogout,
|
||||
onOpenSettings,
|
||||
onCompose,
|
||||
|
|
@ -163,6 +164,34 @@ export default function MailboxView({
|
|||
return () => window.clearTimeout(timeout);
|
||||
}, [load, refreshKey]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!initialThreadId) return undefined;
|
||||
let cancelled = false;
|
||||
setSelected(initialThreadId);
|
||||
setDetailStatus({ loading: true, error: "", busy: false });
|
||||
getThread(initialThreadId, token)
|
||||
.then((thread) => {
|
||||
if (cancelled) return;
|
||||
const messages = thread.messages || [];
|
||||
const latest = messages[messages.length - 1];
|
||||
setThreadDetail(thread);
|
||||
setDetail(latest || {
|
||||
id: thread.latest_message_id,
|
||||
thread_id: initialThreadId,
|
||||
subject: thread.subject,
|
||||
snippet: thread.snippet,
|
||||
});
|
||||
setDetailStatus({ loading: false, error: "", busy: false });
|
||||
})
|
||||
.catch((error) => {
|
||||
if (cancelled) return;
|
||||
setDetailStatus({ loading: false, error: error.message, busy: false });
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [initialThreadId, token]);
|
||||
|
||||
useEffect(() => {
|
||||
function openPalette(event) {
|
||||
const target = event.target;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue