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 = () => {
-
@@ -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 (
-
+
);
});
diff --git a/src/components/speed-toggle.tsx b/src/components/speed-toggle.tsx
index 2cbb836..33e3e51 100644
--- a/src/components/speed-toggle.tsx
+++ b/src/components/speed-toggle.tsx
@@ -4,10 +4,11 @@ import "./speed-toggle.scss";
interface Props {
fastSimulation: boolean;
+ disabled: boolean;
onChange: (newValue: boolean) => void;
}
-export const SpeedToggle = ({fastSimulation, onChange}: Props) => {
+export const SpeedToggle = ({fastSimulation, disabled, onChange}: Props) => {
const handleChange = (e: React.ChangeEvent) => {
onChange(e.target.checked);
};
@@ -27,6 +28,7 @@ export const SpeedToggle = ({fastSimulation, onChange}: Props) => {
title={title}
checked={fastSimulation}
onChange={handleChange}
+ disabled={disabled}
/>
Fast
diff --git a/src/components/toolbar.scss b/src/components/toolbar.scss
index 632be8a..a961e82 100644
--- a/src/components/toolbar.scss
+++ b/src/components/toolbar.scss
@@ -21,11 +21,15 @@
background-color: #dceff2;
}
+ &:disabled {
+ background-color: #ffffff59;
+ }
+
&.notImplemented {
cursor: not-allowed;
}
- &:hover {
+ &:hover:not(:disabled) {
background-color: rgba(114, 191, 202, 0.12);
}
}
@@ -40,7 +44,7 @@
button {
background-color: #177991;
- &:hover {
+ &:hover:not(:disabled) {
background-color: rgba(114, 191, 202, 0.12);
svg {
@@ -49,6 +53,16 @@
}
}
}
- }
+
+ &:disabled {
+ background-color: #ffffff59;
+
+ svg {
+ path {
+ fill: #177991;
+ }
+ }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/components/toolbar.tsx b/src/components/toolbar.tsx
index a64db1e..e86519f 100644
--- a/src/components/toolbar.tsx
+++ b/src/components/toolbar.tsx
@@ -46,12 +46,14 @@ const toolIcons: Record = {
interface ToolbarButtonProps {
tool: Tool
+ disabled: boolean
selectedTool: Tool;
onClick: (tool: Tool) => void;
}
interface ToolbarProps {
tools: Tool[]
+ disabled: boolean
onToolSelected: (tool: Tool) => void;
onReset: () => void;
onReturnToMainMenu: () => void;
@@ -59,7 +61,7 @@ interface ToolbarProps {
onRecenterView: () => void;
}
-export const ToolbarButton = ({tool, selectedTool, onClick}: ToolbarButtonProps) => {
+export const ToolbarButton = ({tool, disabled, selectedTool, onClick}: ToolbarButtonProps) => {
const handleClick = () => onClick(tool);
const selected = toggleableTools.includes(tool) && tool === selectedTool;
const notImplemented = notImplementedTools.includes(tool);
@@ -71,7 +73,7 @@ export const ToolbarButton = ({tool, selectedTool, onClick}: ToolbarButtonProps)
title={title}
onClick={handleClick}
className={clsx({selected, notImplemented})}
- disabled={notImplemented}
+ disabled={disabled || notImplemented}
>
@@ -79,7 +81,7 @@ export const ToolbarButton = ({tool, selectedTool, onClick}: ToolbarButtonProps)
};
export const Toolbar = (props: ToolbarProps) => {
- const {tools, onToolSelected, onReset, onReturnToMainMenu, onFitView, onRecenterView} = props;
+ const {tools, disabled, onToolSelected, onReset, onReturnToMainMenu, onFitView, onRecenterView} = props;
const [selectedTool, setSelectedTool] = useState("select");
const handleToolSelected = useCallback((tool: Tool) => {
@@ -110,6 +112,7 @@ export const Toolbar = (props: ToolbarProps) => {
{topTools.map(tool => (
{
{bottomTools.map(tool => (