Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/concentration-display/Concentration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ const Concentration: React.FC<AgentProps> = ({
} else {
let percentage: number | undefined = undefined;
const startingConcentration = concentration[agent];
if (startingConcentration !== undefined) {
if (
startingConcentration !== undefined &&
startingConcentration !== 0
) {
percentage =
(startingConcentration / maxConcentration) *
widthMinusMargins;
Expand Down
2 changes: 1 addition & 1 deletion src/components/quiz-questions/EquilibriumQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const EquilibriumQuestion: React.FC = () => {
</>
}
failureMessage="Please try again. Look carefully at what is happening in each of the plots to help find the answer."
id="Equilibrium"
formID="Equilibrium"
/>
</VisibilityControl>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/quiz-questions/KdQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const KdQuestion: React.FC<KdQuestionProps> = ({ kd, canAnswer }) => {
<Flex gap={8} align="baseline" style={{ maxWidth: 130 }}>
<InputNumber
aria-labelledby="kd question"
value={selectedAnswer || ""}
value={selectedAnswer ?? ""}
onChange={handleAnswerSelection}
placeholder="Type value..."
Comment on lines 105 to 109
/>
Expand All @@ -121,7 +121,7 @@ const KdQuestion: React.FC<KdQuestionProps> = ({ kd, canAnswer }) => {
successMessage={getSuccessMessage(selectedAnswer!)}
failureMessage="Visit the “Learn how to derive Kd” button above, then use the Equilibrium concentration plot to answer."
formState={formState}
id="Kd Value"
formID="Kd Value"
/>
</VisibilityControl>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/quiz-questions/KiQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const KiQuestion: React.FC<KiQuestionProps> = ({ canAnswer, ki }) => {
<Flex gap={8} align="baseline" style={{ maxWidth: 130 }}>
<InputNumber
aria-labelledby="ki-question"
value={selectedAnswer || ""}
value={selectedAnswer ?? ""}
onChange={handleAnswerSelection}
placeholder="Type value..."
Comment on lines 84 to 88
/>
Expand All @@ -101,7 +101,7 @@ const KiQuestion: React.FC<KiQuestionProps> = ({ canAnswer, ki }) => {
successMessage={getSuccessMessage(selectedAnswer!)}
failureMessage='Visit the "Learn how to derive Ki" button above, then use the Equilibrium concentration plot to answer.'
formState={formState}
id="Ki Value"
formID="Ki Value"
/>
</VisibilityControl>
);
Expand Down
12 changes: 6 additions & 6 deletions src/components/quiz-questions/QuizForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ interface QuizFormProps {
formState: FormState;
successMessage: string | JSX.Element;
failureMessage: string;
id: string;
formID: string;
}

const QuizForm: React.FC<QuizFormProps> = ({
title,
id,
formID,
formContent,
onSubmit,
formState,
Expand All @@ -33,12 +33,12 @@ const QuizForm: React.FC<QuizFormProps> = ({
const { lastOpened, setLastOpened } = React.useContext(CenterPanelContext);
const [show, setShow] = React.useState(false);

const isFormMaximized = lastOpened === id;
const minimizedTitle = `Q:${id}`;
const isFormMaximized = lastOpened === formID;
const minimizedTitle = `Q:${formID}`;
Copy link
Copy Markdown
Contributor

@ShrimpCryptid ShrimpCryptid May 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like the rename, but I don't think the variable name formId is descriptive enough for its use case-- it's used as both a unique identifier and as a minimized title, but the name only really implies the first. We talked about making these two different props in #214, would you still want to make that change?


// open form on mount
useEffect(() => {
setLastOpened(id);
setLastOpened(formID);
setTimeout(() => {
setShow(true);
}, 1000);
Expand All @@ -47,7 +47,7 @@ const QuizForm: React.FC<QuizFormProps> = ({

const toggleFormVisibility = () => {
if (!isFormMaximized) {
setLastOpened(id);
setLastOpened(formID);
} else {
setLastOpened(null);
}
Expand Down
Loading