diff options
| author | bndw <ben@bdw.to> | 2026-02-28 21:35:39 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-02-28 21:35:39 -0800 |
| commit | 0484d97dfbc3b8a2e7878d3ab35a9895decdf467 (patch) | |
| tree | cdc6fffe8b169c83058e8d64ca42723f6ccb6dcf /renderer/src/components/Header.tsx | |
| parent | 04c63d4ef601876186e5d7fab980d76575c494ec (diff) | |
feat: **1 — `git.ts`:** Add exported `getCurrentBranch` helpe… (+8 more)
- ✅ **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
Diffstat (limited to 'renderer/src/components/Header.tsx')
| -rw-r--r-- | renderer/src/components/Header.tsx | 23 |
1 files changed, 22 insertions, 1 deletions
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 @@ | |||
| 1 | import React, { useState } from "react"; | 1 | import React, { useState, useEffect } from "react"; |
| 2 | import type { Project, Session, Phase } from "../types"; | 2 | import type { Project, Session, Phase } from "../types"; |
| 3 | 3 | ||
| 4 | const api = window.api; | ||
| 5 | |||
| 4 | type Theme = "dark" | "light"; | 6 | type Theme = "dark" | "light"; |
| 5 | 7 | ||
| 6 | interface HeaderProps { | 8 | interface HeaderProps { |
| @@ -86,6 +88,16 @@ export function Header({ | |||
| 86 | setIsRenamingSession(false); | 88 | setIsRenamingSession(false); |
| 87 | }; | 89 | }; |
| 88 | 90 | ||
| 91 | // ── Maximize ───────────────────────────────────────────────── | ||
| 92 | const [isMaximized, setIsMaximized] = useState(false); | ||
| 93 | |||
| 94 | useEffect(() => { | ||
| 95 | // Returns the unsubscribe function; React cleanup calls it on unmount. | ||
| 96 | // On macOS, clicking the native green traffic light also fires this, | ||
| 97 | // keeping the glyph accurate when native controls are used. | ||
| 98 | return api.onWindowMaximized(setIsMaximized); | ||
| 99 | }, []); | ||
| 100 | |||
| 89 | // ── Branch copy ────────────────────────────────────────────── | 101 | // ── Branch copy ────────────────────────────────────────────── |
| 90 | const [copied, setCopied] = useState(false); | 102 | const [copied, setCopied] = useState(false); |
| 91 | 103 | ||
| @@ -225,6 +237,15 @@ export function Header({ | |||
| 225 | {theme === "dark" ? "[light]" : "[dark]"} | 237 | {theme === "dark" ? "[light]" : "[dark]"} |
| 226 | </button> | 238 | </button> |
| 227 | 239 | ||
| 240 | {/* ── Maximize toggle ── */} | ||
| 241 | <button | ||
| 242 | className="maximize-btn" | ||
| 243 | onClick={() => api.toggleMaximize()} | ||
| 244 | title={isMaximized ? "Restore window" : "Maximize window"} | ||
| 245 | > | ||
| 246 | {isMaximized ? '⊡' : '□'} | ||
| 247 | </button> | ||
| 248 | |||
| 228 | {/* ── Settings button ── */} | 249 | {/* ── Settings button ── */} |
| 229 | <button className="settings-btn" onClick={onOpenSettings} title="Settings"> | 250 | <button className="settings-btn" onClick={onOpenSettings} title="Settings"> |
| 230 | ⚙ | 251 | ⚙ |
