Skip to content

Commit

Permalink
Disable test runbar when chip is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
netalondon committed Jan 4, 2024
1 parent 189e5a9 commit 3355323
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions components/src/runbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface RunbarTooltipOverrides {

export const Runbar = (props: {
runner: Timer;
disabled?: boolean;
prefix?: ReactNode;
children?: ReactNode;
overrideTooltips?: Partial<RunbarTooltipOverrides>;
Expand Down Expand Up @@ -47,6 +48,7 @@ export const Runbar = (props: {
{props.prefix}
<button
className="flex-0"
disabled={props.disabled}
onClick={() => runner.actions.frame()}
data-tooltip={props.overrideTooltips?.step ?? `Step`}
data-placement="bottom"
Expand All @@ -56,6 +58,7 @@ export const Runbar = (props: {
</button>
<button
className="flex-0"
disabled={props.disabled}
onClick={() =>
runner.state.running ? runner.actions.stop() : runner.actions.start()
}
Expand All @@ -71,6 +74,7 @@ export const Runbar = (props: {
</button>
<button
className="flex-0"
disabled={props.disabled}
onClick={() => runner.actions.reset()}
data-tooltip={props.overrideTooltips?.reset ?? `Reset`}
data-placement="bottom"
Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ export const Chip = () => {
<Trans>Test</Trans>
</div>
<div className="flex-2">
{runner.current && <Runbar runner={runner.current} />}
{runner.current && (
<Runbar runner={runner.current} disabled={state.sim.invalid} />
)}
</div>
<div>
<button onClick={loadTest}>
Expand Down

0 comments on commit 3355323

Please sign in to comment.