diff --git a/packages/components/src/components/DistributionChart.tsx b/packages/components/src/components/DistributionChart.tsx index bfa650bb..52f17c91 100644 --- a/packages/components/src/components/DistributionChart.tsx +++ b/packages/components/src/components/DistributionChart.tsx @@ -46,8 +46,10 @@ export const DistributionChart: React.FC = ({ let spec = buildVegaSpec(isLogX, isExpY); let widthProp = width ? width : size.width; if (widthProp < 20) { - console.warn(`Width of Distribution is set to ${widthProp}, which is too small`) - widthProp = 20 + console.warn( + `Width of Distribution is set to ${widthProp}, which is too small` + ); + widthProp = 20; } // Check whether we should disable the checkbox @@ -170,9 +172,15 @@ const SummaryTable: React.FC = ({ let TableHeadCell: React.FC<{ children: React.ReactNode }> = ({ children, - }) => {children}; + }) => ( + + {children} + + ); let Cell: React.FC<{ children: React.ReactNode }> = ({ children }) => ( - {children} + + {children} + ); return ( diff --git a/packages/components/src/components/SquigglePlayground.tsx b/packages/components/src/components/SquigglePlayground.tsx index 06672c95..53da8f92 100644 --- a/packages/components/src/components/SquigglePlayground.tsx +++ b/packages/components/src/components/SquigglePlayground.tsx @@ -104,6 +104,50 @@ function classNames(...classes: string[]) { return classes.filter(Boolean).join(" "); } +let tab = (key: string, iconName: string) => { + let iconStyle = (isSelected: boolean) => + classNames( + "-ml-0.5 mr-2 h-4 w-4 ", + isSelected ? "text-slate-500" : "text-gray-400 group-hover:text-gray-900" + ); + + let icon = (selected: boolean) => + ({ + code: , + cog: , + squareBar: , + dollar: , + }[iconName]); + + return ( + + {({ selected }) => ( + + )} + + ); +}; + let SquigglePlayground: FC = ({ initialSquiggleString = "", height = 500, @@ -153,51 +197,171 @@ let SquigglePlayground: FC = ({ } }; - let tab = (key: string, iconName: string) => { - let iconStyle = (isSelected: boolean) => - classNames( - "-ml-0.5 mr-2 h-4 w-4 ", - isSelected - ? "text-slate-500" - : "text-gray-400 group-hover:text-gray-900" - ); + let samplingSettings = ( +
+ + <> + +

+ How many samples to use for Monte Carlo simulations. This can + occasionally be overridden by specific Squiggle programs. +

+ +
+ + <> + +

+ When distributions are converted into PointSet shapes, we need to + know how many coordinates to use. +

+ +
+
+ ); - let icon = (selected: boolean) => - ({ - code: , - cog: , - squareBar: , - dollar: , - }[iconName]); + let viewSettings = ( +
+
+

+ General Display Settings +

+ + + +
+
+ +
+
+ +
+
+
- return ( - - {({ selected }) => ( - +
+

+ Distribution Display Settings +

+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ +
+

+ Function Display Settings +

+ +

+ When displaying functions of single variables that return numbers or + distributions, we need to use defaults for the x-axis. We need to + select a minimum and maximum value of x to sample, and a number n of + the number of points to sample. +

+
+ + + + + + + + + +
+
+
+ ); + + let inputVariableSettings = ( + <> +

+ Import Variables from JSON +

+

+ You can import variables from JSON into your Squiggle code. Variables + are accessed with dollar signs. For example, "timeNow" would be accessed + as "$timeNow". +

+
+ +
+
+ {importsAreValid ? ( + + <> + + ) : ( + + You must use valid json in this editor. + )} - - ); - }; +
+ + ); return ( @@ -224,175 +388,9 @@ let SquigglePlayground: FC = ({ /> - - -
- - <> - -

- How many samples to use for Monte Carlo simulations. - This can occasionally be overridden by specific Squiggle - programs. -

- -
- - <> - -

- When distributions are converted into PointSet shapes, - we need to know how many coordinates to use. -

- -
-
-
- - -
-
-

- General Display Settings -

- - - -
-
- -
-
- -
-
-
- -
-

- Distribution Display Settings -

- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
- -
-

- Function Display Settings -

- -

- When displaying functions of single variables that return - numbers or distributions, we need to use defaults for the - x-axis. We need to select a minimum and maximum value of x - to sample, and a number n of the number of points to - sample. -

-
- - - - - - - - - -
-
-
-
- - -

- Import Variables from JSON -

-

- You can import variables from JSON into your Squiggle code. - Variables are accessed with dollar signs. For example, - "timeNow" would be accessed as "$timeNow". -

- <> - -
- -
-
- {importsAreValid ? ( - - <> - - ) : ( - - You must use valid json in this editor. - - )} -
- -
+ {samplingSettings} + {viewSettings} + {inputVariableSettings}