From 4c86d15b1e89b7450dc575b799ba44fa58701941 Mon Sep 17 00:00:00 2001 From: Doug Martin Date: Tue, 9 Apr 2024 06:27:41 -0400 Subject: [PATCH] fix: Disable inputs while animating [PT-187393298] --- src/components/app.tsx | 13 ++++++------- src/components/dataset.tsx | 2 ++ src/components/drawing.tsx | 9 ++++++++- src/components/drawing/add-text.tsx | 5 +++-- src/components/speed-toggle.tsx | 4 +++- src/components/toolbar.scss | 20 +++++++++++++++++--- src/components/toolbar.tsx | 10 +++++++--- 7 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/components/app.tsx b/src/components/app.tsx index be3d2e0..c07c139 100644 --- a/src/components/app.tsx +++ b/src/components/app.tsx @@ -340,7 +340,6 @@ export const App = () => { }, [setFastSimulation]); const uiForGenerate = () => { - const disabled = graphEmpty; const playLabel = generationMode === "playing" ? "Pause" : (generationMode === "paused" ? "Resume" : "Play"); const PlayOrPauseIcon = generationMode === "playing" ? PauseIcon : PlayIcon; const onPlayClick = generationMode === "playing" @@ -357,7 +356,7 @@ export const App = () => {
- {sortedNodes.map(n => )} @@ -370,7 +369,7 @@ export const App = () => { value={lengthLimit} onChange={handleChangeLengthLimit} min={1} - disabled={disabled} + disabled={animating} />
@@ -381,26 +380,26 @@ export const App = () => { value={delimiterValue} placeholder={delimiterPlaceholder} maxLength={3} - disabled={disabled} + disabled={animating} />
- +
diff --git a/src/components/dataset.tsx b/src/components/dataset.tsx index 80f8769..c040261 100644 --- a/src/components/dataset.tsx +++ b/src/components/dataset.tsx @@ -38,6 +38,7 @@ export const Dataset = (props: Props) => { return (
{ return (
{ return (
{ onChange={handleChangeNode} onCancel={handleClearSelectedNode} /> - +
); }; diff --git a/src/components/drawing/add-text.tsx b/src/components/drawing/add-text.tsx index d63e02e..e1367fa 100644 --- a/src/components/drawing/add-text.tsx +++ b/src/components/drawing/add-text.tsx @@ -4,6 +4,7 @@ import { clsx } from "clsx"; import "./add-text.scss"; interface Props { + disabled: boolean; visible: boolean; width: number; onChange: (newText: string) => void @@ -12,14 +13,14 @@ interface Props { // eslint-disable-next-line max-len const placeholder = "Create a Markov chain by typing or pasting text here. WARNING: your current Markov chain will be overwritten."; -export const AddText = forwardRef(({visible, width, onChange}: Props, ref) => { +export const AddText = forwardRef(({disabled, visible, width, onChange}: Props, ref) => { const handleChange = (e: React.ChangeEvent) => { onChange(e.currentTarget.value.trim()); }; return (
-