From 0484d97dfbc3b8a2e7878d3ab35a9895decdf467 Mon Sep 17 00:00:00 2001
From: bndw <ben@bdw.to>
Date: Sat, 28 Feb 2026 21:35:39 -0800
Subject: feat: **1 — `git.ts`:** Add exported `getCurrentBranch` helpe… (+8
 more)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- ✅ **1 — `git.ts`:** Add exported `getCurrentBranch` helper after `ensureGitRepo`
- ✅ **2a — `ipc/handlers.ts`:** Update git import to include `ensureGitRepo` and `getCurrentBranch`
- ✅ **2b — `ipc/handlers.ts`:** Replace `workflow:advance` implement-phase block with branching-toggle logic
- ✅ **3 — `GitSettings.tsx`:** Create new settings component with pill toggle
- ✅ **4 — `SettingsPage.tsx`:** Add `"git"` section type, import, nav item, content render; fix both unicode glyphs
- ✅ **5 — `globals.css`:** Append toggle-row + pill toggle + maximize-btn CSS
- ✅ **6 — `index.ts`:** Add `ipcMain` to import; add `window:toggleMaximize` handler + maximize/unmaximize events inside `createWindow()`
- ✅ **7 — `preload.ts`:** Add `toggleMaximize` + `onWindowMaximized` to interface and `api` object
- ✅ **8 — `Header.tsx`:** Add `isMaximized` state + effect + maximize button in JSX
---
 renderer/src/components/Header.tsx | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

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

diff --git a/renderer/src/components/Header.tsx b/renderer/src/components/Header.tsx
index 3a530d3..1d954ec 100644
--- a/renderer/src/components/Header.tsx
+++ b/renderer/src/components/Header.tsx
@@ -1,6 +1,8 @@
-import React, { useState } from "react";
+import React, { useState, useEffect } from "react";
 import type { Project, Session, Phase } from "../types";
 
+const api = window.api;
+
 type Theme = "dark" | "light";
 
 interface HeaderProps {
@@ -86,6 +88,16 @@ export function Header({
     setIsRenamingSession(false);
   };
 
+  // ── Maximize ─────────────────────────────────────────────────
+  const [isMaximized, setIsMaximized] = useState(false);
+
+  useEffect(() => {
+    // Returns the unsubscribe function; React cleanup calls it on unmount.
+    // On macOS, clicking the native green traffic light also fires this,
+    // keeping the glyph accurate when native controls are used.
+    return api.onWindowMaximized(setIsMaximized);
+  }, []);
+
   // ── Branch copy ──────────────────────────────────────────────
   const [copied, setCopied] = useState(false);
 
@@ -225,6 +237,15 @@ export function Header({
           {theme === "dark" ? "[light]" : "[dark]"}
         </button>
 
+        {/* ── Maximize toggle ── */}
+        <button
+          className="maximize-btn"
+          onClick={() => api.toggleMaximize()}
+          title={isMaximized ? "Restore window" : "Maximize window"}
+        >
+          {isMaximized ? '⊡' : '□'}
+        </button>
+
         {/* ── Settings button ── */}
         <button className="settings-btn" onClick={onOpenSettings} title="Settings">
           &#9881;
-- 
cgit v1.2.3

