From 220168abd0ced5107099fb478a9f597da98ca0f3 Mon Sep 17 00:00:00 2001 From: debu-2 Date: Mon, 5 Oct 2026 22:33:29 +0530 Subject: [PATCH] inbox streamlining --- frontend/src/components/AgAgentPanel.jsx | 36 ++- frontend/src/components/MailDetail.jsx | 394 ++++++++++++----------- frontend/src/components/MailboxView.jsx | 1 - frontend/src/styles.css | 93 +++--- 4 files changed, 279 insertions(+), 245 deletions(-) diff --git a/frontend/src/components/AgAgentPanel.jsx b/frontend/src/components/AgAgentPanel.jsx index ebac062..a10c8b9 100644 --- a/frontend/src/components/AgAgentPanel.jsx +++ b/frontend/src/components/AgAgentPanel.jsx @@ -77,18 +77,37 @@ function metricTotal(stats) { } function emailContextSummary(email) { - const text = (email?.body_text || email?.snippet || "").trim(); - if (!text) return "Open message loaded — summary will appear here."; - return text.length > 160 ? `${text.slice(0, 157)}…` : text; + const text = (email?.body_text || email?.snippet || "").trim().toLowerCase(); + const sender = email?.sender?.name || email?.sender_display_name || "The sender"; + if (!text) return "This message is open — a summary will appear here."; + if (text.includes("check") && text.includes("inbox") && text.includes("repl")) { + return `${sender} asks you to check the inbox and review messages and replies.`; + } + if (text.includes("check") && text.includes("inbox")) { + return `${sender} asks you to check the inbox.`; + } + if (text.includes("repl")) { + return `${sender} is following up about replies or responses.`; + } + if (text.includes("attach")) { + return `${sender} references an attachment that may need review.`; + } + const snippet = (email?.body_text || email?.snippet || "").trim(); + const firstSentence = snippet.split(/[.!?\n]/).find((part) => part.trim().length > 8)?.trim(); + if (firstSentence) { + return `${sender} wrote: “${firstSentence.length > 120 ? `${firstSentence.slice(0, 117)}…` : firstSentence}.”`; + } + return `${sender} sent a short message that may need a response.`; } function emailContextActions(email) { const text = (email?.body_text || email?.snippet || "").toLowerCase(); const actions = []; if (text.includes("check") && text.includes("inbox")) actions.push("Check inbox"); + if (text.includes("message")) actions.push("Review messages"); if (text.includes("repl")) actions.push("Review replies"); if (text.includes("attach")) actions.push("Review attachments"); - if (!actions.length) actions.push("Review message", "Draft a reply"); + if (!actions.length) actions.push("Review message"); return actions.slice(0, 3); } @@ -170,9 +189,12 @@ export default function AgAgentPanel({

Summary

{emailContextSummary(contextEmail)}

Action items

-