diff options
author | Vijay A <vraravam@users.noreply.github.com> | 2023-05-28 13:48:21 +0530 |
---|---|---|
committer | Vijay A <vraravam@users.noreply.github.com> | 2023-05-28 13:48:21 +0530 |
commit | 99ca310c73024b51fed1f3077375eed7827f2c20 (patch) | |
tree | 2bd15986f448129a2291acba90ccc6bf68a233e0 /src/components | |
parent | Disable in-app auto-updates for portable windows installation (fixes #1088) (... (diff) | |
download | ferdium-app-99ca310c73024b51fed1f3077375eed7827f2c20.tar.gz ferdium-app-99ca310c73024b51fed1f3077375eed7827f2c20.tar.zst ferdium-app-99ca310c73024b51fed1f3077375eed7827f2c20.zip |
Fix issues reported by sonarqube linter
Diffstat (limited to 'src/components')
25 files changed, 66 insertions, 64 deletions
diff --git a/src/components/auth/Invite.tsx b/src/components/auth/Invite.tsx index cebef9365..4f2cb19fe 100644 --- a/src/components/auth/Invite.tsx +++ b/src/components/auth/Invite.tsx | |||
@@ -86,7 +86,7 @@ class Invite extends Component<IProps, IState> { | |||
86 | }, | 86 | }, |
87 | }, | 87 | }, |
88 | }), | 88 | }), |
89 | // TODO - [TS DEBT] need to fix this type once mobx-react-form is updated to next version | 89 | // TODO: [TS DEBT] need to fix this type once mobx-react-form is updated to next version |
90 | ] as any, | 90 | ] as any, |
91 | }, | 91 | }, |
92 | }); | 92 | }); |
diff --git a/src/components/auth/SetupAssistant.tsx b/src/components/auth/SetupAssistant.tsx index c5fb79919..fdcbba45e 100644 --- a/src/components/auth/SetupAssistant.tsx +++ b/src/components/auth/SetupAssistant.tsx | |||
@@ -135,7 +135,7 @@ const styles = theme => ({ | |||
135 | interface IProps extends WithStylesProps<typeof styles>, WrappedComponentProps { | 135 | interface IProps extends WithStylesProps<typeof styles>, WrappedComponentProps { |
136 | onSubmit: (...args: any[]) => void; | 136 | onSubmit: (...args: any[]) => void; |
137 | isInviteSuccessful?: boolean; | 137 | isInviteSuccessful?: boolean; |
138 | services: any; // TODO - [TS DEBT] check legacy services type | 138 | services: any; // TODO: [TS DEBT] check legacy services type |
139 | isSettingUpServices: boolean; | 139 | isSettingUpServices: boolean; |
140 | } | 140 | } |
141 | 141 | ||
diff --git a/src/components/layout/AppLayout.tsx b/src/components/layout/AppLayout.tsx index 86b4e787e..97795212a 100644 --- a/src/components/layout/AppLayout.tsx +++ b/src/components/layout/AppLayout.tsx | |||
@@ -14,7 +14,6 @@ import { Component as PublishDebugInfo } from '../../features/publishDebugInfo'; | |||
14 | import ErrorBoundary from '../util/ErrorBoundary'; | 14 | import ErrorBoundary from '../util/ErrorBoundary'; |
15 | import { updateVersionParse } from '../../helpers/update-helpers'; | 15 | import { updateVersionParse } from '../../helpers/update-helpers'; |
16 | 16 | ||
17 | // import globalMessages from '../../i18n/globalMessages'; | ||
18 | import { isMac, isWindows } from '../../environment'; | 17 | import { isMac, isWindows } from '../../environment'; |
19 | import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; | 18 | import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; |
20 | import { workspaceStore } from '../../features/workspaces'; | 19 | import { workspaceStore } from '../../features/workspaces'; |
@@ -45,13 +44,11 @@ const messages = defineMessages({ | |||
45 | }, | 44 | }, |
46 | }); | 45 | }); |
47 | 46 | ||
48 | let transition = 'none'; | 47 | const transition = window?.matchMedia('(prefers-reduced-motion: no-preference)') |
48 | ? 'transform 0.5s ease' | ||
49 | : 'none'; | ||
49 | 50 | ||
50 | if (window && window.matchMedia('(prefers-reduced-motion: no-preference)')) { | 51 | const styles = (theme: { workspaces: { drawer: { width: any } } }) => ({ |
51 | transition = 'transform 0.5s ease'; | ||
52 | } | ||
53 | |||
54 | const styles = theme => ({ | ||
55 | appContent: { | 52 | appContent: { |
56 | // width: `calc(100% + ${theme.workspaces.drawer.width}px)`, | 53 | // width: `calc(100% + ${theme.workspaces.drawer.width}px)`, |
57 | width: '100%', | 54 | width: '100%', |
diff --git a/src/components/services/content/ConnectionLostBanner.tsx b/src/components/services/content/ConnectionLostBanner.tsx index 88731f3b9..7040337f0 100644 --- a/src/components/services/content/ConnectionLostBanner.tsx +++ b/src/components/services/content/ConnectionLostBanner.tsx | |||
@@ -21,10 +21,11 @@ const messages = defineMessages({ | |||
21 | }, | 21 | }, |
22 | }); | 22 | }); |
23 | 23 | ||
24 | const buttonTransition = | 24 | const buttonTransition = window?.matchMedia( |
25 | window && window.matchMedia('(prefers-reduced-motion: no-preference)') | 25 | '(prefers-reduced-motion: no-preference)', |
26 | ? 'opacity 0.25s' | 26 | ) |
27 | : 'none'; | 27 | ? 'opacity 0.25s' |
28 | : 'none'; | ||
28 | 29 | ||
29 | const styles = theme => ({ | 30 | const styles = theme => ({ |
30 | root: { | 31 | root: { |
diff --git a/src/components/services/content/ServiceView.tsx b/src/components/services/content/ServiceView.tsx index 0754bccc5..19dcdd07a 100644 --- a/src/components/services/content/ServiceView.tsx +++ b/src/components/services/content/ServiceView.tsx | |||
@@ -21,7 +21,7 @@ interface IProps { | |||
21 | reload: () => void; | 21 | reload: () => void; |
22 | edit: () => void; | 22 | edit: () => void; |
23 | enable: () => void; | 23 | enable: () => void; |
24 | // isActive?: boolean; // TODO - [TECH DEBT][PROP NOT USED IN COMPONENT] check it | 24 | // isActive?: boolean; // TODO: [TECH DEBT][PROP NOT USED IN COMPONENT] check it |
25 | stores?: RealStores; | 25 | stores?: RealStores; |
26 | isSpellcheckerEnabled: boolean; | 26 | isSpellcheckerEnabled: boolean; |
27 | } | 27 | } |
@@ -35,7 +35,7 @@ interface IState { | |||
35 | @inject('stores', 'actions') | 35 | @inject('stores', 'actions') |
36 | @observer | 36 | @observer |
37 | class ServiceView extends Component<IProps, IState> { | 37 | class ServiceView extends Component<IProps, IState> { |
38 | // hibernationTimer = null; // TODO - [TS DEBT] class property not reassigned, need to find its purpose | 38 | // hibernationTimer = null; // TODO: [TS DEBT] class property not reassigned, need to find its purpose |
39 | 39 | ||
40 | autorunDisposer: IReactionDisposer | undefined; | 40 | autorunDisposer: IReactionDisposer | undefined; |
41 | 41 | ||
@@ -65,7 +65,7 @@ class ServiceView extends Component<IProps, IState> { | |||
65 | componentWillUnmount() { | 65 | componentWillUnmount() { |
66 | this.autorunDisposer!(); | 66 | this.autorunDisposer!(); |
67 | clearTimeout(this.forceRepaintTimeout!); | 67 | clearTimeout(this.forceRepaintTimeout!); |
68 | // clearTimeout(this.hibernationTimer); // TODO - [TS DEBT] class property not reassigned, need to find its purpose | 68 | // clearTimeout(this.hibernationTimer); // TODO: [TS DEBT] class property not reassigned, need to find its purpose |
69 | } | 69 | } |
70 | 70 | ||
71 | render() { | 71 | render() { |
@@ -111,7 +111,7 @@ class ServiceView extends Component<IProps, IState> { | |||
111 | {service.hasCrashed && ( | 111 | {service.hasCrashed && ( |
112 | <WebviewCrashHandler | 112 | <WebviewCrashHandler |
113 | name={service.recipe.name} | 113 | name={service.recipe.name} |
114 | // webview={service.webview} // TODO - [TECH DEBT][PROPS NOT EXIST IN COMPONENT] check it | 114 | // webview={service.webview} // TODO: [TECH DEBT][PROPS NOT EXIST IN COMPONENT] check it |
115 | reload={reload} | 115 | reload={reload} |
116 | /> | 116 | /> |
117 | )} | 117 | )} |
@@ -177,7 +177,7 @@ class ServiceView extends Component<IProps, IState> { | |||
177 | {service.isActive && ( | 177 | {service.isActive && ( |
178 | <ServiceDisabled | 178 | <ServiceDisabled |
179 | name={service.name === '' ? service.recipe.name : service.name} | 179 | name={service.name === '' ? service.recipe.name : service.name} |
180 | // webview={service.webview} // TODO - [TECH DEBT][PROPS NOT EXIST IN COMPONENT] check it | 180 | // webview={service.webview} // TODO: [TECH DEBT][PROPS NOT EXIST IN COMPONENT] check it |
181 | enable={enable} | 181 | enable={enable} |
182 | /> | 182 | /> |
183 | )} | 183 | )} |
diff --git a/src/components/services/content/ServiceWebview.tsx b/src/components/services/content/ServiceWebview.tsx index ac8d1ea66..008e1b227 100644 --- a/src/components/services/content/ServiceWebview.tsx +++ b/src/components/services/content/ServiceWebview.tsx | |||
@@ -32,7 +32,7 @@ class ServiceWebview extends Component<IProps> { | |||
32 | reaction( | 32 | reaction( |
33 | () => this.webview, | 33 | () => this.webview, |
34 | () => { | 34 | () => { |
35 | if (this.webview && this.webview.view) { | 35 | if (this.webview?.view) { |
36 | this.webview.view.addEventListener('console-message', e => { | 36 | this.webview.view.addEventListener('console-message', e => { |
37 | debug('Service logged a message:', e.message); | 37 | debug('Service logged a message:', e.message); |
38 | }); | 38 | }); |
@@ -97,7 +97,7 @@ class ServiceWebview extends Component<IProps> { | |||
97 | <ElectronWebView | 97 | <ElectronWebView |
98 | ref={webview => { | 98 | ref={webview => { |
99 | this._setWebview(webview); | 99 | this._setWebview(webview); |
100 | if (webview && webview.view) { | 100 | if (webview?.view) { |
101 | webview.view.addEventListener( | 101 | webview.view.addEventListener( |
102 | 'did-stop-loading', | 102 | 'did-stop-loading', |
103 | this.refocusWebview, | 103 | this.refocusWebview, |
@@ -122,7 +122,7 @@ class ServiceWebview extends Component<IProps> { | |||
122 | }); | 122 | }); |
123 | }, 0); | 123 | }, 0); |
124 | }} | 124 | }} |
125 | // onUpdateTargetUrl={this.updateTargetUrl} // TODO - [TS DEBT] need to check where its from | 125 | // onUpdateTargetUrl={this.updateTargetUrl} // TODO: [TS DEBT] need to check where its from |
126 | useragent={service.userAgent} | 126 | useragent={service.userAgent} |
127 | disablewebsecurity={ | 127 | disablewebsecurity={ |
128 | service.recipe.disablewebsecurity ? true : undefined | 128 | service.recipe.disablewebsecurity ? true : undefined |
diff --git a/src/components/services/content/Services.tsx b/src/components/services/content/Services.tsx index fa26edaa6..5766e0d75 100644 --- a/src/components/services/content/Services.tsx +++ b/src/components/services/content/Services.tsx | |||
@@ -42,8 +42,8 @@ interface IProps extends WrappedComponentProps, WithStylesProps<typeof styles> { | |||
42 | services?: Service[]; | 42 | services?: Service[]; |
43 | setWebviewReference: () => void; | 43 | setWebviewReference: () => void; |
44 | detachService: () => void; | 44 | detachService: () => void; |
45 | // handleIPCMessage: () => void; // TODO - [TECH DEBT] later check it | 45 | // handleIPCMessage: () => void; // TODO: [TECH DEBT] later check it |
46 | // openWindow: () => void; // TODO - [TECH DEBT] later check it | 46 | // openWindow: () => void; // TODO: [TECH DEBT] later check it |
47 | reload: (options: { serviceId: string }) => void; | 47 | reload: (options: { serviceId: string }) => void; |
48 | openSettings: (options: { path: string }) => void; | 48 | openSettings: (options: { path: string }) => void; |
49 | update: (options: { | 49 | update: (options: { |
@@ -88,10 +88,10 @@ class Services extends Component<IProps, IState> { | |||
88 | render(): ReactElement { | 88 | render(): ReactElement { |
89 | const { | 89 | const { |
90 | services = [], | 90 | services = [], |
91 | // handleIPCMessage, // TODO - [TECH DEBT] later check it | 91 | // handleIPCMessage, // TODO: [TECH DEBT] later check it |
92 | setWebviewReference, | 92 | setWebviewReference, |
93 | detachService, | 93 | detachService, |
94 | // openWindow, // TODO - [TECH DEBT] later check it | 94 | // openWindow, // TODO: [TECH DEBT] later check it |
95 | reload, | 95 | reload, |
96 | openSettings, | 96 | openSettings, |
97 | update, | 97 | update, |
@@ -136,10 +136,10 @@ class Services extends Component<IProps, IState> { | |||
136 | <ServiceView | 136 | <ServiceView |
137 | key={service.id} | 137 | key={service.id} |
138 | service={service} | 138 | service={service} |
139 | // handleIPCMessage={handleIPCMessage} // TODO - [TECH DEBT][PROPS NOT EXIST IN COMPONENT] later check it | 139 | // handleIPCMessage={handleIPCMessage} // TODO: [TECH DEBT][PROPS NOT EXIST IN COMPONENT] later check it |
140 | setWebviewRef={setWebviewReference} | 140 | setWebviewRef={setWebviewReference} |
141 | detachService={detachService} | 141 | detachService={detachService} |
142 | // openWindow={openWindow} // TODO - [TECH DEBT][PROPS NOT EXIST IN COMPONENT] later check it | 142 | // openWindow={openWindow} // TODO: [TECH DEBT][PROPS NOT EXIST IN COMPONENT] later check it |
143 | reload={() => reload({ serviceId: service.id })} | 143 | reload={() => reload({ serviceId: service.id })} |
144 | edit={() => openSettings({ path: `services/edit/${service.id}` })} | 144 | edit={() => openSettings({ path: `services/edit/${service.id}` })} |
145 | enable={() => | 145 | enable={() => |
diff --git a/src/components/settings/navigation/SettingsNavigation.tsx b/src/components/settings/navigation/SettingsNavigation.tsx index 4e2c7f410..6ffaa411f 100644 --- a/src/components/settings/navigation/SettingsNavigation.tsx +++ b/src/components/settings/navigation/SettingsNavigation.tsx | |||
@@ -187,7 +187,7 @@ class SettingsNavigation extends Component<IProps> { | |||
187 | <button | 187 | <button |
188 | type="button" | 188 | type="button" |
189 | // @ts-ignore | 189 | // @ts-ignore |
190 | to="/auth/logout" // TODO - [TS DEBT] Need to check if button take this prop | 190 | to="/auth/logout" // TODO: [TS DEBT] Need to check if button take this prop |
191 | className="settings-navigation__link" | 191 | className="settings-navigation__link" |
192 | onClick={this.handleLogout.bind(this)} | 192 | onClick={this.handleLogout.bind(this)} |
193 | > | 193 | > |
diff --git a/src/components/settings/services/ServiceItem.tsx b/src/components/settings/services/ServiceItem.tsx index 0737a680c..bf2dfa9da 100644 --- a/src/components/settings/services/ServiceItem.tsx +++ b/src/components/settings/services/ServiceItem.tsx | |||
@@ -32,7 +32,7 @@ class ServiceItem extends Component<IProps> { | |||
32 | render(): ReactElement { | 32 | render(): ReactElement { |
33 | const { | 33 | const { |
34 | service, | 34 | service, |
35 | // toggleAction, // TODO - [TECH DEBT][PROP NOT USED IN COMPONENT] check it later | 35 | // toggleAction, // TODO: [TECH DEBT][PROP NOT USED IN COMPONENT] check it later |
36 | goToServiceForm, | 36 | goToServiceForm, |
37 | } = this.props; | 37 | } = this.props; |
38 | const { intl } = this.props; | 38 | const { intl } = this.props; |
diff --git a/src/components/settings/services/ServicesDashboard.tsx b/src/components/settings/services/ServicesDashboard.tsx index 36057902f..d64779a36 100644 --- a/src/components/settings/services/ServicesDashboard.tsx +++ b/src/components/settings/services/ServicesDashboard.tsx | |||
@@ -54,7 +54,7 @@ const messages = defineMessages({ | |||
54 | interface IProps extends WrappedComponentProps { | 54 | interface IProps extends WrappedComponentProps { |
55 | services: Service[]; | 55 | services: Service[]; |
56 | isLoading: boolean; | 56 | isLoading: boolean; |
57 | // toggleService: any; // TODO - - [TECH DEBT] check it later | 57 | // toggleService: any; // TODO: [TECH DEBT] check it later |
58 | filterServices: any; | 58 | filterServices: any; |
59 | resetFilter: () => void; | 59 | resetFilter: () => void; |
60 | goTo: (to: To, state?: any) => void; | 60 | goTo: (to: To, state?: any) => void; |
@@ -70,7 +70,7 @@ class ServicesDashboard extends Component<IProps> { | |||
70 | const { | 70 | const { |
71 | services, | 71 | services, |
72 | isLoading, | 72 | isLoading, |
73 | // toggleService, // TODO - - [TECH DEBT] check it later | 73 | // toggleService, // TODO: [TECH DEBT] check it later |
74 | filterServices, | 74 | filterServices, |
75 | resetFilter, | 75 | resetFilter, |
76 | goTo, | 76 | goTo, |
@@ -163,7 +163,7 @@ class ServicesDashboard extends Component<IProps> { | |||
163 | <ServiceItem | 163 | <ServiceItem |
164 | key={service.id} | 164 | key={service.id} |
165 | service={service} | 165 | service={service} |
166 | // TODO - - [TECH DEBT][PROPS NOT USED IN COMPONENT] check it later | 166 | // TODO: [TECH DEBT][PROPS NOT USED IN COMPONENT] check it later |
167 | // toggleAction={() => | 167 | // toggleAction={() => |
168 | // toggleService({ serviceId: service.id }) | 168 | // toggleService({ serviceId: service.id }) |
169 | // } | 169 | // } |
diff --git a/src/components/settings/settings/EditSettingsForm.tsx b/src/components/settings/settings/EditSettingsForm.tsx index 6ece340ba..11ae63737 100644 --- a/src/components/settings/settings/EditSettingsForm.tsx +++ b/src/components/settings/settings/EditSettingsForm.tsx | |||
@@ -28,7 +28,12 @@ import { | |||
28 | SPLIT_COLUMNS_MAX, | 28 | SPLIT_COLUMNS_MAX, |
29 | SPLIT_COLUMNS_MIN, | 29 | SPLIT_COLUMNS_MIN, |
30 | } from '../../../config'; | 30 | } from '../../../config'; |
31 | import { isMac, isWinPortable, isWindows, lockFerdiumShortcutKey } from '../../../environment'; | 31 | import { |
32 | isMac, | ||
33 | isWinPortable, | ||
34 | isWindows, | ||
35 | lockFerdiumShortcutKey, | ||
36 | } from '../../../environment'; | ||
32 | import { openExternalUrl, openPath } from '../../../helpers/url-helpers'; | 37 | import { openExternalUrl, openPath } from '../../../helpers/url-helpers'; |
33 | import globalMessages from '../../../i18n/globalMessages'; | 38 | import globalMessages from '../../../i18n/globalMessages'; |
34 | import Icon from '../../ui/icon'; | 39 | import Icon from '../../ui/icon'; |
@@ -376,8 +381,6 @@ class EditSettingsForm extends Component<IProps, IState> { | |||
376 | updateButtonLabelMessage = messages.updateStatusSearching; | 381 | updateButtonLabelMessage = messages.updateStatusSearching; |
377 | } else if (isUpdateAvailable) { | 382 | } else if (isUpdateAvailable) { |
378 | updateButtonLabelMessage = messages.updateStatusAvailable; | 383 | updateButtonLabelMessage = messages.updateStatusAvailable; |
379 | } else { | ||
380 | updateButtonLabelMessage = messages.buttonSearchForUpdate; | ||
381 | } | 384 | } |
382 | 385 | ||
383 | const { lockingFeatureEnabled, scheduledDNDEnabled, reloadAfterResume } = | 386 | const { lockingFeatureEnabled, scheduledDNDEnabled, reloadAfterResume } = |
diff --git a/src/components/settings/team/TeamDashboard.tsx b/src/components/settings/team/TeamDashboard.tsx index 3ef55fac6..6fd2d4426 100644 --- a/src/components/settings/team/TeamDashboard.tsx +++ b/src/components/settings/team/TeamDashboard.tsx | |||
@@ -1,3 +1,5 @@ | |||
1 | // TODO: Is this feature even being used? If not, then we can cleanup this code | ||
2 | |||
1 | import { Component, ReactElement } from 'react'; | 3 | import { Component, ReactElement } from 'react'; |
2 | import { observer } from 'mobx-react'; | 4 | import { observer } from 'mobx-react'; |
3 | import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; | 5 | import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; |
diff --git a/src/components/ui/AppLoader/styles.ts b/src/components/ui/AppLoader/styles.ts index 6bf3b4f3c..5ad41913a 100644 --- a/src/components/ui/AppLoader/styles.ts +++ b/src/components/ui/AppLoader/styles.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | const sloganTransition = | 1 | const sloganTransition = window?.matchMedia( |
2 | window && window.matchMedia('(prefers-reduced-motion: no-preference)') | 2 | '(prefers-reduced-motion: no-preference)', |
3 | ? 'opacity 1s ease' | 3 | ) |
4 | : 'none'; | 4 | ? 'opacity 1s ease' |
5 | : 'none'; | ||
5 | 6 | ||
6 | export default { | 7 | export default { |
7 | component: { | 8 | component: { |
diff --git a/src/components/ui/Infobox.tsx b/src/components/ui/Infobox.tsx index 1fc24816a..9782db151 100644 --- a/src/components/ui/Infobox.tsx +++ b/src/components/ui/Infobox.tsx | |||
@@ -35,7 +35,7 @@ interface IState { | |||
35 | dismissed: boolean; | 35 | dismissed: boolean; |
36 | } | 36 | } |
37 | 37 | ||
38 | // Can this file be merged into the './infobox/index.tsx' file? | 38 | // TODO: Can this file be merged into the './infobox/index.tsx' file? |
39 | @observer | 39 | @observer |
40 | class Infobox extends Component<IProps, IState> { | 40 | class Infobox extends Component<IProps, IState> { |
41 | constructor(props: IProps) { | 41 | constructor(props: IProps) { |
diff --git a/src/components/ui/Loader.tsx b/src/components/ui/Loader.tsx index 17cb35f41..37555df16 100644 --- a/src/components/ui/Loader.tsx +++ b/src/components/ui/Loader.tsx | |||
@@ -12,7 +12,7 @@ interface IProps { | |||
12 | children?: ReactNode; | 12 | children?: ReactNode; |
13 | } | 13 | } |
14 | 14 | ||
15 | // Can this file be merged into the './loader/index.tsx' file? | 15 | // TODO: Can this file be merged into the './loader/index.tsx' file? |
16 | @inject('stores') | 16 | @inject('stores') |
17 | @observer | 17 | @observer |
18 | class LoaderComponent extends Component<IProps> { | 18 | class LoaderComponent extends Component<IProps> { |
diff --git a/src/components/ui/Radio.tsx b/src/components/ui/Radio.tsx index e6cb5d5a5..b5be64c5d 100644 --- a/src/components/ui/Radio.tsx +++ b/src/components/ui/Radio.tsx | |||
@@ -10,7 +10,7 @@ type Props = { | |||
10 | showLabel: boolean; | 10 | showLabel: boolean; |
11 | }; | 11 | }; |
12 | 12 | ||
13 | // Should this file be converted into the coding style similar to './toggle/index.tsx'? | 13 | // TODO: Should this file be converted into the coding style similar to './toggle/index.tsx'? |
14 | class Radio extends Component<Props> { | 14 | class Radio extends Component<Props> { |
15 | static defaultProps = { | 15 | static defaultProps = { |
16 | focus: false, | 16 | focus: false, |
diff --git a/src/components/ui/Select.tsx b/src/components/ui/Select.tsx index e8e305fdd..8ae2945ce 100644 --- a/src/components/ui/Select.tsx +++ b/src/components/ui/Select.tsx | |||
@@ -18,7 +18,7 @@ interface IProps { | |||
18 | multiple?: boolean; | 18 | multiple?: boolean; |
19 | } | 19 | } |
20 | 20 | ||
21 | // Can this file be merged into the './select/index.tsx' file? | 21 | // TODO: Can this file be merged into the './select/index.tsx' file? |
22 | @observer | 22 | @observer |
23 | class Select extends Component<IProps> { | 23 | class Select extends Component<IProps> { |
24 | private element: RefObject<HTMLSelectElement> = | 24 | private element: RefObject<HTMLSelectElement> = |
@@ -57,7 +57,7 @@ class Select extends Component<IProps> { | |||
57 | let selected = field.value; | 57 | let selected = field.value; |
58 | 58 | ||
59 | if (multiple) { | 59 | if (multiple) { |
60 | if (typeof field.value === 'string' && field.value.slice(0, 1) === '[') { | 60 | if (typeof field.value === 'string' && field.value.startsWith('[')) { |
61 | // Value is JSON encoded | 61 | // Value is JSON encoded |
62 | selected = JSON.parse(field.value); | 62 | selected = JSON.parse(field.value); |
63 | } else if (typeof field.value === 'object') { | 63 | } else if (typeof field.value === 'object') { |
diff --git a/src/components/ui/ServiceIcon.tsx b/src/components/ui/ServiceIcon.tsx index 39a32e44d..6920611d0 100644 --- a/src/components/ui/ServiceIcon.tsx +++ b/src/components/ui/ServiceIcon.tsx | |||
@@ -27,7 +27,7 @@ interface IProps extends WithStylesProps<typeof styles> { | |||
27 | className?: string; | 27 | className?: string; |
28 | } | 28 | } |
29 | 29 | ||
30 | // TODO - [TS DEBT] Should this file be converted into the coding style similar to './toggle/index.tsx'? | 30 | // TODO: [TS DEBT] Should this file be converted into the coding style similar to './toggle/index.tsx'? |
31 | @observer | 31 | @observer |
32 | class ServiceIcon extends Component<IProps> { | 32 | class ServiceIcon extends Component<IProps> { |
33 | render(): ReactNode { | 33 | render(): ReactNode { |
diff --git a/src/components/ui/Slider.tsx b/src/components/ui/Slider.tsx index be0846513..aa351ccd2 100644 --- a/src/components/ui/Slider.tsx +++ b/src/components/ui/Slider.tsx | |||
@@ -12,7 +12,7 @@ interface IProps { | |||
12 | onSliderChange?: (e: ChangeEvent) => void; | 12 | onSliderChange?: (e: ChangeEvent) => void; |
13 | } | 13 | } |
14 | 14 | ||
15 | // TODO - [TS DEBT] Should this file be converted into the coding style similar to './toggle/index.tsx'? | 15 | // TODO: [TS DEBT] Should this file be converted into the coding style similar to './toggle/index.tsx'? |
16 | @observer | 16 | @observer |
17 | class Slider extends Component<IProps> { | 17 | class Slider extends Component<IProps> { |
18 | onChange(e: ChangeEvent<HTMLInputElement>): void { | 18 | onChange(e: ChangeEvent<HTMLInputElement>): void { |
diff --git a/src/components/ui/StatusBarTargetUrl.tsx b/src/components/ui/StatusBarTargetUrl.tsx index 7b053f410..d969267eb 100644 --- a/src/components/ui/StatusBarTargetUrl.tsx +++ b/src/components/ui/StatusBarTargetUrl.tsx | |||
@@ -8,7 +8,7 @@ interface IProps { | |||
8 | text?: string; | 8 | text?: string; |
9 | } | 9 | } |
10 | 10 | ||
11 | // TODO - [TS DEBT] Should this file be converted into the coding style similar to './toggle/index.tsx'? | 11 | // TODO: [TS DEBT] Should this file be converted into the coding style similar to './toggle/index.tsx'? |
12 | @observer | 12 | @observer |
13 | class StatusBarTargetUrl extends Component<IProps> { | 13 | class StatusBarTargetUrl extends Component<IProps> { |
14 | render() { | 14 | render() { |
diff --git a/src/components/ui/infobox/index.tsx b/src/components/ui/infobox/index.tsx index 3b878a9de..28ec2ff90 100644 --- a/src/components/ui/infobox/index.tsx +++ b/src/components/ui/infobox/index.tsx | |||
@@ -28,7 +28,7 @@ const buttonStyles = (theme: Theme) => { | |||
28 | const infoBoxTransition: string = 'none'; | 28 | const infoBoxTransition: string = 'none'; |
29 | const ctaTransition: string = 'none'; | 29 | const ctaTransition: string = 'none'; |
30 | 30 | ||
31 | // TODO: Not sure why, but this location alone, the `dinwo` is not defined - and it throws an error thus aborting the startup sequence of ferdium | 31 | // TODO: Not sure why, but this location alone, the `window` is not defined - and it throws an error thus aborting the startup sequence of ferdium |
32 | // if (window && window.matchMedia('(prefers-reduced-motion: no-preference)')) { | 32 | // if (window && window.matchMedia('(prefers-reduced-motion: no-preference)')) { |
33 | // infoBoxTransition = 'all 0.5s'; | 33 | // infoBoxTransition = 'all 0.5s'; |
34 | // ctaTransition = 'opacity 0.3s'; | 34 | // ctaTransition = 'opacity 0.3s'; |
diff --git a/src/components/ui/input/index.tsx b/src/components/ui/input/index.tsx index fe8f35607..064c1807f 100644 --- a/src/components/ui/input/index.tsx +++ b/src/components/ui/input/index.tsx | |||
@@ -67,7 +67,7 @@ class Input extends Component<IProps, IState> { | |||
67 | componentDidMount(): void { | 67 | componentDidMount(): void { |
68 | const { focus = false, data = {} } = this.props; | 68 | const { focus = false, data = {} } = this.props; |
69 | 69 | ||
70 | if (this.inputElement && this.inputElement.current) { | 70 | if (this.inputElement?.current) { |
71 | if (focus) { | 71 | if (focus) { |
72 | this.inputElement.current.focus(); | 72 | this.inputElement.current.focus(); |
73 | } | 73 | } |
diff --git a/src/components/ui/select/index.tsx b/src/components/ui/select/index.tsx index 695e70e28..017de5423 100644 --- a/src/components/ui/select/index.tsx +++ b/src/components/ui/select/index.tsx | |||
@@ -17,7 +17,7 @@ import Wrapper from '../wrapper'; | |||
17 | let popupTransition: string = 'none'; | 17 | let popupTransition: string = 'none'; |
18 | let toggleTransition: string = 'none'; | 18 | let toggleTransition: string = 'none'; |
19 | 19 | ||
20 | if (window && window.matchMedia('(prefers-reduced-motion: no-preference)')) { | 20 | if (window?.matchMedia('(prefers-reduced-motion: no-preference)')) { |
21 | popupTransition = 'all 0.3s'; | 21 | popupTransition = 'all 0.3s'; |
22 | toggleTransition = 'transform 0.3s'; | 22 | toggleTransition = 'transform 0.3s'; |
23 | } | 23 | } |
@@ -194,13 +194,13 @@ class SelectComponent extends Component<IProps, IState> { | |||
194 | componentDidUpdate(): void { | 194 | componentDidUpdate(): void { |
195 | const { open } = this.state; | 195 | const { open } = this.state; |
196 | 196 | ||
197 | if (this.searchInputRef && this.searchInputRef.current && open) { | 197 | if (this.searchInputRef?.current && open) { |
198 | this.searchInputRef.current.focus(); | 198 | this.searchInputRef.current.focus(); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | componentDidMount(): void { | 202 | componentDidMount(): void { |
203 | if (this.inputRef && this.inputRef.current) { | 203 | if (this.inputRef?.current) { |
204 | const { data } = this.props; | 204 | const { data } = this.props; |
205 | 205 | ||
206 | if (data) { | 206 | if (data) { |
@@ -215,7 +215,7 @@ class SelectComponent extends Component<IProps, IState> { | |||
215 | UNSAFE_componentWillMount(): void { | 215 | UNSAFE_componentWillMount(): void { |
216 | const { value } = this.props; | 216 | const { value } = this.props; |
217 | 217 | ||
218 | if (this.componentRef && this.componentRef.current) { | 218 | if (this.componentRef?.current) { |
219 | this.componentRef.current.removeEventListener( | 219 | this.componentRef.current.removeEventListener( |
220 | 'keydown', | 220 | 'keydown', |
221 | this.keyListener, | 221 | this.keyListener, |
@@ -285,7 +285,7 @@ class SelectComponent extends Component<IProps, IState> { | |||
285 | e.preventDefault(); | 285 | e.preventDefault(); |
286 | } | 286 | } |
287 | 287 | ||
288 | if (this.componentRef && this.componentRef.current) { | 288 | if (this.componentRef?.current) { |
289 | if (e.keyCode === 38 && selected > 0) { | 289 | if (e.keyCode === 38 && selected > 0) { |
290 | this.setState((state: IState) => ({ | 290 | this.setState((state: IState) => ({ |
291 | selected: state.selected - 1, | 291 | selected: state.selected - 1, |
@@ -302,8 +302,7 @@ class SelectComponent extends Component<IProps, IState> { | |||
302 | } | 302 | } |
303 | 303 | ||
304 | if ( | 304 | if ( |
305 | this.activeOptionRef && | 305 | this.activeOptionRef?.current && |
306 | this.activeOptionRef.current && | ||
307 | this.scrollContainerRef && | 306 | this.scrollContainerRef && |
308 | this.scrollContainerRef.current | 307 | this.scrollContainerRef.current |
309 | ) { | 308 | ) { |
@@ -350,13 +349,11 @@ class SelectComponent extends Component<IProps, IState> { | |||
350 | 349 | ||
351 | const { open, needle, value, selected, options } = this.state; | 350 | const { open, needle, value, selected, options } = this.state; |
352 | 351 | ||
353 | let selection = ''; | 352 | let selection = actionText; |
354 | if (!value && defaultValue && options![defaultValue]) { | 353 | if (!value && defaultValue && options![defaultValue]) { |
355 | selection = options![defaultValue]; | 354 | selection = options![defaultValue]; |
356 | } else if (value && options![value]) { | 355 | } else if (value && options![value]) { |
357 | selection = options![value]; | 356 | selection = options![value]; |
358 | } else { | ||
359 | selection = actionText; | ||
360 | } | 357 | } |
361 | 358 | ||
362 | return ( | 359 | return ( |
diff --git a/src/components/ui/textarea/index.tsx b/src/components/ui/textarea/index.tsx index 89e85ac11..fbdef7fc6 100644 --- a/src/components/ui/textarea/index.tsx +++ b/src/components/ui/textarea/index.tsx | |||
@@ -38,7 +38,7 @@ class TextareaComponent extends Component<IProps> { | |||
38 | componentDidMount() { | 38 | componentDidMount() { |
39 | const { data } = this.props; | 39 | const { data } = this.props; |
40 | 40 | ||
41 | if (this.textareaRef && this.textareaRef.current && data) { | 41 | if (this.textareaRef?.current && data) { |
42 | Object.keys(data).map( | 42 | Object.keys(data).map( |
43 | key => (this.textareaRef.current!.dataset[key] = data[key]), | 43 | key => (this.textareaRef.current!.dataset[key] = data[key]), |
44 | ); | 44 | ); |
diff --git a/src/components/ui/toggle/index.tsx b/src/components/ui/toggle/index.tsx index 828941886..48f68943b 100644 --- a/src/components/ui/toggle/index.tsx +++ b/src/components/ui/toggle/index.tsx | |||
@@ -16,10 +16,11 @@ interface IProps | |||
16 | className?: string; | 16 | className?: string; |
17 | } | 17 | } |
18 | 18 | ||
19 | const buttonTransition: string = | 19 | const buttonTransition: string = window?.matchMedia( |
20 | window && window.matchMedia('(prefers-reduced-motion: no-preference)') | 20 | '(prefers-reduced-motion: no-preference)', |
21 | ? 'all .5s' | 21 | ) |
22 | : 'none'; | 22 | ? 'all .5s' |
23 | : 'none'; | ||
23 | 24 | ||
24 | const styles = (theme: Theme) => ({ | 25 | const styles = (theme: Theme) => ({ |
25 | toggle: { | 26 | toggle: { |