Skip to content

Commit fb5af12

Browse files
committed
Add setting to hide sidebar
1 parent a066921 commit fb5af12

File tree

6 files changed

+38
-34
lines changed

6 files changed

+38
-34
lines changed

src/web/Main.re

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,7 @@ let start = {
231231
let%arr app_model = app_model
232232
and app_inject = app_inject;
233233
try(
234-
History.View.view(
235-
app_model,
236-
~inject=app_inject,
237-
~get_log_and=Log.get_and,
238-
~next_log=
239-
Util.ListUtil.hd_opt(app_model.future_log) |> Option.map(snd),
240-
)
234+
History.View.view(app_model, ~inject=app_inject, ~get_log_and=Log.get_and)
241235
) {
242236
| exc =>
243237
print_endline(

src/web/Settings.re

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module Model = {
1010
context_inspector: bool,
1111
instructor_mode: bool,
1212
benchmark: bool,
13+
show_log_panel: bool,
1314
explainThis: ExplainThisModel.Settings.t,
1415
assistant: AssistantSettings.t,
1516
sidebar: SidebarModel.Settings.t,
@@ -43,6 +44,7 @@ module Model = {
4344
context_inspector: false,
4445
instructor_mode: false,
4546
benchmark: false,
47+
show_log_panel: false,
4648
explainThis: {
4749
show: true,
4850
show_feedback: false,
@@ -113,6 +115,7 @@ module Update = {
113115
| Benchmark
114116
| ContextInspector
115117
| InstructorMode
118+
| ShowLogPanel
116119
| Evaluation(evaluation)
117120
| Sidebar(SidebarModel.Settings.action)
118121
| ExplainThis(ExplainThisModel.Settings.action)
@@ -312,6 +315,11 @@ module Update = {
312315
},
313316
}
314317
}
318+
| ShowLogPanel => {
319+
...settings,
320+
show_log_panel:
321+
!settings.show_log_panel && ExerciseSettings.show_instructor,
322+
}
315323
| Benchmark => {
316324
...settings,
317325
benchmark: !settings.benchmark,

src/web/app/History.re

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,7 @@ module Selection = {
295295

296296
module View = {
297297
let view =
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);
298+
(~get_log_and, ~inject: Update.t => Ui_effect.t(unit), model: Model.t) => {
299+
Page.View.view(~get_log_and, ~inject, model.current);
305300
};
306301
};

src/web/app/Page.re

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -635,13 +635,7 @@ module View = {
635635
);
636636
};
637637

638-
let top_bar =
639-
(
640-
~globals,
641-
~inject: Update.t => Ui_effect.t(unit),
642-
~editors,
643-
~next_log: option(Update.t),
644-
) =>
638+
let top_bar = (~globals, ~inject: Update.t => Ui_effect.t(unit), ~editors) =>
645639
div(
646640
~attrs=[Attr.id("top-bar")],
647641
[
@@ -672,7 +666,6 @@ module View = {
672666
~get_log_and: (string => unit) => unit,
673667
~inject: Update.t => Ui_effect.t(unit),
674668
~cursor: Cursor.cursor(Editors.Update.t),
675-
~next_log: option(Update.t),
676669
{
677670
globals,
678671
editors,
@@ -756,7 +749,7 @@ module View = {
756749
};
757750

758751
[
759-
top_bar(~globals, ~inject, ~editors, ~next_log),
752+
top_bar(~globals, ~inject, ~editors),
760753
div(
761754
~attrs=[
762755
Attr.id("main"),
@@ -772,17 +765,12 @@ module View = {
772765
};
773766

774767
let view =
775-
(
776-
~get_log_and,
777-
~inject: Update.t => Ui_effect.t(unit),
778-
~next_log: option(Update.t),
779-
model: Model.t,
780-
) => {
768+
(~get_log_and, ~inject: Update.t => Ui_effect.t(unit), model: Model.t) => {
781769
let cursor = Selection.get_cursor_info(~selection=model.selection, model);
782770
div(
783771
~attrs=[Attr.id("page"), ...handlers(~cursor, ~inject, model)],
784772
[FontSpecimen.view, JsUtil.clipboard_shim]
785-
@ main_view(~get_log_and, ~cursor, ~inject, ~next_log, model),
773+
@ main_view(~get_log_and, ~cursor, ~inject, model),
786774
);
787775
};
788776
};

src/web/app/sidebar/Sidebar.re

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ let persistent_view = (~globals: Globals.t) =>
102102
explain_this_tab(~globals),
103103
assistant_tab(~globals),
104104
probes_tab(~globals),
105-
log_control_tab(~globals),
106-
],
105+
]
106+
@ (
107+
globals.settings.show_log_panel ? [log_control_tab(~globals)] : []
108+
),
107109
),
108110
],
109111
);

src/web/view/NutMenu.re

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ let dev_group = (~globals) => {
116116
~globals,
117117
"Developer",
118118
[
119-
("✓", "Benchmarks", globals.settings.benchmark, Benchmark),
119+
(
120+
"✓",
121+
"Benchmarks",
122+
globals.settings.benchmark,
123+
Settings.Update.Benchmark,
124+
),
120125
("𝑒", "Elaboration", globals.settings.core.elaborate, Elaborate),
121126
("↵", "Whitespace", globals.settings.secondary_icons, SecondaryIcons),
122127
(
@@ -125,7 +130,19 @@ let dev_group = (~globals) => {
125130
globals.settings.core.flip_animations,
126131
FlipAnimations,
127132
),
128-
],
133+
]
134+
@ (
135+
ExerciseSettings.show_instructor
136+
? [
137+
(
138+
"📃",
139+
"Log Panel",
140+
globals.settings.show_log_panel,
141+
ShowLogPanel,
142+
),
143+
]
144+
: []
145+
),
129146
);
130147
};
131148

0 commit comments

Comments
 (0)