@@ -12,7 +12,9 @@ import { Spacer as UiSpacer } from '@ui/components/editor/prompt-view/Spacer'
1212import { Translation , use_translation } from '../i18n/use-translation'
1313import { Tasks as UiTasks } from '@ui/components/editor/prompt-view/Tasks'
1414import { use_tasks } from './hooks/use-tasks'
15+ import { use_notes } from './hooks/use-notes'
1516import { use_has_scrolled_past_target_button } from './hooks/use-has-scrolled-past-mode-button'
17+ import { Textarea as UiTextarea } from '@ui/components/editor/common/Textarea'
1618import { use_keyboard_shortcuts } from './hooks/use-keyboard-shortcuts'
1719import {
1820 ApiPromptType ,
@@ -45,6 +47,7 @@ export const Home: React.FC<Props> = (props) => {
4547 const { t } = use_translation ( )
4648 const is_landscape = use_is_landscape ( )
4749 const [ active_workspace_root , set_active_workspace_root ] = useState < string > ( )
50+ const [ active_tab , set_active_tab ] = useState < 'tasks' | 'notes' > ( 'tasks' )
4851 const { has_scrolled_past_target_button, target_ref, handle_scroll } =
4952 use_has_scrolled_past_target_button ( props . is_active )
5053
@@ -65,7 +68,11 @@ export const Home: React.FC<Props> = (props) => {
6568 handle_delete
6669 } = use_tasks ( props . vscode )
6770
68- const roots = Object . keys ( tasks )
71+ const { notes, handle_note_change } = use_notes ( props . vscode )
72+
73+ const roots = Array . from (
74+ new Set ( [ ...Object . keys ( tasks ) , ...Object . keys ( notes ) ] )
75+ )
6976 const active_root =
7077 active_workspace_root && roots . includes ( active_workspace_root )
7178 ? active_workspace_root
@@ -242,12 +249,29 @@ export const Home: React.FC<Props> = (props) => {
242249 </ div >
243250 )
244251
252+ const notes_for_root = notes [ active_root ] || ''
253+
254+ const notes_section = (
255+ < div className = { styles . inner__notes } >
256+ < UiTextarea
257+ value = { notes_for_root }
258+ on_change = { ( v ) => handle_note_change ( active_root , v ) }
259+ placeholder = { t ( 'home.notes.placeholder' ) }
260+ min_rows = { 10 }
261+ blur_on_enter = { false }
262+ />
263+ </ div >
264+ )
265+
245266 const tasks_section = (
246267 < >
247268 < UiTabs
248- tabs = { [ { id : 'tasks' , label : t ( 'home.tasks' ) } ] }
249- active_tab = "tasks"
250- on_tab_change = { ( ) => { } }
269+ tabs = { [
270+ { id : 'tasks' , label : t ( 'home.tasks' ) } ,
271+ { id : 'notes' , label : t ( 'home.notes' ) }
272+ ] }
273+ active_tab = { active_tab }
274+ on_tab_change = { ( id ) => set_active_tab ( id as any ) }
251275 actions = {
252276 < >
253277 { roots . length > 1 && (
@@ -286,33 +310,37 @@ export const Home: React.FC<Props> = (props) => {
286310
287311 < UiSpacer height = { 4 } />
288312
289- < div className = { styles . inner__tasks } >
290- < UiTasks
291- tasks = { tasks [ active_root ] || [ ] }
292- on_reorder = { ( new_tasks ) => handle_reorder ( active_root , new_tasks ) }
293- on_change = { ( updated_task ) => {
294- handle_change ( active_root , tasks [ active_root ] || [ ] , updated_task )
295- } }
296- on_add = { ( timestamp ) => {
297- handle_add ( active_root , tasks [ active_root ] || [ ] , timestamp )
298- } }
299- on_add_subtask = { ( parent_task , timestamp ) => {
300- handle_add_subtask (
301- active_root ,
302- tasks [ active_root ] || [ ] ,
303- parent_task ,
304- timestamp
305- )
306- } }
307- on_delete = { ( timestamp ) => {
308- handle_delete ( active_root , timestamp )
309- } }
310- translations = { {
311- placeholder : t ( 'home.tasks.placeholder' ) ,
312- add_new : t ( 'home.tasks.add-new' )
313- } }
314- />
315- </ div >
313+ { active_tab === 'tasks' && (
314+ < div className = { styles . inner__tasks } >
315+ < UiTasks
316+ tasks = { tasks [ active_root ] || [ ] }
317+ on_reorder = { ( new_tasks ) => handle_reorder ( active_root , new_tasks ) }
318+ on_change = { ( updated_task ) => {
319+ handle_change ( active_root , tasks [ active_root ] || [ ] , updated_task )
320+ } }
321+ on_add = { ( timestamp ) => {
322+ handle_add ( active_root , tasks [ active_root ] || [ ] , timestamp )
323+ } }
324+ on_add_subtask = { ( parent_task , timestamp ) => {
325+ handle_add_subtask (
326+ active_root ,
327+ tasks [ active_root ] || [ ] ,
328+ parent_task ,
329+ timestamp
330+ )
331+ } }
332+ on_delete = { ( timestamp ) => {
333+ handle_delete ( active_root , timestamp )
334+ } }
335+ translations = { {
336+ placeholder : t ( 'home.tasks.placeholder' ) ,
337+ add_new : t ( 'home.tasks.add-new' )
338+ } }
339+ />
340+ </ div >
341+ ) }
342+
343+ { active_tab === 'notes' && notes_section }
316344 </ >
317345 )
318346
0 commit comments