From 254207b010eeb0a2a04ee203741c21ccb92e0dd8 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Tue, 8 Jul 2025 11:57:11 -0700 Subject: [PATCH] Make chats print friendly to share via print to PDF etc. from browser Add print specific styling to hide side panels and chat input footers. Add heading with khoj logo, conversation title, agent and date. --- src/interface/web/app/chat/chat.module.css | 47 +++ src/interface/web/app/chat/page.tsx | 26 +- .../chatHistory/chatHistory.module.css | 34 ++ .../components/chatHistory/chatHistory.tsx | 22 ++ .../chatMessage/chatMessage.module.css | 106 +++++ src/interface/web/app/globals-print.css | 366 ++++++++++++++++++ src/interface/web/app/layout.tsx | 1 + 7 files changed, 591 insertions(+), 11 deletions(-) create mode 100644 src/interface/web/app/globals-print.css diff --git a/src/interface/web/app/chat/chat.module.css b/src/interface/web/app/chat/chat.module.css index 8fe875ee..2218bd64 100644 --- a/src/interface/web/app/chat/chat.module.css +++ b/src/interface/web/app/chat/chat.module.css @@ -124,3 +124,50 @@ div.chatTitleWrapper { grid-template-columns: 1fr; } } + +/* Print-specific styles for chat layout */ +@media print { + /* Chat container adjustments */ + div.main { + height: auto !important; + max-height: none !important; + width: 100% !important; + margin: 0 !important; + padding: 0 !important; + overflow: visible !important; + } + + div.chatBox, + div.chatBoxBody, + div.chatLayout { + height: auto !important; + max-height: none !important; + width: 100% !important; + display: block !important; + margin: 0 !important; + padding: 0 !important; + overflow: visible !important; + position: static !important; + } + + div.chatBodyFull, + div.chatBody { + display: block !important; + width: 100% !important; + height: auto !important; + max-height: none !important; + grid-template-columns: none !important; + overflow: visible !important; + position: static !important; + } + + div.inputBox { + display: none !important; + } + + /* Make chat content use full width in print */ + .chatHistory { + width: 100% !important; + max-width: none !important; + } +} diff --git a/src/interface/web/app/chat/page.tsx b/src/interface/web/app/chat/page.tsx index 0e913dc7..13315d4b 100644 --- a/src/interface/web/app/chat/page.tsx +++ b/src/interface/web/app/chat/page.tsx @@ -162,7 +162,7 @@ function ChatBodyData(props: ChatBodyDataProps) { />
- +
+ +
); } @@ -458,9 +460,11 @@ export default function Chat() { return ( - +
+ +
-
+
{conversationId && ( @@ -493,7 +497,7 @@ export default function Chat() {