1- import { useState , useEffect , useContext } from 'react'
1+ import { useContext } from 'react'
22import styles from './Footer.module.scss'
33import { use_compacting } from '@shared/hooks'
44import { LayoutContext } from '../../../contexts/LayoutContext'
@@ -10,39 +10,18 @@ type Props = {
1010}
1111
1212export const Footer : React . FC < Props > = ( props ) => {
13- const {
14- can_undo,
15- on_apply_click,
16- on_undo_click,
17- apply_button_enabling_trigger_count
18- } = useContext ( LayoutContext )
13+ const { can_undo, on_apply_click, on_undo_click } = useContext ( LayoutContext )
1914
2015 const { t } = use_translation ( )
2116
2217 const history_label = t ( 'footer.action.history' )
2318 const undo_label = t ( 'footer.action.undo' )
2419 const apply_label = t ( 'footer.action.apply-from' )
2520
26- const [ is_apply_disabled_temporarily , set_is_apply_disabled_temporarily ] =
27- useState ( false )
28-
2921 const { container_ref, compact_step } = use_compacting ( )
3022
31- useEffect ( ( ) => {
32- set_is_apply_disabled_temporarily ( false )
33- } , [ apply_button_enabling_trigger_count ] )
34-
35- useEffect ( ( ) => {
36- // Timeout prevents jitter of non disabled state caused by order of updates.
37- setTimeout ( ( ) => {
38- set_is_apply_disabled_temporarily ( false )
39- } , 500 )
40- } , [ can_undo ] )
41-
4223 const handle_apply_click = ( ) => {
43- set_is_apply_disabled_temporarily ( true )
4424 on_apply_click ( )
45- setTimeout ( ( ) => set_is_apply_disabled_temporarily ( false ) , 3000 )
4625 }
4726
4827 return (
@@ -70,7 +49,6 @@ export const Footer: React.FC<Props> = (props) => {
7049 className = { styles [ 'apply-button' ] }
7150 onClick = { handle_apply_click }
7251 title = { t ( 'footer.apply-title' ) }
73- disabled = { is_apply_disabled_temporarily }
7452 >
7553 { apply_label }
7654 </ button >
0 commit comments