diff options
| author | bndw <ben@bdw.to> | 2026-03-04 21:36:32 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-03-04 21:36:32 -0800 |
| commit | 73d2680b83ccbdbd8dfec2d319533e98b379b830 (patch) | |
| tree | 193eaf5157edcf12d06dde85fb44efaf3aae2004 /renderer/src/App.tsx | |
| parent | b6405dd6a4ba65fc5dc6746db7be7be7d0bb29f3 (diff) | |
feat: Thread optional `phase` param into `db/sessions.ts::cre… (+7 more)
- ✅ 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`
Diffstat (limited to 'renderer/src/App.tsx')
| -rw-r--r-- | renderer/src/App.tsx | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/renderer/src/App.tsx b/renderer/src/App.tsx index 719faac..7c5c969 100644 --- a/renderer/src/App.tsx +++ b/renderer/src/App.tsx | |||
| @@ -5,6 +5,7 @@ import { DocumentPane } from "./components/DocumentPane"; | |||
| 5 | import { ChatPane } from "./components/ChatPane"; | 5 | import { ChatPane } from "./components/ChatPane"; |
| 6 | import { ActionBar } from "./components/ActionBar"; | 6 | import { ActionBar } from "./components/ActionBar"; |
| 7 | import { SettingsPage } from "./components/SettingsPage"; | 7 | import { SettingsPage } from "./components/SettingsPage"; |
| 8 | import { NewSessionModal } from "./components/NewSessionModal"; | ||
| 8 | import type { Project, Session, Message, Phase, TokenUsage } from "./types"; | 9 | import type { Project, Session, Message, Phase, TokenUsage } from "./types"; |
| 9 | import "./styles/globals.css"; | 10 | import "./styles/globals.css"; |
| 10 | 11 | ||
| @@ -66,6 +67,8 @@ export function App() { | |||
| 66 | }); | 67 | }); |
| 67 | const [error, setError] = useState<string | null>(null); | 68 | const [error, setError] = useState<string | null>(null); |
| 68 | const [showSettings, setShowSettings] = useState(false); | 69 | const [showSettings, setShowSettings] = useState(false); |
| 70 | const [showNewSessionModal, setShowNewSessionModal] = useState(false); | ||
| 71 | const [newSessionProjectId, setNewSessionProjectId] = useState<string | null>(null); | ||
| 69 | const [activeModel, setActiveModel] = useState<string | null>(null); | 72 | const [activeModel, setActiveModel] = useState<string | null>(null); |
| 70 | 73 | ||
| 71 | const [theme, setTheme] = useState<Theme>( | 74 | const [theme, setTheme] = useState<Theme>( |
| @@ -451,12 +454,25 @@ export function App() { | |||
| 451 | setSelectedProject(project); | 454 | setSelectedProject(project); |
| 452 | }; | 455 | }; |
| 453 | 456 | ||
| 454 | const handleCreateSession = async (projectId: string) => { | 457 | // Called by Sidebar when user clicks "+" — opens the phase-selection modal |
| 458 | const handleCreateSession = (projectId: string) => { | ||
| 459 | setNewSessionProjectId(projectId); | ||
| 460 | setShowNewSessionModal(true); | ||
| 461 | }; | ||
| 462 | |||
| 463 | // Called by NewSessionModal when user clicks "Create" | ||
| 464 | const handleConfirmNewSession = async (phase: Phase) => { | ||
| 465 | setShowNewSessionModal(false); | ||
| 466 | const projectId = newSessionProjectId; | ||
| 467 | setNewSessionProjectId(null); | ||
| 468 | if (!projectId) return; | ||
| 469 | |||
| 455 | const project = projects.find((p) => p.id === projectId); | 470 | const project = projects.find((p) => p.id === projectId); |
| 456 | if (!project) return; | 471 | if (!project) return; |
| 472 | |||
| 457 | const projectSessions = sessions.filter((s) => s.project_id === projectId); | 473 | const projectSessions = sessions.filter((s) => s.project_id === projectId); |
| 458 | const name = `Session ${projectSessions.length + 1}`; | 474 | const name = `Session ${projectSessions.length + 1}`; |
| 459 | const session = await api.createSession(projectId, name); | 475 | const session = await api.createSession(projectId, name, phase); |
| 460 | setSessions((prev) => [session, ...prev]); | 476 | setSessions((prev) => [session, ...prev]); |
| 461 | setSelectedProject(project); | 477 | setSelectedProject(project); |
| 462 | setSelectedSession(session); | 478 | setSelectedSession(session); |
| @@ -623,6 +639,16 @@ export function App() { | |||
| 623 | {showSettings && ( | 639 | {showSettings && ( |
| 624 | <SettingsPage onClose={() => setShowSettings(false)} /> | 640 | <SettingsPage onClose={() => setShowSettings(false)} /> |
| 625 | )} | 641 | )} |
| 642 | |||
| 643 | {showNewSessionModal && ( | ||
| 644 | <NewSessionModal | ||
| 645 | onConfirm={handleConfirmNewSession} | ||
| 646 | onCancel={() => { | ||
| 647 | setShowNewSessionModal(false); | ||
| 648 | setNewSessionProjectId(null); | ||
| 649 | }} | ||
| 650 | /> | ||
| 651 | )} | ||
| 626 | </div> | 652 | </div> |
| 627 | ); | 653 | ); |
| 628 | } | 654 | } |
