handoff fixes
This commit is contained in:
parent
3f4bcc26d9
commit
6c52cd19cb
8 changed files with 561 additions and 59 deletions
|
|
@ -2,6 +2,29 @@ import { ArrowLeft } from "lucide-react";
|
|||
import { useCallback, useEffect, useState } from "react";
|
||||
import { getHandoffConversation } from "../api";
|
||||
|
||||
function HandoffMessageBody({ message }) {
|
||||
const [showQuoted, setShowQuoted] = useState(false);
|
||||
const displayText = message.new_reply_content || message.body_text || message.snippet;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="handoff-message-body">{displayText}</div>
|
||||
{message.has_quoted_text && message.raw_body && (
|
||||
<button
|
||||
type="button"
|
||||
className="handoff-show-quoted"
|
||||
onClick={() => setShowQuoted((current) => !current)}
|
||||
>
|
||||
{showQuoted ? "Hide quoted text" : "Show quoted text"}
|
||||
</button>
|
||||
)}
|
||||
{showQuoted && message.raw_body && (
|
||||
<pre className="handoff-quoted-body">{message.raw_body}</pre>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function formatTime(dateValue) {
|
||||
if (!dateValue) return "";
|
||||
return new Date(dateValue).toLocaleString(undefined, {
|
||||
|
|
@ -63,9 +86,7 @@ export default function HandoffConversation({ handoffId, onBack }) {
|
|||
<strong>{message.role === "human" ? "HUMAN OWNER" : "AGENT"}</strong>
|
||||
<time>{formatTime(message.event_at)}</time>
|
||||
</header>
|
||||
<div className="handoff-message-body">
|
||||
{message.body_text || message.snippet}
|
||||
</div>
|
||||
<HandoffMessageBody message={message} />
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -559,6 +559,8 @@ h1 em { color:var(--coral); font-style:normal; font-weight:500; }
|
|||
.handoff-message-human header strong { color:#11966a; }
|
||||
.handoff-message header time { color:#9a96a5; font-size:11px; }
|
||||
.handoff-message-body { color:#292536; font-size:13px; line-height:1.6; white-space:pre-wrap; }
|
||||
.handoff-show-quoted { margin-top:8px; padding:0; border:0; background:transparent; color:#6d5bd0; font-size:11px; font-weight:600; cursor:pointer; }
|
||||
.handoff-quoted-body { margin:8px 0 0; padding:10px 12px; border:1px solid #ece9f2; border-radius:8px; background:#faf9fc; color:#77758a; font-size:11px; line-height:1.45; white-space:pre-wrap; overflow:auto; }
|
||||
.handoff-settings-intro { margin-bottom:18px; padding:18px 20px; border:1px solid #ece7ff; border-radius:14px; background:#fbf9ff; }
|
||||
.handoff-settings-intro p { margin:0 0 10px; color:#4a4652; font-size:12px; line-height:1.6; }
|
||||
.handoff-settings-intro p strong { color:#171424; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue