diff --git a/src/components/LabView.tsx b/src/components/LabView.tsx index 70a1fbe..d3f5a6a 100644 --- a/src/components/LabView.tsx +++ b/src/components/LabView.tsx @@ -8,7 +8,6 @@ import Cuvette from "./icons/Cuvette"; import styles from "./labview.module.css"; import classNames from "classnames"; import ScaleBar from "./ScaleBar"; -import VisibilityControl from "./shared/VisibilityControl"; import { Module } from "../types"; const LabView: React.FC = () => { @@ -18,7 +17,7 @@ const LabView: React.FC = () => { getAgentColor, productName, } = useSimulariumSimulation(); - const { page, module } = useSimulariumUi(); + const { module, page, setViewportType } = useSimulariumUi(); const color = getAgentColor(productName); const colorGradient = useMemo(() => { const rainbow = new Rainbow(); @@ -26,21 +25,42 @@ const LabView: React.FC = () => { return rainbow; }, [color]); const position = (currentProductionConcentration / maxConcentration) * 100; - return ( -
- - - -
- + const isIntroPage = page === 1 && module === Module.A_B_AB; + + if (isIntroPage) { + // shows the full screen illustrated cuvette on the first page of the first module + return ( +
+
+ +
+
+ ); + } else { + return ( +
+
+ In the wet lab + +
+
+ +
+ +
+
-
- ); + ); + } }; export default LabView; diff --git a/src/components/ScaleBar.tsx b/src/components/ScaleBar.tsx index e34fc33..0915564 100644 --- a/src/components/ScaleBar.tsx +++ b/src/components/ScaleBar.tsx @@ -1,4 +1,5 @@ import React from "react"; +import classNames from "classnames"; import styles from "./scalebar.module.css"; import { MICRO } from "../constants"; @@ -6,9 +7,10 @@ import { useSimulariumSimulation } from "../hooks/useSimulationContext"; interface ScaleBarProps { productColor: string; + className?: string; } -const ScaleBar: React.FC = ({ productColor }) => { +const ScaleBar: React.FC = ({ className, productColor }) => { const { maxConcentration } = useSimulariumSimulation(); const labelArray = []; const interval = maxConcentration / 5; @@ -17,7 +19,7 @@ const ScaleBar: React.FC = ({ productColor }) => { } return (
@@ -29,8 +31,6 @@ const ScaleBar: React.FC = ({ productColor }) => { ))}
{ const isFirstPageOfFirstModule = page === FIRST_PAGE[module] + 1 && module === Module.A_B_AB; + const isLabViewOpen = viewportType === ViewType.Lab; let buttonStyle: React.CSSProperties = { top: 16, @@ -44,26 +45,32 @@ const ViewSwitch: React.FC = () => { return (
- + ) : ( ) } > - {viewportType === ViewType.Lab ? "Molecular" : "Lab"}{" "} - view + {/* on the first page we show text, but on other pages we just show the icon */} + {isFirstPageOfFirstModule + ? `${isLabViewOpen ? "Simulation" : "Lab"} view` + : null} - {viewportType === ViewType.Lab ? : null} + {isLabViewOpen ? : null} = (props) => { }; interface OverlayButtonProps extends React.ComponentProps { + active?: boolean; children?: React.ReactNode; style?: React.CSSProperties; } export const OverlayButton: React.FC = (props) => { - const { style } = props; + const { active, style } = props; let buttonStyle: React.CSSProperties = { position: "absolute", zIndex: zStacking.viewerOverlay, @@ -89,5 +90,12 @@ export const OverlayButton: React.FC = (props) => { if (style) { buttonStyle = { ...buttonStyle, ...style }; } - return ; + return ( + + ); }; diff --git a/src/components/shared/VisibilityControl.tsx b/src/components/shared/VisibilityControl.tsx index 46d0c4d..eb1f8a1 100644 --- a/src/components/shared/VisibilityControl.tsx +++ b/src/components/shared/VisibilityControl.tsx @@ -28,7 +28,7 @@ const VisibilityControl: React.FC = ({ let shouldRender = true; - if (includedPages) { + if (includedPages && module in includedPages) { shouldRender = includedPages[module]?.includes(page) ?? false; } else if (excludedPages) { shouldRender = !excludedPages[module]?.includes(page); diff --git a/src/components/shared/button-library.module.css b/src/components/shared/button-library.module.css index 86c429e..c109d9f 100644 --- a/src/components/shared/button-library.module.css +++ b/src/components/shared/button-library.module.css @@ -37,6 +37,17 @@ transition: color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); } +/* Filled-in state for a toggle-style overlay button, e.g. to show it's currently active/open */ +.tertiary.active { + background: var(--light-purple) !important; + border-color: var(--light-purple) !important; + color: var(--background-color) !important; +} + +.tertiary.active :global(.custom-icon) { + color: var(--background-color) !important; +} + .icon { width: 12px !important; min-width: 12px !important; diff --git a/src/content/HighAffinity.tsx b/src/content/HighAffinity.tsx index 8f2218c..e224636 100644 --- a/src/content/HighAffinity.tsx +++ b/src/content/HighAffinity.tsx @@ -104,23 +104,6 @@ export const highAffinityContentArray: PageContent[] = [ layout: LayoutType.LiveSimulation, progressionElement: VIEW_SWITCH_ID, }, - { - content: ( - <> - The clear liquid is slowly turning yellow as the simulation - progresses, but it is taking a long time to change. Can you - estimate the concentration of ? - - ), - callToAction: ( - <> - Click Molecular view to switch back. - - ), - section: Section.Introduction, - layout: LayoutType.LiveSimulation, - progressionElement: VIEW_SWITCH_ID, - }, { content: ( <> @@ -161,21 +144,6 @@ export const highAffinityContentArray: PageContent[] = [ layout: LayoutType.LiveSimulation, progressionElement: PLAY_BUTTON_ID, }, - { - content: ( - <>Randomizing the positions is simulating a well-mixed solution. - ), - callToAction: ( - <> - Click Lab view to see what the cuvette looks - like now. - - ), - - section: Section.Introduction, - layout: LayoutType.LiveSimulation, - progressionElement: VIEW_SWITCH_ID, - }, { content: ( <> @@ -186,14 +154,14 @@ export const highAffinityContentArray: PageContent[] = [ ), callToAction: ( <> - Click Molecular view to switch back to the - simulation. + When you're done observing the color changes to the solution in + the cuvette, pause the simulation to move on. ), section: Section.Introduction, layout: LayoutType.LiveSimulation, - progressionElement: VIEW_SWITCH_ID, + progressionElement: PLAY_BUTTON_ID, }, { title: "Start the experiment",