@@ -17,6 +17,7 @@ module Model = {
1717 editors: Editors . Model . t ,
1818 explain_this: ExplainThisModel . t ,
1919 assistant: AssistantModel . t ,
20+ log_sidebar: LogSidebar . Model . t ,
2021 selection,
2122 };
2223
@@ -33,11 +34,13 @@ module Store = {
3334 );
3435 let explain_this = ExplainThisModel . Store . load() ;
3536 let assistant = AssistantModel . Store . load() ;
37+ let log_sidebar = LogSidebar . Model . init() ;
3638 {
3739 editors,
3840 globals,
3941 explain_this,
4042 assistant,
43+ log_sidebar,
4144 selection: Editors . Selection . default_selection(editors),
4245 };
4346 };
@@ -632,13 +635,7 @@ module View = {
632635 );
633636 };
634637
635- let top_bar =
636- (
637- ~globals,
638- ~inject: Update . t => Ui_effect . t (unit ),
639- ~editors,
640- ~next_log: option (Update . t ),
641- ) =>
638+ let top_bar = (~globals, ~inject: Update . t => Ui_effect . t (unit ), ~editors) =>
642639 div(
643640 ~attrs= [ Attr . id("top-bar" )] ,
644641 [
@@ -661,37 +658,6 @@ module View = {
661658 ),
662659 ] ,
663660 ),
664- ]
665- @ (
666- next_log
667- |> Option . map(_ =>
668- [
669- Widgets . button(
670- text("next" ),
671- _ => Ui_effect . Many ([ inject(Globals (Log (NextLog )))] ),
672- ~tooltip= "Play next action from imported log" ,
673- ),
674- Widgets . button(
675- text("skip" ),
676- _ => Ui_effect . Many ([ inject(Globals (Log (SkipLog )))] ),
677- ~tooltip= "Skip the rest of the imported log" ,
678- ),
679- Widgets . button(
680- text("skip exercise" ),
681- _ => Ui_effect . Many ([ inject(Globals (Log (SkipExercise )))] ),
682- ~tooltip= "Skip to the next exercise in the imported log" ,
683- ),
684- ]
685- )
686- |> Option . to_list
687- |> List . flatten
688- )
689- @ [
690- Widgets . button(
691- text("play/pause" ),
692- _ => Ui_effect . Many ([ inject(Globals (Log (ToggleReplay )))] ),
693- ~tooltip= "Toggle replaying imported log automatically" ,
694- ),
695661 ] ,
696662 );
697663
@@ -700,19 +666,22 @@ module View = {
700666 ~get_log_and: (string => unit ) => unit ,
701667 ~inject: Update . t => Ui_effect . t (unit ),
702668 ~cursor: Cursor . cursor (Editors . Update . t ),
703- ~next_log: option (Update . t ),
704669 {
705670 globals,
706671 editors,
707672 explain_this: explainThisModel,
708673 assistant: assistantModel,
674+ log_sidebar,
709675 selection,
710676 } as model: Model . t ,
711677 ) => {
678+ let log_count = LogCount . get() ;
712679 let globals = {
713680 ... globals,
714681 inject_global: x => inject(Globals (x)),
715682 get_log_and,
683+ get_log_count: _ =>
684+ failwith ("get_log_count is deprecated, use Log.get_count_sync" ),
716685 export_all: Export . export_all,
717686 };
718687 let bottom_bar = CursorInspector . view(~globals, cursor);
@@ -727,6 +696,8 @@ module View = {
727696 | MakeActive (s ) => inject(MakeActive (Scratch (s))),
728697 ~explainThisModel,
729698 ~assistantModel,
699+ ~log_model= log_sidebar,
700+ ~log_count,
730701 ~editor= Update . get_editor(model),
731702 cursor. info,
732703 );
@@ -778,7 +749,7 @@ module View = {
778749 };
779750
780751 [
781- top_bar(~globals, ~inject, ~editors, ~next_log ),
752+ top_bar(~globals, ~inject, ~editors),
782753 div(
783754 ~attrs= [
784755 Attr . id("main" ),
@@ -794,17 +765,12 @@ module View = {
794765 };
795766
796767 let view =
797- (
798- ~get_log_and,
799- ~inject: Update . t => Ui_effect . t (unit ),
800- ~next_log: option (Update . t ),
801- model: Model . t ,
802- ) => {
768+ (~get_log_and, ~inject: Update . t => Ui_effect . t (unit ), model: Model . t ) => {
803769 let cursor = Selection . get_cursor_info(~selection= model. selection, model);
804770 div(
805771 ~attrs= [ Attr . id("page" ), ... handlers(~cursor, ~inject, model)] ,
806772 [ FontSpecimen . view, JsUtil . clipboard_shim]
807- @ main_view(~get_log_and, ~cursor, ~inject, ~next_log , model),
773+ @ main_view(~get_log_and, ~cursor, ~inject, model),
808774 );
809775 };
810776};
0 commit comments