Drafts in every chat, factory chat overlay, factory main switch

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Sonnet 5.5 committed 2026-11-20 12:14:04 +01:00
1 parent 58475ce65e
commit 171b87b766
48 files changed
+754 -10

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
import { useEffect } from "react";
import { navigate } from "../router";
import { useT } from "../i18n";
import { ChatView } from "./ChatView";
import { Icon } from "./Icon";
/** Desktop only: chats of the factory open over the board and are closed with one click. */
export const isDesktop = () => window.matchMedia("(min-width: 801px)").matches;
/** Open the chat of a phase: in the overlay on the desktop, as a page on small screens. */
export function openFactoryChat(sessionId: string) {
navigate(isDesktop() ? `/factory/s/${sessionId}` : `/s/${sessionId}`);
}
export function ChatOverlay({ id }: { id: string }) {
const t = useT();
const close = () => navigate("/factory");
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
// Esc closes – unless it is meant for a field, a dialog or the image viewer on top.
const el = document.activeElement;
const typing = el instanceof HTMLTextAreaElement || el instanceof HTMLInputElement || el instanceof HTMLSelectElement;
if (e.key === "Escape" && !typing && !document.querySelector(".modal-backdrop, .viewer-overlay")) close();
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, []);
return (
<div className="chat-overlay" onMouseDown={(e) => e.target === e.currentTarget && close()}>
<div className="chat-overlay-box" role="dialog" aria-modal="true">
<div className="chat-overlay-bar">
<span className="hint">{t("factory.chatOverlay")}</span>
<span className="spacer" />
<button className="small" onClick={() => navigate(`/s/${id}`)} title={t("factory.openFullHint")}>
<Icon name="external" /> {t("factory.openFull")}
</button>
<button className="small" onClick={close} aria-label={t("common.close")}>
<Icon name="close" /> {t("common.close")}
</button>
</div>
<div className="chat-overlay-body">
<ChatView key={id} sessionId={id} onMenu={close} />
</div>
</div>
</div>
);
}