@@ -106,22 +106,21 @@ module Update = {
106106 );
107107 model |> Updated . return_quiet;
108108 | FinishImport (None ) =>
109- print_endline ("Log import failed" );
109+ LogSidebar . log_error ("Log import failed" );
110110 model |> Updated . return_quiet;
111111 | FinishImport (Some (data )) =>
112112 let of_data = (data: string ): list((float, Page . Update . t)) =>
113113 Export . import_just_log(data)
114114 |> Sexplib . Sexp . of_string
115115 |> Log . Entry . s_of_sexp_opt
116116 |> List . filter_map(x => x);
117- // |> List.filter(((ts, _action)) => ts > 1757794060000.0);
118117 let actions =
119118 data
120119 |> of_data
121120 |> Log . flatten_imports(~of_data)
122121 |> (
123122 x => {
124- print_endline (
123+ LogSidebar . log_info (
125124 "Imported log entries: " ++ string_of_int(List . length(x)),
126125 );
127126 x;
@@ -135,15 +134,15 @@ module Update = {
135134 | NextLog =>
136135 switch (model. future_log) {
137136 | [] =>
138- print_endline ("No next log action to perform" );
137+ LogSidebar . log_info ("No next log action to perform" );
139138 model |> Updated . return_quiet;
140139 | [ (t , next ), ... rest ] =>
141- print_endline(
142- "Applying next log action: "
143- ++ JsUtil . print_timestamp(t)
144- ++ " :: "
145- ++ Page . Update . show(next),
140+ LogSidebar . log_action(
141+ "Applying next log action" ,
142+ Some (JsUtil . print_timestamp(t)),
146143 );
144+ // Keep full action expression in console for detailed debugging
145+ print_endline("Full action: " ++ Page . Update . show(next));
147146 try ({
148147 let updated =
149148 Page . Update . update(
@@ -171,7 +170,7 @@ module Update = {
171170 };
172171 }) {
173172 | _ =>
174- print_endline ("Failed to apply log action" );
173+ LogSidebar . log_error ("Failed to apply log action" );
175174 Model . {
176175 ... model,
177176 future_log:
@@ -185,10 +184,10 @@ module Update = {
185184 };
186185 }
187186 | SkipLog =>
188- print_endline ("Skipping the next log entry" );
187+ LogSidebar . log_action ("Skipping the next log entry" , None );
189188 switch (model. future_log) {
190189 | [] =>
191- print_endline ("No log entry to skip" );
190+ LogSidebar . log_info ("No log entry to skip" );
192191 model |> return_quiet;
193192 | [ (_ , _ ), ... rest ] =>
194193 {
@@ -198,7 +197,10 @@ module Update = {
198197 |> return_quiet
199198 };
200199 | SkipExercise =>
201- print_endline("Skipping to the next exercise in the log" );
200+ LogSidebar . log_action(
201+ "Skipping to the next exercise in the log" ,
202+ None ,
203+ );
202204 let rec skip_to_next_exercise = (log: list ((float , Page . Update . t ))) =>
203205 switch (log) {
204206 | [] => []
@@ -217,6 +219,10 @@ module Update = {
217219 replay_toggle: ! model. replay_toggle,
218220 }
219221 |> return_quiet
222+ | ClearLog =>
223+ Log . DB . clear_and(() => () );
224+ LogSidebar . log_info("Log cleared" );
225+ model |> return_quiet;
220226 }
221227 | action =>
222228 let current =
@@ -289,7 +295,12 @@ module Selection = {
289295
290296module View = {
291297 let view =
292- (~get_log_and, ~inject: Update . t => Ui_effect . t (unit ), model: Model . t ) => {
293- Page . View . view(~get_log_and, ~inject, model. current);
298+ (
299+ ~get_log_and,
300+ ~inject: Update . t => Ui_effect . t (unit ),
301+ ~next_log: option (Update . t ),
302+ model: Model . t ,
303+ ) => {
304+ Page . View . view(~get_log_and, ~inject, ~next_log, model. current);
294305 };
295306};
0 commit comments