diff --git a/packages/components/src/components/SquiggleItem.tsx b/packages/components/src/components/SquiggleItem.tsx index 0e775f33..a64df99e 100644 --- a/packages/components/src/components/SquiggleItem.tsx +++ b/packages/components/src/components/SquiggleItem.tsx @@ -243,8 +243,20 @@ export const SquiggleItem: React.FC = ({ ); } + case "module": { + return ( + + Internal Module + + ); + } default: { - return <>Should be unreachable; + return ( +
+ No display for type: {" "} + {expression.tag} +
+ ); } } }; diff --git a/packages/components/src/components/SquigglePlayground.tsx b/packages/components/src/components/SquigglePlayground.tsx index 99c85da4..50c37980 100644 --- a/packages/components/src/components/SquigglePlayground.tsx +++ b/packages/components/src/components/SquigglePlayground.tsx @@ -9,6 +9,7 @@ import { CodeIcon, CogIcon, CurrencyDollarIcon, + EyeIcon, } from "@heroicons/react/solid"; import clsx from "clsx"; @@ -34,6 +35,8 @@ interface PlaygroundProps { /** If code is set, component becomes controlled */ code?: string; onCodeChange?(expr: string): void; + /** Should we show the editor? */ + showEditor?: boolean; } const schema = yup @@ -67,6 +70,7 @@ const schema = yup showTypes: yup.boolean(), showControls: yup.boolean(), showSummary: yup.boolean(), + showEditor: yup.boolean(), showSettingsPage: yup.boolean().default(false), diagramStart: yup .number() @@ -201,6 +205,7 @@ export const SquigglePlayground: FC = ({ showSummary = false, code: controlledCode, onCodeChange, + showEditor = true, }) => { const [uncontrolledCode, setUncontrolledCode] = useState( initialSquiggleString @@ -214,9 +219,10 @@ export const SquigglePlayground: FC = ({ sampleCount: 1000, xyPointLength: 1000, chartHeight: 150, - showTypes, - showControls, - showSummary, + showTypes: showTypes, + showControls: showControls, + showSummary: showSummary, + showEditor: showEditor, leftSizePercent: 50, showSettingsPage: false, diagramStart: 0, @@ -285,6 +291,11 @@ export const SquigglePlayground: FC = ({
+ = ({
); + const InFirstTab: React.FC<{ children: React.ReactNode }> = ({ + children, + }) => ( + + {children} + {samplingSettings} + {viewSettings} + {inputVariableSettings} + + ); + + let squiggleChart = ( + + ); + + let withEditor = ( +
+
+ +
+ { + if (controlledCode === undefined) { + // uncontrolled mode + setUncontrolledCode(newCode); + } + onCodeChange?.(newCode); + }} + oneLine={false} + showGutter={true} + height={height - 1} + /> +
+
+
+ +
{squiggleChart}
+
+ ); + + let withoutEditor = ( +
+ {squiggleChart} +
+ ); + return (
- - + + -
-
-
- - -
- { - if (controlledCode === undefined) { - // uncontrolled mode - setUncontrolledCode(newCode); - } - onCodeChange?.(newCode); - }} - oneLine={false} - showGutter={true} - height={height - 1} - /> -
-
- {samplingSettings} - {viewSettings} - {inputVariableSettings} -
-
- -
-
- -
-
+ {vars.showEditor ? withEditor : withoutEditor}