Commit 82af13a 1 parent ada139d commit 82af13a Copy full SHA for 82af13a
File tree 4 files changed +17
-3
lines changed
packages/transaction-log/src
4 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ const CustomizeDialog: React.FC<CustomizeDialogProps> = ({
19
19
onApply,
20
20
visibleFilters,
21
21
handleFilterVisibilityChange,
22
- onRestoreDefaults
22
+ onRestoreDefaults,
23
+ isDefaultState
23
24
} ) => {
24
25
return (
25
26
< Dialog open = { open } onClose = { onClose } fullWidth >
@@ -46,7 +47,11 @@ const CustomizeDialog: React.FC<CustomizeDialogProps> = ({
46
47
</ DialogContent >
47
48
< DialogActions >
48
49
< Box sx = { { flexGrow : 1 } } >
49
- < Button onClick = { onRestoreDefaults } color = "primary" >
50
+ < Button
51
+ onClick = { onRestoreDefaults }
52
+ color = "primary"
53
+ disabled = { isDefaultState }
54
+ >
50
55
RESTORE DEFAULT
51
56
</ Button >
52
57
</ Box >
Original file line number Diff line number Diff line change @@ -148,6 +148,12 @@ const CustomFilters: React.FC<CustomFilterProps> = ({
148
148
setTempVisibleFilters ( defaultVisibleFilters )
149
149
}
150
150
151
+ const isDefaultState = filters => {
152
+ return Object . keys ( defaultVisibleFilters ) . every (
153
+ key => filters [ key ] === defaultVisibleFilters [ key ]
154
+ )
155
+ }
156
+
151
157
useEffect ( ( ) => {
152
158
debounceFetchTransactionLogs ( null , true )
153
159
return ( ) => debounceFetchTransactionLogs . cancel ( )
@@ -419,6 +425,7 @@ const CustomFilters: React.FC<CustomFilterProps> = ({
419
425
visibleFilters = { tempVisibleFilters }
420
426
handleFilterVisibilityChange = { handleFilterVisibilityChange }
421
427
onRestoreDefaults = { handleRestoreDefaults }
428
+ isDefaultState = { isDefaultState ( tempVisibleFilters ) }
422
429
/>
423
430
</ Box >
424
431
)
Original file line number Diff line number Diff line change @@ -84,7 +84,8 @@ const customizeDialogProps: CustomizeDialogProps = {
84
84
handleFilterVisibilityChange : (
85
85
event : React . ChangeEvent < HTMLInputElement >
86
86
) => { } ,
87
- onRestoreDefaults : ( ) => { }
87
+ onRestoreDefaults : ( ) => { } ,
88
+ isDefaultState : true
88
89
}
89
90
90
91
const settingsDialogProps : SettingsDialogProps = {
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ export interface CustomizeDialogProps {
84
84
event : React . ChangeEvent < HTMLInputElement >
85
85
) => void
86
86
onRestoreDefaults : ( ) => void
87
+ isDefaultState : boolean
87
88
}
88
89
89
90
export interface SettingsDialogProps {
You can’t perform that action at this time.
0 commit comments