@@ -9,9 +9,8 @@ Top-level react component for task list
9
9
10
10
import { Button } from "antd" ;
11
11
import { fromJS } from "immutable" ;
12
-
13
12
import { Col , Row } from "@cocalc/frontend/antd-bootstrap" ;
14
- import { React , useEditorRedux } from "@cocalc/frontend/app-framework" ;
13
+ import { useEditorRedux } from "@cocalc/frontend/app-framework" ;
15
14
import { Loading } from "@cocalc/frontend/components" ;
16
15
import { Icon } from "@cocalc/frontend/components/icon" ;
17
16
import { TaskActions } from "./actions" ;
@@ -31,111 +30,115 @@ interface Props {
31
30
read_only ?: boolean ;
32
31
}
33
32
34
- export const TaskEditor : React . FC < Props > = React . memo (
35
- ( { actions, path, project_id, desc, read_only } ) => {
36
- const useEditor = useEditorRedux < TaskState > ( { project_id, path } ) ;
37
- const tasks = useEditor ( "tasks" ) ;
38
- const visible = desc . get ( "data-visible" ) ;
39
- const local_task_state = desc . get ( "data-local_task_state" ) ?? fromJS ( { } ) ;
40
- const local_view_state = desc . get ( "data-local_view_state" ) ?? fromJS ( { } ) ;
41
- const hashtags = desc . get ( "data-hashtags" ) ;
42
- const current_task_id = desc . get ( "data-current_task_id" ) ;
43
- const counts = desc . get ( "data-counts" ) ;
44
- const search_terms = desc . get ( "data-search_terms" ) ;
45
- const search_desc = desc . get ( "data-search_desc" ) ;
46
- const focus_find_box = desc . get ( "data-focus_find_box" ) ;
33
+ export function TaskEditor ( {
34
+ actions,
35
+ path,
36
+ project_id,
37
+ desc,
38
+ read_only,
39
+ } : Props ) {
40
+ const useEditor = useEditorRedux < TaskState > ( { project_id, path } ) ;
41
+ const tasks = useEditor ( "tasks" ) ;
42
+ const visible = desc . get ( "data-visible" ) ;
43
+ const local_task_state = desc . get ( "data-local_task_state" ) ?? fromJS ( { } ) ;
44
+ const local_view_state = desc . get ( "data-local_view_state" ) ?? fromJS ( { } ) ;
45
+ const hashtags = desc . get ( "data-hashtags" ) ;
46
+ const current_task_id = desc . get ( "data-current_task_id" ) ;
47
+ const counts = desc . get ( "data-counts" ) ;
48
+ const search_terms = desc . get ( "data-search_terms" ) ;
49
+ const search_desc = desc . get ( "data-search_desc" ) ;
50
+ const focus_find_box = desc . get ( "data-focus_find_box" ) ;
47
51
48
- if ( tasks == null || visible == null ) {
49
- return (
50
- < div
52
+ if ( tasks == null || visible == null ) {
53
+ return (
54
+ < div
55
+ style = { {
56
+ fontSize : "40px" ,
57
+ textAlign : "center" ,
58
+ padding : "15px" ,
59
+ color : "#999" ,
60
+ } }
61
+ >
62
+ < Loading />
63
+ </ div >
64
+ ) ;
65
+ }
66
+
67
+ return (
68
+ < div className = { "smc-vfill" } >
69
+ < Row >
70
+ < Col md = { 7 } style = { { display : "flex" , marginTop : "5px" } } >
71
+ < Button
72
+ style = { { marginLeft : "5px" } }
73
+ onClick = { ( ) => {
74
+ actions . new_task ( ) ;
75
+ } }
76
+ >
77
+ < Icon name = "plus-circle" /> New Task
78
+ </ Button >
79
+ < Find
80
+ style = { { flex : 1 } }
81
+ actions = { actions }
82
+ local_view_state = { local_view_state }
83
+ counts = { counts }
84
+ focus_find_box = { focus_find_box }
85
+ />
86
+ </ Col >
87
+ < Col md = { 5 } >
88
+ < DescVisible
89
+ num_visible = { visible ?. size }
90
+ num_tasks = { tasks ?. size }
91
+ local_view_state = { local_view_state }
92
+ search_desc = { search_desc }
93
+ />
94
+ </ Col >
95
+ </ Row >
96
+ < Row >
97
+ < Col md = { 12 } >
98
+ { hashtags != null && (
99
+ < HashtagBar
100
+ actions = { actions }
101
+ hashtags = { hashtags }
102
+ selected_hashtags = { local_view_state . get ( "selected_hashtags" ) }
103
+ />
104
+ ) }
105
+ </ Col >
106
+ </ Row >
107
+ < Headings actions = { actions } sort = { local_view_state . get ( "sort" ) } />
108
+ < div style = { { paddingTop : "5px" } } />
109
+ { visible . size == 0 ? (
110
+ < a
111
+ onClick = { actions . new_task }
51
112
style = { {
52
113
fontSize : "40px" ,
53
114
textAlign : "center" ,
54
115
padding : "15px" ,
55
- color : "#999" ,
56
116
} }
57
117
>
58
- < Loading />
59
- </ div >
60
- ) ;
61
- }
62
-
63
- return (
64
- < div className = { "smc-vfill" } >
65
- < Row >
66
- < Col md = { 7 } style = { { display : "flex" , marginTop : "5px" } } >
67
- < Button
68
- style = { { marginLeft : "5px" } }
69
- onClick = { ( ) => {
70
- actions . new_task ( ) ;
71
- } }
72
- >
73
- < Icon name = "plus-circle" /> New Task
74
- </ Button >
75
- < Find
76
- style = { { flex : 1 } }
77
- actions = { actions }
78
- local_view_state = { local_view_state }
79
- counts = { counts }
80
- focus_find_box = { focus_find_box }
81
- />
82
- </ Col >
83
- < Col md = { 5 } >
84
- < DescVisible
85
- num_visible = { visible ?. size }
86
- num_tasks = { tasks ?. size }
87
- local_view_state = { local_view_state }
88
- search_desc = { search_desc }
89
- />
90
- </ Col >
91
- </ Row >
92
- < Row >
93
- < Col md = { 12 } >
94
- { hashtags != null && (
95
- < HashtagBar
96
- actions = { actions }
97
- hashtags = { hashtags }
98
- selected_hashtags = { local_view_state . get ( "selected_hashtags" ) }
99
- />
100
- ) }
101
- </ Col >
102
- </ Row >
103
- < Headings actions = { actions } sort = { local_view_state . get ( "sort" ) } />
104
- < div style = { { paddingTop : "5px" } } />
105
- { visible . size == 0 ? (
106
- < a
107
- onClick = { actions . new_task }
108
- style = { {
109
- fontSize : "40px" ,
110
- textAlign : "center" ,
111
- padding : "15px" ,
112
- } }
113
- >
114
- Create a task...
115
- </ a >
116
- ) : (
117
- < TaskList
118
- actions = { actions }
119
- path = { path }
120
- project_id = { project_id }
121
- tasks = { tasks }
122
- visible = { visible }
123
- current_task_id = { current_task_id }
124
- local_task_state = { local_task_state }
125
- scrollState = { ( local_view_state as any ) . get ( "scrollState" ) ?. toJS ?.( ) }
126
- font_size = { desc . get ( "font_size" ) }
127
- sortable = {
128
- ! read_only &&
129
- is_sortable (
130
- local_view_state . getIn ( [ "sort" , "column" ] ) ?? HEADINGS [ 0 ]
131
- )
132
- }
133
- read_only = { read_only }
134
- selected_hashtags = { local_view_state . get ( "selected_hashtags" ) }
135
- search_terms = { search_terms }
136
- />
137
- ) }
138
- </ div >
139
- ) ;
140
- }
141
- ) ;
118
+ Create a task...
119
+ </ a >
120
+ ) : (
121
+ < TaskList
122
+ actions = { actions }
123
+ path = { path }
124
+ project_id = { project_id }
125
+ tasks = { tasks }
126
+ visible = { visible }
127
+ current_task_id = { current_task_id }
128
+ local_task_state = { local_task_state }
129
+ scrollState = { ( local_view_state as any ) . get ( "scrollState" ) ?. toJS ?.( ) }
130
+ font_size = { desc . get ( "font_size" ) }
131
+ sortable = {
132
+ ! read_only &&
133
+ is_sortable (
134
+ local_view_state . getIn ( [ "sort" , "column" ] ) ?? HEADINGS [ 0 ] ,
135
+ )
136
+ }
137
+ read_only = { read_only }
138
+ selected_hashtags = { local_view_state . get ( "selected_hashtags" ) }
139
+ search_terms = { search_terms }
140
+ />
141
+ ) }
142
+ </ div >
143
+ ) ;
144
+ }
0 commit comments