@@ -34,6 +34,118 @@ pub fn make_default_grid() -> BuildGridContext {
3434}
3535
3636pub fn make_default_board ( ) -> BuildGridContext {
37+ let mut grid_builder = GridBuilder :: new ( ) ;
38+ // text
39+ let text_field = FieldBuilder :: new ( RichTextTypeOptionBuilder :: default ( ) )
40+ . name ( "Description" )
41+ . visibility ( true )
42+ . primary ( true )
43+ . build ( ) ;
44+ let text_field_id = text_field. id . clone ( ) ;
45+ grid_builder. add_field ( text_field) ;
46+
47+ // single select
48+ let to_do_option = SelectOptionPB :: with_color ( "To Do" , SelectOptionColorPB :: Purple ) ;
49+ let doing_option = SelectOptionPB :: with_color ( "Doing" , SelectOptionColorPB :: Orange ) ;
50+ let done_option = SelectOptionPB :: with_color ( "Done" , SelectOptionColorPB :: Yellow ) ;
51+ let single_select_type_option = SingleSelectTypeOptionBuilder :: default ( )
52+ . add_option ( to_do_option. clone ( ) )
53+ . add_option ( doing_option. clone ( ) )
54+ . add_option ( done_option. clone ( ) ) ;
55+ let single_select_field = FieldBuilder :: new ( single_select_type_option)
56+ . name ( "Status" )
57+ . visibility ( true )
58+ . build ( ) ;
59+ let single_select_field_id = single_select_field. id . clone ( ) ;
60+ grid_builder. add_field ( single_select_field) ;
61+
62+ // MultiSelect
63+ let work_option = SelectOptionPB :: with_color ( "Work" , SelectOptionColorPB :: Aqua ) ;
64+ let travel_option = SelectOptionPB :: with_color ( "Travel" , SelectOptionColorPB :: Green ) ;
65+ let fun_option = SelectOptionPB :: with_color ( "Fun" , SelectOptionColorPB :: Lime ) ;
66+ let health_option = SelectOptionPB :: with_color ( "Health" , SelectOptionColorPB :: Pink ) ;
67+ let multi_select_type_option = MultiSelectTypeOptionBuilder :: default ( )
68+ . add_option ( travel_option. clone ( ) )
69+ . add_option ( work_option. clone ( ) )
70+ . add_option ( fun_option. clone ( ) )
71+ . add_option ( health_option. clone ( ) ) ;
72+ let multi_select_field = FieldBuilder :: new ( multi_select_type_option)
73+ . name ( "Tags" )
74+ . visibility ( true )
75+ . build ( ) ;
76+ let multi_select_field_id = multi_select_field. id . clone ( ) ;
77+ grid_builder. add_field ( multi_select_field) ;
78+
79+ for i in 0 ..3 {
80+ let mut row_builder = RowRevisionBuilder :: new ( grid_builder. block_id ( ) , grid_builder. field_revs ( ) ) ;
81+ row_builder. insert_select_option_cell ( & single_select_field_id, to_do_option. id . clone ( ) ) ;
82+ match i {
83+ 0 => {
84+ row_builder. insert_text_cell ( & text_field_id, "Update AppFlowy Website" . to_string ( ) ) ;
85+ row_builder. insert_select_option_cell ( & multi_select_field_id, work_option. id . clone ( ) ) ;
86+ }
87+ 1 => {
88+ row_builder. insert_text_cell ( & text_field_id, "Learn French" . to_string ( ) ) ;
89+ row_builder. insert_select_option_cell ( & multi_select_field_id, travel_option. id . clone ( ) ) ;
90+ }
91+
92+ 2 => {
93+ row_builder. insert_text_cell ( & text_field_id, "Exercise 4x/week" . to_string ( ) ) ;
94+ row_builder. insert_select_option_cell ( & multi_select_field_id, fun_option. id . clone ( ) ) ;
95+ }
96+ _ => { }
97+ }
98+ let row = row_builder. build ( ) ;
99+ grid_builder. add_row ( row) ;
100+ }
101+
102+ for i in 0 ..3 {
103+ let mut row_builder = RowRevisionBuilder :: new ( grid_builder. block_id ( ) , grid_builder. field_revs ( ) ) ;
104+ row_builder. insert_select_option_cell ( & single_select_field_id, doing_option. id . clone ( ) ) ;
105+ match i {
106+ 0 => {
107+ row_builder. insert_text_cell ( & text_field_id, "Learn how to swim" . to_string ( ) ) ;
108+ row_builder. insert_select_option_cell ( & multi_select_field_id, fun_option. id . clone ( ) ) ;
109+ }
110+ 1 => {
111+ row_builder. insert_text_cell ( & text_field_id, "Meditate 10 mins each day" . to_string ( ) ) ;
112+ row_builder. insert_select_option_cell ( & multi_select_field_id, health_option. id . clone ( ) ) ;
113+ }
114+
115+ 2 => {
116+ row_builder. insert_text_cell ( & text_field_id, "Write atomic essays " . to_string ( ) ) ;
117+ row_builder. insert_select_option_cell ( & multi_select_field_id, fun_option. id . clone ( ) ) ;
118+ }
119+ _ => { }
120+ }
121+ let row = row_builder. build ( ) ;
122+ grid_builder. add_row ( row) ;
123+ }
124+
125+ for i in 0 ..2 {
126+ let mut row_builder = RowRevisionBuilder :: new ( grid_builder. block_id ( ) , grid_builder. field_revs ( ) ) ;
127+ row_builder. insert_select_option_cell ( & single_select_field_id, done_option. id . clone ( ) ) ;
128+ match i {
129+ 0 => {
130+ row_builder. insert_text_cell ( & text_field_id, "Publish an article" . to_string ( ) ) ;
131+ row_builder. insert_select_option_cell ( & multi_select_field_id, work_option. id . clone ( ) ) ;
132+ }
133+ 1 => {
134+ row_builder. insert_text_cell ( & text_field_id, "Visit Chicago" . to_string ( ) ) ;
135+ row_builder. insert_select_option_cell ( & multi_select_field_id, travel_option. id . clone ( ) ) ;
136+ }
137+
138+ _ => { }
139+ }
140+ let row = row_builder. build ( ) ;
141+ grid_builder. add_row ( row) ;
142+ }
143+
144+ grid_builder. build ( )
145+ }
146+
147+ #[ allow( dead_code) ]
148+ pub fn make_default_board2 ( ) -> BuildGridContext {
37149 let mut grid_builder = GridBuilder :: new ( ) ;
38150 // text
39151 let text_field = FieldBuilder :: new ( RichTextTypeOptionBuilder :: default ( ) )
0 commit comments