From 48eea5d2010c5cb52b96fbd6a819ea501f62de14 Mon Sep 17 00:00:00 2001 From: debu-2 Date: Tue, 6 Oct 2026 23:31:49 +0530 Subject: [PATCH] handoff minor fixes --- frontend/src/components/ComposeModal.jsx | 61 ++++++++++++++++--- frontend/src/components/DashboardPage.jsx | 4 +- frontend/src/components/HandoffSettings.jsx | 2 +- .../src/components/HumanHandoffDrawer.jsx | 23 +++++-- .../src/components/compose/RecipientField.jsx | 2 + frontend/src/responsive.css | 6 +- frontend/src/styles.css | 23 ++++--- frontend/src/utils/handoffUtils.js | 6 +- 8 files changed, 99 insertions(+), 28 deletions(-) diff --git a/frontend/src/components/ComposeModal.jsx b/frontend/src/components/ComposeModal.jsx index 3a346de..82365b1 100644 --- a/frontend/src/components/ComposeModal.jsx +++ b/frontend/src/components/ComposeModal.jsx @@ -132,6 +132,37 @@ function selectionInside(editor) { return { selection, range }; } +const ALIGN_BY_COMMAND = { + justifyLeft: "left", + justifyCenter: "center", + justifyRight: "right", +}; + +function alignmentBlock(editor, range) { + if (!editor || !range) return null; + let node = range.startContainer; + if (node.nodeType !== Node.ELEMENT_NODE) node = node.parentElement; + const block = node?.closest?.("li, p, div, blockquote, h1, h2, h3, h4"); + if (!block || !editor.contains(block)) return null; + return block; +} + +function explicitAlignment(block) { + if (!block) return ""; + const value = (block.style?.textAlign || block.getAttribute?.("align") || "").toLowerCase(); + if (value === "center") return "center"; + if (value === "right" || value === "end") return "right"; + if (value === "left" || value === "start") return "left"; + return ""; +} + +function clearAlignment(block) { + if (!block) return; + block.style.textAlign = ""; + if (!block.getAttribute("style")) block.removeAttribute("style"); + block.removeAttribute("align"); +} + function FormatButton({ title, active, onClick, children }) { return ( } + {!showBcc && } + + ) : null} /> -
- {!showCc && } - {!showBcc && } -
{showCc && ( diff --git a/frontend/src/components/DashboardPage.jsx b/frontend/src/components/DashboardPage.jsx index d40dd05..46f4d7e 100644 --- a/frontend/src/components/DashboardPage.jsx +++ b/frontend/src/components/DashboardPage.jsx @@ -175,7 +175,7 @@ export default function DashboardPage() { } function closeMobileMenu() { - if (window.matchMedia("(max-width: 767px)").matches) { + if (window.matchMedia("(max-width: 767.98px)").matches) { setMenuOpen(false); } } @@ -219,7 +219,7 @@ export default function DashboardPage() { setLens("all"); setAgentNav(actionKey); closeMobileMenu(); - const compact = window.matchMedia("(max-width: 1199px)").matches; + const compact = window.matchMedia("(max-width: 1199.98px)").matches; setSheet(actionKey === "handoff" || !compact ? null : "agent"); } diff --git a/frontend/src/components/HandoffSettings.jsx b/frontend/src/components/HandoffSettings.jsx index 159b6c6..762c630 100644 --- a/frontend/src/components/HandoffSettings.jsx +++ b/frontend/src/components/HandoffSettings.jsx @@ -10,7 +10,7 @@ import { } from "../api"; import AgentSpark from "./AgentSpark"; import HumanHandoffDrawer from "./HumanHandoffDrawer"; -import { buildRuleCardChips } from "../utils/handoffUtils"; +import { buildRuleCardChips, typeLabel } from "../utils/handoffUtils"; function ruleScope(rule) { return buildRuleCardChips(rule).filter((chip) => chip !== rule.name).join(" ยท "); diff --git a/frontend/src/components/HumanHandoffDrawer.jsx b/frontend/src/components/HumanHandoffDrawer.jsx index 9551c91..488be67 100644 --- a/frontend/src/components/HumanHandoffDrawer.jsx +++ b/frontend/src/components/HumanHandoffDrawer.jsx @@ -128,7 +128,9 @@ export default function HumanHandoffDrawer({

Rule

- +

Human owner

- +
-

Hand off emails with these labels

+

Hand off emails with these labels

These are content-based handoff categories, not inbox tabs. Gentic infers them from subject and body text. Choose All mail to hand off every incoming email. @@ -213,7 +217,7 @@ export default function HumanHandoffDrawer({

-

Hand off these types of email

+

Hand off these types of email

Types are also inferred from email content. Choose All types if you do not want to restrict by category. @@ -234,7 +238,7 @@ export default function HumanHandoffDrawer({

-

When should the agent hand off?

+

When should the agent hand off?

Write this naturally, just as you would instruct your agent.