@@ -494,16 +494,13 @@ export function Wires({ className }: { className?: string }) {
494494 const [ step , inc ] = useReducer ( x => ( x + 1 ) % STEPS , 0 )
495495
496496 const ref = useRef < SVGSVGElement > ( null )
497- const backgroundRef = useRef < HTMLButtonElement > ( null )
498497
499498 useEffect ( ( ) => {
500499 const animate = document . querySelector (
501500 "#paint_sr_pri_highlight_linear_671_9150 animate" ,
502501 )
503502
504503 const onAnimationRepeat = ( ) => {
505- // we avoid spinning a second time if the user has just clicked the button
506- if ( backgroundRef . current ?. disabled ) return
507504 inc ( )
508505 }
509506
@@ -514,21 +511,6 @@ export function Wires({ className }: { className?: string }) {
514511 return ( ) => animate ?. removeEventListener ( "repeatEvent" , onAnimationRepeat )
515512 } , [ ] )
516513
517- // todo: remove this per Uri's request OR switch it to development only
518- const onBackgroundClick = useMemo (
519- ( ) =>
520- throttle ( ( ) => {
521- const button = backgroundRef . current
522- if ( ! button ) return
523- button . disabled = true
524- inc ( )
525- setTimeout ( ( ) => {
526- button . disabled = false
527- } , 750 )
528- } , 500 ) ,
529- [ ] ,
530- )
531-
532514 return (
533515 < div
534516 className = { clsx (
@@ -572,13 +554,10 @@ export function Wires({ className }: { className?: string }) {
572554 />
573555 < SVGDefinitions />
574556 </ svg >
575- < button
576- ref = { backgroundRef }
577- tabIndex = { - 1 }
578- onClick = { onBackgroundClick }
579- aria-label = { step === 2 ? "Show query again" : "Next step" }
580- className = "absolute inset-0 outline-none"
581- />
557+
558+ { process . env . NODE_ENV === "development" && (
559+ < NextStepButton onClick = { inc } />
560+ ) }
582561
583562 < div
584563 aria-hidden = { step === 2 }
@@ -877,3 +856,34 @@ function MobileDiagram({ step }: { step: number }) {
877856 </ svg >
878857 )
879858}
859+
860+ const NextStepButton =
861+ process . env . NODE_ENV === "development"
862+ ? ( { onClick } : { onClick : ( ) => void } ) => {
863+ const backgroundRef = useRef < HTMLButtonElement > ( null )
864+
865+ const onBackgroundClick = useMemo (
866+ ( ) =>
867+ throttle ( ( ) => {
868+ const button = backgroundRef . current
869+ if ( ! button ) return
870+ button . disabled = true
871+ onClick ( )
872+ setTimeout ( ( ) => {
873+ button . disabled = false
874+ } , 750 )
875+ } , 500 ) ,
876+ [ ] ,
877+ )
878+
879+ return (
880+ < button
881+ ref = { backgroundRef }
882+ tabIndex = { - 1 }
883+ onClick = { onBackgroundClick }
884+ aria-label = "Next step"
885+ className = "absolute inset-0 outline-none"
886+ />
887+ )
888+ }
889+ : ( ) => null
0 commit comments