diff --git a/src/ConsolePanel.res b/src/ConsolePanel.res
index b7bba9587..6c72f86f0 100644
--- a/src/ConsolePanel.res
+++ b/src/ConsolePanel.res
@@ -25,9 +25,11 @@ let make = (~logs, ~appendLog) => {
{React.string("Console")}
{switch logs {
| [] =>
- React.string(
- "Add some 'Console.log' to your code and click 'Run' or enable 'Auto-run' to see your logs here.",
- )
+
+ {React.string(
+ "Add some 'Console.log' to your code and click 'Run' or enable 'Auto-run' to see your logs here.",
+ )}
+
| logs =>
let content =
logs
diff --git a/src/Playground.res b/src/Playground.res
index 8ea138658..76511a5aa 100644
--- a/src/Playground.res
+++ b/src/Playground.res
@@ -1,14 +1,3 @@
-/*
- TODO / Idea list:
- - Fix issue with Reason where a comment on the last line causes a infinite loop
- - Add settings pane to set moduleSystem
- - Add advanced mode for enabling OCaml output as well
-
- More advanced tasks:
- - Fix syntax convertion issue where comments are stripped on Reason <-> Res convertion
- - Try to get Reason's recoverable errors working
- */
-
%%raw(`
if (typeof window !== "undefined" && typeof window.navigator !== "undefined") {
require("codemirror/mode/javascript/javascript");
@@ -42,6 +31,22 @@ module DropdownSelect = {
}
module ToggleSelection = {
+ module SelectionOption = {
+ @react.component
+ let make = (~label, ~isActive, ~disabled, ~onClick) => {
+
+ }
+ }
+
@react.component
let make = (
~onChange: 'a => unit,
@@ -58,41 +63,21 @@ module ToggleSelection = {
values
}
- let selectedIndex = switch Belt.Array.getIndexBy(values, lang => lang === selected) {
- | Some(i) => i
- | None => 0
- }
-
- let elements = Array.mapWithIndex(values, (value, i) => {
- let active = i === selectedIndex ? "bg-fire text-white font-bold" : "bg-gray-80 opacity-50"
- let label = toLabel(value)
-
- let onMouseDown = evt => {
- ReactEvent.Mouse.preventDefault(evt)
- ReactEvent.Mouse.stopPropagation(evt)
-
- if i !== selectedIndex {
- switch values[i] {
- | Some(value) => onChange(value)
- | None => ()
+
+ {values
+ ->Array.map(value => {
+ let label = toLabel(value)
+ let isActive = value === selected
+ let onClick = _event => {
+ if !isActive {
+ onChange(value)
}
}
- }
-
- // Required for iOS Safari 12
- let onClick = _ => ()
-
-
- })
-
{React.array(elements)}
+
+ })
+ ->React.array}
+
}
}
@@ -697,9 +682,9 @@ module WarningFlagsWidget = {
})
->React.array
->Some
- | Typing(typing) =>
+ | Typing(typing) if typing.suggestion != NoSuggestion =>
let suggestions = switch typing.suggestion {
- | NoSuggestion => React.string("Type + / - followed by a number or letter (e.g. +a+1)")
+ | NoSuggestion => React.null
| ErrorSuggestion(msg) => React.string(msg)
| FuzzySuggestions({precedingTokens, selected, results, modifier}) =>
Array.mapWithIndex(results, ((flag, desc), i) => {
@@ -753,7 +738,8 @@ module WarningFlagsWidget = {
})->React.array
}
Some(suggestions)
- | HideSuggestion(_) => None
+
+ | Typing(_) | HideSuggestion(_) => None
}
let suggestionBox =
@@ -793,20 +779,12 @@ module WarningFlagsWidget = {
| []
| [{enabled: false, flag: "a"}] => React.null
| _ =>
- let onMouseDown = evt => {
- ReactEvent.Mouse.preventDefault(evt)
+ let onClick = _evt => {
onUpdate([{WarningFlagDescription.Parser.enabled: false, flag: "a"}])
}
- // For iOS12 compat
- let onClick = _ => ()
- let onFocus = evt => {
- ReactEvent.Focus.preventDefault(evt)
- ReactEvent.Focus.stopPropagation(evt)
- }
-