diff options
author | 2024-04-19 09:02:56 +0530 | |
---|---|---|
committer | 2024-04-19 03:52:01 +0000 | |
commit | 03a12413d632a2a1613091e44c52ce46b4adc5b8 (patch) | |
tree | 0086e0f98a644df91644b9cdde5ca1515188113a /src/features | |
parent | 6.7.3-nightly.13 [skip ci] (diff) | |
download | ferdium-app-03a12413d632a2a1613091e44c52ce46b4adc5b8.tar.gz ferdium-app-03a12413d632a2a1613091e44c52ce46b4adc5b8.tar.zst ferdium-app-03a12413d632a2a1613091e44c52ce46b4adc5b8.zip |
Minor refactoring to move repeated code into utility class
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/webControls/components/WebControls.tsx | 5 | ||||
-rw-r--r-- | src/features/workspaces/components/WorkspaceDrawer.tsx | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/features/webControls/components/WebControls.tsx b/src/features/webControls/components/WebControls.tsx index aee568a7d..25b23cbee 100644 --- a/src/features/webControls/components/WebControls.tsx +++ b/src/features/webControls/components/WebControls.tsx | |||
@@ -15,6 +15,7 @@ import { | |||
15 | import withStyles, { type WithStylesProps } from 'react-jss'; | 15 | import withStyles, { type WithStylesProps } from 'react-jss'; |
16 | import { Tooltip as ReactTooltip } from 'react-tooltip'; | 16 | import { Tooltip as ReactTooltip } from 'react-tooltip'; |
17 | import Icon from '../../../components/ui/icon'; | 17 | import Icon from '../../../components/ui/icon'; |
18 | import { isEnterKeyPress, isEscapeKeyPress } from '../../../jsUtils'; | ||
18 | 19 | ||
19 | const messages = defineMessages({ | 20 | const messages = defineMessages({ |
20 | goHome: { | 21 | goHome: { |
@@ -215,7 +216,7 @@ class WebControls extends Component<IProps, IState> { | |||
215 | }); | 216 | }); |
216 | }} | 217 | }} |
217 | onKeyDown={event => { | 218 | onKeyDown={event => { |
218 | if (event.key === 'Enter') { | 219 | if (isEnterKeyPress(event.key)) { |
219 | this.setState({ | 220 | this.setState({ |
220 | editUrl: false, | 221 | editUrl: false, |
221 | }); | 222 | }); |
@@ -224,7 +225,7 @@ class WebControls extends Component<IProps, IState> { | |||
224 | if (this.inputRef?.current) { | 225 | if (this.inputRef?.current) { |
225 | this.inputRef.current.blur(); | 226 | this.inputRef.current.blur(); |
226 | } | 227 | } |
227 | } else if (event.key === 'Escape') { | 228 | } else if (isEscapeKeyPress(event.key)) { |
228 | this.setState({ | 229 | this.setState({ |
229 | editUrl: false, | 230 | editUrl: false, |
230 | inputUrl: url, | 231 | inputUrl: url, |
diff --git a/src/features/workspaces/components/WorkspaceDrawer.tsx b/src/features/workspaces/components/WorkspaceDrawer.tsx index e92bc4b60..4621482bc 100644 --- a/src/features/workspaces/components/WorkspaceDrawer.tsx +++ b/src/features/workspaces/components/WorkspaceDrawer.tsx | |||
@@ -9,7 +9,7 @@ import { | |||
9 | } from 'react-intl'; | 9 | } from 'react-intl'; |
10 | import withStyles, { type WithStylesProps } from 'react-jss'; | 10 | import withStyles, { type WithStylesProps } from 'react-jss'; |
11 | import { Tooltip as ReactTooltip } from 'react-tooltip'; | 11 | import { Tooltip as ReactTooltip } from 'react-tooltip'; |
12 | import type { StoresProps } from 'src/@types/ferdium-components.types'; | 12 | import type { StoresProps } from '../../../@types/ferdium-components.types'; |
13 | import { H1 } from '../../../components/ui/headline'; | 13 | import { H1 } from '../../../components/ui/headline'; |
14 | import Icon from '../../../components/ui/icon'; | 14 | import Icon from '../../../components/ui/icon'; |
15 | import workspaceActions from '../actions'; | 15 | import workspaceActions from '../actions'; |