aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2024-04-19 09:02:56 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2024-04-19 03:52:01 +0000
commit03a12413d632a2a1613091e44c52ce46b4adc5b8 (patch)
tree0086e0f98a644df91644b9cdde5ca1515188113a /src/features
parent6.7.3-nightly.13 [skip ci] (diff)
downloadferdium-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.tsx5
-rw-r--r--src/features/workspaces/components/WorkspaceDrawer.tsx2
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 {
15import withStyles, { type WithStylesProps } from 'react-jss'; 15import withStyles, { type WithStylesProps } from 'react-jss';
16import { Tooltip as ReactTooltip } from 'react-tooltip'; 16import { Tooltip as ReactTooltip } from 'react-tooltip';
17import Icon from '../../../components/ui/icon'; 17import Icon from '../../../components/ui/icon';
18import { isEnterKeyPress, isEscapeKeyPress } from '../../../jsUtils';
18 19
19const messages = defineMessages({ 20const 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';
10import withStyles, { type WithStylesProps } from 'react-jss'; 10import withStyles, { type WithStylesProps } from 'react-jss';
11import { Tooltip as ReactTooltip } from 'react-tooltip'; 11import { Tooltip as ReactTooltip } from 'react-tooltip';
12import type { StoresProps } from 'src/@types/ferdium-components.types'; 12import type { StoresProps } from '../../../@types/ferdium-components.types';
13import { H1 } from '../../../components/ui/headline'; 13import { H1 } from '../../../components/ui/headline';
14import Icon from '../../../components/ui/icon'; 14import Icon from '../../../components/ui/icon';
15import workspaceActions from '../actions'; 15import workspaceActions from '../actions';