Skip to content

Commit 5cd8f70

Browse files
feat: add 'Teach' mode and refactor TitleBar mode selector to dropdown
- Implemented 'Teach' mode protocol with didactic system prompts - Refactored TitleBar to use a custom premium dropdown for mode selection - Added icons, colors, and descriptions to each mode (Fast, Planner, Colab, Teach) - Optimized TitleBar layout for scalability and cleaner aesthetics
1 parent 46e4058 commit 5cd8f70

2 files changed

Lines changed: 85 additions & 27 deletions

File tree

src/renderer/App.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ const App: React.FC = () => {
11661166
const [browserHeight, setBrowserHeight] = useState(60)
11671167
const [isResizing, setIsResizing] = useState(false)
11681168
const [isResizingHeight, setIsResizingHeight] = useState(false)
1169-
const [mode, setMode] = useState<'fast' | 'planner' | 'colab'>('fast')
1169+
const [mode, setMode] = useState<'fast' | 'planner' | 'colab' | 'teach'>('fast')
11701170
const [showPanel, setShowPanel] = useState(false)
11711171
const [trackedFiles, setTrackedFiles] = useState<TrackedFile[]>([])
11721172
const [pinnedFiles, setPinnedFiles] = useState<string[]>([])
@@ -1210,7 +1210,7 @@ const App: React.FC = () => {
12101210
const rafRef = useRef<number | null>(null)
12111211
const scrollTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
12121212

1213-
const onSelectMode = useCallback((m: 'fast' | 'planner' | 'colab') => {
1213+
const onSelectMode = useCallback((m: 'fast' | 'planner' | 'colab' | 'teach') => {
12141214
setMode(m)
12151215
}, [])
12161216

@@ -1610,6 +1610,15 @@ Your current task is: ${userMsg}`
16101610
5. Once you have a solid strategy approved by the advisor, use 'end_collaboration' and proceed to implementation.
16111611
6. This mode is for COMPLEX architectural discussions. Use it to deliver superior engineering.
16121612
1613+
Your current task is: ${userMsg}`
1614+
} else if (mode === 'teach') {
1615+
finalMsg = `[TEACHING MODE PROTOCOL - ACTIVE]
1616+
1. You are acting as an Elite Technical Mentor.
1617+
2. For every non-obvious change you make, EXPLAIN why you chose that approach (Y) over common alternatives (X).
1618+
3. Use code blocks to illustrate small comparisons if helpful.
1619+
4. Keep explanations technical yet accessible, focusing on 'na raça' learning (best practices, trade-offs, performance).
1620+
5. Do not just code; educate through your actions.
1621+
16131622
Your current task is: ${userMsg}`
16141623
}
16151624

src/renderer/components/TitleBar.tsx

Lines changed: 74 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import React from 'react'
1+
import React, { useState, useRef, useEffect } from 'react'
2+
3+
type Mode = 'fast' | 'planner' | 'colab' | 'teach'
24

35
interface TitleBarProps {
4-
mode: 'fast' | 'planner' | 'colab'
5-
onModeChange: (mode: 'fast' | 'planner' | 'colab') => void
6+
mode: Mode
7+
onModeChange: (mode: Mode) => void
68
onSettingsClick: () => void
79
onMcpClick: () => void
810
onBrowserClick: () => void
@@ -13,29 +15,78 @@ interface TitleBarProps {
1315
onTogglePanel: () => void
1416
}
1517

16-
const TitleBar: React.FC<TitleBarProps> = ({ mode, onModeChange, onSettingsClick, onMcpClick, onBrowserClick, showBrowser, onTerminalClick, showTerminal, showPanel, onTogglePanel }) => {
18+
const MODES: { id: Mode; label: string; icon: string; desc: string; color: string }[] = [
19+
{ id: 'fast', label: 'Fast Mode', icon: '⚡', desc: 'Direct execution, high speed', color: 'text-cyan-400' },
20+
{ id: 'planner', label: 'Planner', icon: '📋', desc: 'Strategy first, safe edits', color: 'text-amber-400' },
21+
{ id: 'colab', label: 'Collaborative', icon: '👥', desc: 'Multi-agent architectural design', color: 'text-indigo-400' },
22+
{ id: 'teach', label: 'Teach & Code', icon: '🎓', desc: 'Step-by-step technical mentoring', color: 'text-emerald-400' },
23+
]
24+
25+
const TitleBar: React.FC<TitleBarProps> = ({
26+
mode, onModeChange, onSettingsClick, onMcpClick,
27+
onBrowserClick, showBrowser, onTerminalClick, showTerminal,
28+
showPanel, onTogglePanel
29+
}) => {
30+
const [showDropdown, setShowDropdown] = useState(false)
31+
const dropdownRef = useRef<HTMLDivElement>(null)
32+
const activeMode = MODES.find(m => m.id === mode) || MODES[0]
33+
34+
useEffect(() => {
35+
const handleClickOutside = (event: MouseEvent) => {
36+
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
37+
setShowDropdown(false)
38+
}
39+
}
40+
document.addEventListener('mousedown', handleClickOutside)
41+
return () => document.removeEventListener('mousedown', handleClickOutside)
42+
}, [])
43+
1744
return (
18-
<div className="h-10 bg-slate-900 border-b border-white/5 flex items-center justify-between px-3 select-none titlebar-drag">
19-
<div className="flex items-center gap-2 no-drag h-full">
20-
<div className="flex bg-slate-900/60 rounded-md p-0.5 border border-white/5 shadow-inner">
21-
<button
22-
onClick={() => onModeChange('fast')}
23-
className={`w-14 h-5 flex items-center justify-center rounded text-[8px] font-black uppercase tracking-widest transition-all duration-200 no-drag ${mode === 'fast' ? 'bg-cyan-600/90 text-white scale-105' : 'text-slate-500 hover:text-slate-300 hover:bg-white/5'}`}
24-
>
25-
Fast
26-
</button>
27-
<button
28-
onClick={() => onModeChange('planner')}
29-
className={`w-16 h-5 flex items-center justify-center rounded text-[8px] font-black uppercase tracking-widest transition-all duration-200 no-drag ${mode === 'planner' ? 'bg-amber-600/90 text-white scale-105' : 'text-slate-500 hover:text-slate-300 hover:bg-white/5'}`}
30-
>
31-
Planner
32-
</button>
33-
<button
34-
onClick={() => onModeChange('colab')}
35-
className={`w-14 h-5 flex items-center justify-center rounded text-[8px] font-black uppercase tracking-widest transition-all duration-200 no-drag ${mode === 'colab' ? 'bg-indigo-600/90 text-white scale-105' : 'text-slate-500 hover:text-slate-300 hover:bg-white/5'}`}
45+
<div className="h-10 bg-slate-900 border-b border-white/5 flex items-center justify-between px-3 select-none titlebar-drag shrink-0 z-[1000]">
46+
<div className="flex items-center gap-1 no-drag h-full">
47+
{/* Mode Selector Dropdown */}
48+
<div className="relative h-full flex items-center" ref={dropdownRef}>
49+
<button
50+
onClick={() => setShowDropdown(!showDropdown)}
51+
className="flex items-center gap-2 px-3 py-1 bg-white/5 hover:bg-white/10 rounded-md border border-white/5 transition-all no-drag group"
3652
>
37-
Colab
53+
<span className="text-xs">{activeMode.icon}</span>
54+
<span className={`text-[10px] font-black uppercase tracking-widest ${activeMode.color}`}>{activeMode.label}</span>
55+
<svg
56+
width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3"
57+
className={`text-slate-500 transition-transform duration-200 ${showDropdown ? 'rotate-180' : ''}`}
58+
>
59+
<path d="M6 9l6 6 6-6" />
60+
</svg>
3861
</button>
62+
63+
{showDropdown && (
64+
<div className="absolute top-full left-0 mt-1 w-64 bg-[#0d1117] border border-white/10 rounded-lg shadow-2xl overflow-hidden animate-in fade-in slide-in-from-top-1 duration-200 z-[1100]">
65+
<div className="p-1">
66+
{MODES.map((m) => (
67+
<button
68+
key={m.id}
69+
onClick={() => {
70+
onModeChange(m.id)
71+
setShowDropdown(false)
72+
}}
73+
className={`w-full flex flex-col gap-0.5 px-3 py-2 rounded-md transition-all text-left group ${mode === m.id ? 'bg-white/5' : 'hover:bg-white/5'}`}
74+
>
75+
<div className="flex items-center justify-between">
76+
<div className="flex items-center gap-2">
77+
<span className="text-xs">{m.icon}</span>
78+
<span className={`text-[10px] font-black uppercase tracking-widest ${mode === m.id ? m.color : 'text-slate-400 group-hover:text-slate-200'}`}>
79+
{m.label}
80+
</span>
81+
</div>
82+
{mode === m.id && <div className={`w-1 h-1 rounded-full ${m.color.replace('text-', 'bg-')}`} />}
83+
</div>
84+
<span className="text-[9px] text-slate-500 ml-5 group-hover:text-slate-400 transition-colors uppercase font-medium">{m.desc}</span>
85+
</button>
86+
))}
87+
</div>
88+
</div>
89+
)}
3990
</div>
4091

4192
<button
@@ -89,7 +140,6 @@ const TitleBar: React.FC<TitleBarProps> = ({ mode, onModeChange, onSettingsClick
89140
title={showPanel ? 'Hide context panel' : 'Show context panel'}
90141
className={`w-11 h-10 flex items-center justify-center transition-colors no-drag ${showPanel ? 'text-cyan-400 bg-cyan-900/20' : 'text-slate-400 hover:bg-white/10 hover:text-white'}`}
91142
>
92-
{/* Files/tree icon */}
93143
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
94144
<path d="M3 6h18M3 12h12M3 18h8"/>
95145
</svg>
@@ -121,4 +171,3 @@ const TitleBar: React.FC<TitleBarProps> = ({ mode, onModeChange, onSettingsClick
121171
}
122172

123173
export default TitleBar
124-

0 commit comments

Comments
 (0)