From 73d2680b83ccbdbd8dfec2d319533e98b379b830 Mon Sep 17 00:00:00 2001
From: bndw <ben@bdw.to>
Date: Wed, 4 Mar 2026 21:36:32 -0800
Subject: feat: Thread optional `phase` param into `db/sessions.ts::cre… (+7
 more)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- ✅ Thread optional `phase` param into `db/sessions.ts::createSession()`
- ✅ Thread optional `phase` param into `ipc/handlers.ts` sessions:create handler
- ✅ Thread optional `phase` param into `preload.ts` createSession API
- ✅ Update Plan phase system prompt to gracefully handle missing research.md
- ✅ Update Implement phase system prompt to gracefully handle missing plan.md
- ✅ Create `renderer/src/components/NewSessionModal.tsx`
- ✅ Update `App.tsx`: add modal state, split handler, add modal JSX
- ✅ Add modal CSS to `globals.css`
---
 renderer/src/components/DocumentPane.tsx | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

(limited to 'renderer/src/components/DocumentPane.tsx')

diff --git a/renderer/src/components/DocumentPane.tsx b/renderer/src/components/DocumentPane.tsx
index f5368b3..2ec66f6 100644
--- a/renderer/src/components/DocumentPane.tsx
+++ b/renderer/src/components/DocumentPane.tsx
@@ -117,6 +117,11 @@ export function DocumentPane({
 }: DocumentPaneProps) {
   const [isEditing, setIsEditing] = useState(false);
 
+  // Always exit edit mode when the pane becomes read-only.
+  useEffect(() => {
+    if (disabled) setIsEditing(false);
+  }, [disabled]);
+
   if (showOnboarding) {
     return (
       <div className="document-pane">
@@ -206,9 +211,13 @@ export function DocumentPane({
     <div className="document-pane">
       <div className="document-header">
         <span>{filename}</span>
-        <button onClick={() => setIsEditing(!isEditing)}>
-          {isEditing ? "Preview" : "Edit"}
-        </button>
+        {disabled ? (
+          <span className="badge badge-readonly">Read-only</span>
+        ) : (
+          <button onClick={() => setIsEditing(!isEditing)}>
+            {isEditing ? "Preview" : "Edit"}
+          </button>
+        )}
       </div>
 
       {isEditing ? (
-- 
cgit v1.2.3

