aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Muhamed <unknown>2022-11-08 07:40:02 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-11-08 17:25:27 +0530
commit570d26baf9e4ad87a8c0752b5edfb5c441bf9d80 (patch)
treeee0a0e6bec7d10ec438b5269537905fee80c377b /src
parentrefactor: remove toggle component's duplicate (diff)
downloadferdium-app-570d26baf9e4ad87a8c0752b5edfb5c441bf9d80.tar.gz
ferdium-app-570d26baf9e4ad87a8c0752b5edfb5c441bf9d80.tar.zst
ferdium-app-570d26baf9e4ad87a8c0752b5edfb5c441bf9d80.zip
fix: slack issue caused by input TS conversion
Diffstat (limited to 'src')
-rw-r--r--src/@types/mobx-form.types.ts4
-rw-r--r--src/components/settings/services/EditServiceForm.tsx (renamed from src/components/settings/services/EditServiceForm.js)94
-rw-r--r--src/components/ui/imageUpload/index.tsx (renamed from src/components/ui/ImageUpload.tsx)100
-rw-r--r--src/components/ui/toggle/index.tsx17
-rw-r--r--src/containers/settings/EditServiceScreen.tsx93
-rw-r--r--src/containers/settings/EditSettingsScreen.tsx44
-rw-r--r--src/features/workspaces/components/WorkspaceServiceListItem.tsx2
-rw-r--r--src/models/Recipe.ts8
8 files changed, 219 insertions, 143 deletions
diff --git a/src/@types/mobx-form.types.ts b/src/@types/mobx-form.types.ts
index 2a984d3a6..07234a47a 100644
--- a/src/@types/mobx-form.types.ts
+++ b/src/@types/mobx-form.types.ts
@@ -1,3 +1,4 @@
1import { File } from 'electron-dl';
1import { ChangeEventHandler, FocusEventHandler } from 'react'; 2import { ChangeEventHandler, FocusEventHandler } from 'react';
2import { GlobalError } from './ferdium-components.types'; 3import { GlobalError } from './ferdium-components.types';
3 4
@@ -25,6 +26,8 @@ export interface Field extends Listeners {
25 options?: SelectOptions[]; 26 options?: SelectOptions[];
26 default?: string | boolean | number | null; 27 default?: string | boolean | number | null;
27 validators?: any; // Not sure yet. 28 validators?: any; // Not sure yet.
29 set?: (value: any) => void;
30 [key: string]: any;
28} 31}
29 32
30export interface SelectOptions { 33export interface SelectOptions {
@@ -37,4 +40,5 @@ export interface Listeners {
37 onChange?: ChangeEventHandler<HTMLInputElement | HTMLSelectElement>; 40 onChange?: ChangeEventHandler<HTMLInputElement | HTMLSelectElement>;
38 onBlur?: FocusEventHandler<HTMLElement>; 41 onBlur?: FocusEventHandler<HTMLElement>;
39 onFocus?: FocusEventHandler<HTMLElement>; 42 onFocus?: FocusEventHandler<HTMLElement>;
43 onDrop?: (file: File) => void;
40} 44}
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.tsx
index eb18b57eb..b594fcd40 100644
--- a/src/components/settings/services/EditServiceForm.js
+++ b/src/components/settings/services/EditServiceForm.tsx
@@ -1,25 +1,24 @@
1import { Component } from 'react'; 1import { Component, FormEvent, ReactElement } from 'react';
2import PropTypes from 'prop-types';
3import { observer } from 'mobx-react'; 2import { observer } from 'mobx-react';
4import { Link } from 'react-router-dom'; 3import { Link } from 'react-router-dom';
5import { defineMessages, injectIntl } from 'react-intl'; 4import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl';
6import normalizeUrl from 'normalize-url'; 5import normalizeUrl from 'normalize-url';
7import { mdiInformation } from '@mdi/js'; 6import { mdiInformation } from '@mdi/js';
8import Form from '../../../lib/Form'; 7import Form from '../../../lib/Form';
9import Recipe from '../../../models/Recipe';
10import Service from '../../../models/Service';
11import Tabs from '../../ui/Tabs/Tabs'; 8import Tabs from '../../ui/Tabs/Tabs';
12import TabItem from '../../ui/Tabs/TabItem'; 9import TabItem from '../../ui/Tabs/TabItem';
13import Input from '../../ui/input/index'; 10import Input from '../../ui/input/index';
14import Toggle from '../../ui/toggle'; 11import Toggle from '../../ui/toggle';
15import Slider from '../../ui/Slider'; 12import Slider from '../../ui/Slider';
16import Button from '../../ui/button'; 13import Button from '../../ui/button';
17import ImageUpload from '../../ui/ImageUpload'; 14import ImageUpload from '../../ui/imageUpload';
18import Select from '../../ui/Select'; 15import Select from '../../ui/Select';
19import { isMac } from '../../../environment'; 16import { isMac } from '../../../environment';
20import globalMessages from '../../../i18n/globalMessages'; 17import globalMessages from '../../../i18n/globalMessages';
21import Icon from '../../ui/icon'; 18import Icon from '../../ui/icon';
22import { H3 } from '../../ui/headline'; 19import { H3 } from '../../ui/headline';
20import { IRecipe } from '../../../models/Recipe';
21import Service from '../../../models/Service';
23 22
24const messages = defineMessages({ 23const messages = defineMessages({
25 saveService: { 24 saveService: {
@@ -149,36 +148,34 @@ const messages = defineMessages({
149 }, 148 },
150}); 149});
151 150
152class EditServiceForm extends Component { 151interface IProps extends WrappedComponentProps {
153 static propTypes = { 152 recipe: IRecipe;
154 recipe: PropTypes.instanceOf(Recipe).isRequired, 153 service: Service | null;
155 service(props, propName) { 154 action?: string;
156 if (props.action === 'edit' && !(props[propName] instanceof Service)) { 155 form: Form;
157 return new Error(`'${propName}'' is expected to be of type 'Service' 156 onSubmit: (...args: any[]) => void;
158 when editing a Service`); 157 onDelete: () => void;
159 } 158 openRecipeFile: (recipeFile: string) => void;
159 isSaving: boolean;
160 isDeleting: boolean;
161 isProxyFeatureEnabled: boolean;
162}
160 163
161 return null; 164interface IState {
162 }, 165 isValidatingCustomUrl: boolean;
163 action: PropTypes.string.isRequired, 166}
164 form: PropTypes.instanceOf(Form).isRequired,
165 onSubmit: PropTypes.func.isRequired,
166 onDelete: PropTypes.func.isRequired,
167 openRecipeFile: PropTypes.func.isRequired,
168 isSaving: PropTypes.bool.isRequired,
169 isDeleting: PropTypes.bool.isRequired,
170 isProxyFeatureEnabled: PropTypes.bool.isRequired,
171 };
172 167
173 static defaultProps = { 168@observer
174 service: {}, 169class EditServiceForm extends Component<IProps, IState> {
175 }; 170 constructor(props: IProps) {
171 super(props);
176 172
177 state = { 173 this.state = {
178 isValidatingCustomUrl: false, 174 isValidatingCustomUrl: false,
179 }; 175 };
176 }
180 177
181 submit(e) { 178 submit(e: FormEvent): void {
182 const { recipe } = this.props; 179 const { recipe } = this.props;
183 180
184 e.preventDefault(); 181 e.preventDefault();
@@ -189,7 +186,8 @@ class EditServiceForm extends Component {
189 186
190 const { files } = form.$('customIcon'); 187 const { files } = form.$('customIcon');
191 if (files) { 188 if (files) {
192 values.iconFile = files[0]; 189 const [iconFile] = files;
190 values.iconFile = iconFile;
193 } 191 }
194 192
195 if (recipe.validateUrl && values.customUrl) { 193 if (recipe.validateUrl && values.customUrl) {
@@ -219,20 +217,19 @@ class EditServiceForm extends Component {
219 }); 217 });
220 } 218 }
221 219
222 render() { 220 render(): ReactElement {
223 const { 221 const {
224 recipe, 222 recipe,
225 service, 223 service = {} as Service,
226 action, 224 action = '',
227 form, 225 form,
228 isSaving, 226 isSaving,
229 isDeleting, 227 isDeleting,
230 onDelete, 228 onDelete,
231 openRecipeFile, 229 openRecipeFile,
232 isProxyFeatureEnabled, 230 isProxyFeatureEnabled,
231 intl,
233 } = this.props; 232 } = this.props;
234 const { intl } = this.props;
235
236 const { isValidatingCustomUrl } = this.state; 233 const { isValidatingCustomUrl } = this.state;
237 234
238 const deleteButton = isDeleting ? ( 235 const deleteButton = isDeleting ? (
@@ -283,7 +280,8 @@ class EditServiceForm extends Component {
283 name: recipe.name, 280 name: recipe.name,
284 }) 281 })
285 : intl.formatMessage(messages.editServiceHeadline, { 282 : intl.formatMessage(messages.editServiceHeadline, {
286 name: service.name !== '' ? service.name : recipe.name, 283 name:
284 service && service.name !== '' ? service.name : recipe.name,
287 })} 285 })}
288 </span> 286 </span>
289 </div> 287 </div>
@@ -295,23 +293,29 @@ class EditServiceForm extends Component {
295 {(recipe.hasTeamId || recipe.hasCustomUrl) && ( 293 {(recipe.hasTeamId || recipe.hasCustomUrl) && (
296 <Tabs active={activeTabIndex}> 294 <Tabs active={activeTabIndex}>
297 {recipe.hasHostedOption && ( 295 {recipe.hasHostedOption && (
298 <TabItem title={recipe.name}> 296 <TabItem
297 // title={recipe.name} // TODO - [TS DEBT] property not used inside TabItem need to check it
298 >
299 {intl.formatMessage(messages.useHostedService, { 299 {intl.formatMessage(messages.useHostedService, {
300 name: recipe.name, 300 name: recipe.name,
301 })} 301 })}
302 </TabItem> 302 </TabItem>
303 )} 303 )}
304 {recipe.hasTeamId && ( 304 {recipe.hasTeamId && (
305 <TabItem title={intl.formatMessage(messages.tabHosted)}> 305 <TabItem
306 // title={intl.formatMessage(messages.tabHosted)} // TODO - [TS DEBT] property not used inside TabItem need to check it
307 >
306 <Input 308 <Input
307 field={form.$('team')} 309 {...form.$('team').bind()}
308 prefix={recipe.urlInputPrefix} 310 prefix={recipe.urlInputPrefix}
309 suffix={recipe.urlInputSuffix} 311 suffix={recipe.urlInputSuffix}
310 /> 312 />
311 </TabItem> 313 </TabItem>
312 )} 314 )}
313 {recipe.hasCustomUrl && ( 315 {recipe.hasCustomUrl && (
314 <TabItem title={intl.formatMessage(messages.tabOnPremise)}> 316 <TabItem
317 // title={intl.formatMessage(messages.tabOnPremise)} // TODO - [TS DEBT] property not used inside TabItem need to check it
318 >
315 <Input {...form.$('customUrl').bind()} /> 319 <Input {...form.$('customUrl').bind()} />
316 {form.error === 'url-validation-error' && ( 320 {form.error === 'url-validation-error' && (
317 <p className="franz-form__error"> 321 <p className="franz-form__error">
@@ -404,7 +408,7 @@ class EditServiceForm extends Component {
404 </div> 408 </div>
405 <div className="service-icon"> 409 <div className="service-icon">
406 <ImageUpload 410 <ImageUpload
407 field={form.$('customIcon')} 411 {...form.$('customIcon').bind()}
408 textDelete={intl.formatMessage(messages.iconDelete)} 412 textDelete={intl.formatMessage(messages.iconDelete)}
409 textUpload={intl.formatMessage(messages.iconUpload)} 413 textUpload={intl.formatMessage(messages.iconUpload)}
410 maxSize={2_097_152} 414 maxSize={2_097_152}
@@ -533,4 +537,4 @@ class EditServiceForm extends Component {
533 } 537 }
534} 538}
535 539
536export default injectIntl(observer(EditServiceForm)); 540export default injectIntl(EditServiceForm);
diff --git a/src/components/ui/ImageUpload.tsx b/src/components/ui/imageUpload/index.tsx
index 7732928f8..7a2ca747f 100644
--- a/src/components/ui/ImageUpload.tsx
+++ b/src/components/ui/imageUpload/index.tsx
@@ -1,15 +1,15 @@
1import { Component } from 'react'; 1import { Component, InputHTMLAttributes } from 'react';
2import { observer } from 'mobx-react'; 2import { observer } from 'mobx-react';
3import { Field } from 'mobx-react-form';
4import classnames from 'classnames'; 3import classnames from 'classnames';
5import Dropzone from 'react-dropzone'; 4import Dropzone from 'react-dropzone';
6import { mdiDelete, mdiFileImage } from '@mdi/js'; 5import { mdiDelete, mdiFileImage } from '@mdi/js';
7import prettyBytes from 'pretty-bytes'; 6import prettyBytes from 'pretty-bytes';
8import { isWindows } from '../../environment'; 7import { noop } from 'lodash';
9import Icon from './icon'; 8import { isWindows } from '../../../environment';
9import Icon from '../icon';
10import { IFormField } from '../typings/generic';
10 11
11type Props = { 12interface IProps extends InputHTMLAttributes<HTMLInputElement>, IFormField {
12 field: typeof Field;
13 className: string; 13 className: string;
14 multiple: boolean; 14 multiple: boolean;
15 textDelete: string; 15 textDelete: string;
@@ -19,39 +19,43 @@ type Props = {
19 maxSize?: number; 19 maxSize?: number;
20 maxFiles?: number; 20 maxFiles?: number;
21 messages: any; 21 messages: any;
22}; 22 set?: (value: string) => void;
23}
23 24
24// Should this file be converted into the coding style similar to './toggle/index.tsx'? 25interface IState {
25class ImageUpload extends Component<Props> { 26 path: string | null;
26 static defaultProps = { 27 errorState: boolean;
27 multiple: false, 28 errorMessage: { message: string };
28 maxSize: Number.POSITIVE_INFINITY, 29}
29 maxFiles: 0,
30 };
31 30
32 state = { 31// TODO - drag and drop image for recipe add/edit not working from 6.2.0 need to look at it
33 path: null, 32@observer
34 errorState: false, 33class ImageUpload extends Component<IProps, IState> {
35 }; 34 constructor(props: IProps) {
35 super(props);
36 36
37 errorMessage = { 37 this.state = {
38 message: '', 38 path: null,
39 }; 39 errorState: false,
40 errorMessage: {
41 message: '',
42 },
43 };
44 }
40 45
41 onDropAccepted(acceptedFiles) { 46 onDropAccepted(acceptedFiles): void {
42 const { field } = this.props; 47 const { onDrop = noop, set = noop } = this.props;
43 this.setState({ errorState: false }); 48 this.setState({ errorState: false });
44 49
45 for (const file of acceptedFiles) { 50 for (const file of acceptedFiles) {
46 const imgPath = isWindows ? file.path.replace(/\\/g, '/') : file.path; 51 const imgPath: string = isWindows
47 this.setState({ 52 ? file.path.replace(/\\/g, '/')
48 path: imgPath, 53 : file.path;
49 }); 54 this.setState({ path: imgPath });
50 55 onDrop(file);
51 this.props.field.onDrop(file);
52 } 56 }
53 57
54 field.set(''); 58 set('');
55 } 59 }
56 60
57 onDropRejected(rejectedFiles): void { 61 onDropRejected(rejectedFiles): void {
@@ -59,11 +63,11 @@ class ImageUpload extends Component<Props> {
59 for (const error of file.errors) { 63 for (const error of file.errors) {
60 if (error.code === 'file-too-large') { 64 if (error.code === 'file-too-large') {
61 this.setState({ errorState: true }); 65 this.setState({ errorState: true });
62 this.setState( 66 this.setState({
63 (this.errorMessage = { 67 errorMessage: {
64 message: this.props.textMaxFileSizeError, 68 message: this.props.textMaxFileSizeError,
65 }), 69 },
66 ); 70 });
67 } 71 }
68 } 72 }
69 } 73 }
@@ -71,14 +75,16 @@ class ImageUpload extends Component<Props> {
71 75
72 render() { 76 render() {
73 const { 77 const {
74 field,
75 className, 78 className,
76 multiple, 79 multiple = false,
77 textDelete, 80 textDelete,
78 textUpload, 81 textUpload,
79 textMaxFileSize, 82 textMaxFileSize,
80 maxSize, 83 value,
81 maxFiles, 84 maxSize = Number.POSITIVE_INFINITY,
85 maxFiles = 0,
86 label = '',
87 set = noop,
82 } = this.props; 88 } = this.props;
83 89
84 const cssClasses = classnames({ 90 const cssClasses = classnames({
@@ -94,27 +100,25 @@ class ImageUpload extends Component<Props> {
94 return ( 100 return (
95 <div className="image-upload-wrapper"> 101 <div className="image-upload-wrapper">
96 <label className="franz-form__label" htmlFor="iconUpload"> 102 <label className="franz-form__label" htmlFor="iconUpload">
97 {field.label} 103 {label}
98 </label> 104 </label>
99 <div className="image-upload"> 105 <div className="image-upload">
100 {(field.value && field.value !== 'delete') || this.state.path ? ( 106 {(value && value !== 'delete') || this.state.path ? (
101 <> 107 <>
102 <div 108 <div
103 className="image-upload__preview" 109 className="image-upload__preview"
104 style={{ 110 style={{
105 backgroundImage: `url("${this.state.path || field.value}")`, 111 backgroundImage: `url("${this.state.path || value}")`,
106 }} 112 }}
107 /> 113 />
108 <div className="image-upload__action"> 114 <div className="image-upload__action">
109 <button 115 <button
110 type="button" 116 type="button"
111 onClick={() => { 117 onClick={() => {
112 if (field.value) { 118 if (value) {
113 field.set('delete'); 119 set('delete');
114 } else { 120 } else {
115 this.setState({ 121 this.setState({ path: null });
116 path: null,
117 });
118 } 122 }
119 }} 123 }}
120 > 124 >
@@ -152,7 +156,7 @@ class ImageUpload extends Component<Props> {
152 )} 156 )}
153 {this.state.errorState && ( 157 {this.state.errorState && (
154 <span className="image-upload-wrapper__file-size-error"> 158 <span className="image-upload-wrapper__file-size-error">
155 {this.errorMessage.message} 159 {this.state.errorMessage.message}
156 </span> 160 </span>
157 )} 161 )}
158 </div> 162 </div>
@@ -160,4 +164,4 @@ class ImageUpload extends Component<Props> {
160 } 164 }
161} 165}
162 166
163export default observer(ImageUpload); 167export default ImageUpload;
diff --git a/src/components/ui/toggle/index.tsx b/src/components/ui/toggle/index.tsx
index fee8adbc7..828941886 100644
--- a/src/components/ui/toggle/index.tsx
+++ b/src/components/ui/toggle/index.tsx
@@ -1,7 +1,7 @@
1import classnames from 'classnames'; 1import classnames from 'classnames';
2import { Property } from 'csstype'; 2import { Property } from 'csstype';
3import { noop } from 'lodash'; 3import { noop } from 'lodash';
4import { Component, InputHTMLAttributes } from 'react'; 4import { Component, InputHTMLAttributes, ReactElement } from 'react';
5import withStyles, { WithStylesProps } from 'react-jss'; 5import withStyles, { WithStylesProps } from 'react-jss';
6import { Theme } from '../../../themes'; 6import { Theme } from '../../../themes';
7import Error from '../error'; 7import Error from '../error';
@@ -10,11 +10,10 @@ import { IFormField } from '../typings/generic';
10import Wrapper from '../wrapper'; 10import Wrapper from '../wrapper';
11 11
12interface IProps 12interface IProps
13 extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value'>, 13 extends InputHTMLAttributes<HTMLInputElement>,
14 IFormField, 14 IFormField,
15 WithStylesProps<typeof styles> { 15 WithStylesProps<typeof styles> {
16 className?: string; 16 className?: string;
17 value: boolean | undefined; // due to type capability between InputHTMLAttributes and mobx-react-form
18} 17}
19 18
20const buttonTransition: string = 19const buttonTransition: string =
@@ -62,8 +61,8 @@ const styles = (theme: Theme) => ({
62 }, 61 },
63}); 62});
64 63
65class ToggleComponent extends Component<IProps> { 64class Toggle extends Component<IProps> {
66 render() { 65 render(): ReactElement {
67 const { 66 const {
68 classes, 67 classes,
69 className, 68 className,
@@ -71,7 +70,7 @@ class ToggleComponent extends Component<IProps> {
71 name = '', 70 name = '',
72 label = '', 71 label = '',
73 error = '', 72 error = '',
74 value = false, 73 checked = false,
75 showLabel = true, 74 showLabel = true,
76 disabled = false, 75 disabled = false,
77 onChange = noop, 76 onChange = noop,
@@ -94,14 +93,14 @@ class ToggleComponent extends Component<IProps> {
94 <div 93 <div
95 className={classnames({ 94 className={classnames({
96 [`${classes.button}`]: true, 95 [`${classes.button}`]: true,
97 [`${classes.buttonActive}`]: value, 96 [`${classes.buttonActive}`]: checked,
98 })} 97 })}
99 /> 98 />
100 <input 99 <input
101 type="checkbox" 100 type="checkbox"
102 id={id} 101 id={id}
103 name={name} 102 name={name}
104 checked={value as boolean | undefined} 103 checked={checked}
105 className={classes.input} 104 className={classes.input}
106 onChange={onChange} 105 onChange={onChange}
107 disabled={disabled} 106 disabled={disabled}
@@ -114,4 +113,4 @@ class ToggleComponent extends Component<IProps> {
114 } 113 }
115} 114}
116 115
117export default withStyles(styles, { injectTheme: true })(ToggleComponent); 116export default withStyles(styles, { injectTheme: true })(Toggle);
diff --git a/src/containers/settings/EditServiceScreen.tsx b/src/containers/settings/EditServiceScreen.tsx
index d0f0c779d..09dd19925 100644
--- a/src/containers/settings/EditServiceScreen.tsx
+++ b/src/containers/settings/EditServiceScreen.tsx
@@ -1,25 +1,19 @@
1import { Component, ReactElement } from 'react'; 1import { Component, ReactElement } from 'react';
2import { inject, observer } from 'mobx-react'; 2import { inject, observer } from 'mobx-react';
3import { defineMessages, injectIntl } from 'react-intl'; 3import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl';
4
5import { Params } from 'react-router-dom'; 4import { Params } from 'react-router-dom';
6import { StoresProps } from '../../@types/ferdium-components.types'; 5import { StoresProps } from '../../@types/ferdium-components.types';
7import { IRecipe } from '../../models/Recipe'; 6import { IRecipe } from '../../models/Recipe';
8import Service from '../../models/Service'; 7import Service from '../../models/Service';
9import { FormFields } from '../../@types/mobx-form.types'; 8import { FormFields } from '../../@types/mobx-form.types';
10import Form from '../../lib/Form'; 9import Form from '../../lib/Form';
11
12import ServiceError from '../../components/settings/services/ServiceError'; 10import ServiceError from '../../components/settings/services/ServiceError';
13import EditServiceForm from '../../components/settings/services/EditServiceForm'; 11import EditServiceForm from '../../components/settings/services/EditServiceForm';
14import ErrorBoundary from '../../components/util/ErrorBoundary'; 12import ErrorBoundary from '../../components/util/ErrorBoundary';
15
16import { required, url, oneRequired } from '../../helpers/validation-helpers'; 13import { required, url, oneRequired } from '../../helpers/validation-helpers';
17import { getSelectOptions } from '../../helpers/i18n-helpers'; 14import { getSelectOptions } from '../../helpers/i18n-helpers';
18
19import { config as proxyFeature } from '../../features/serviceProxy'; 15import { config as proxyFeature } from '../../features/serviceProxy';
20
21import { SPELLCHECKER_LOCALES } from '../../i18n/languages'; 16import { SPELLCHECKER_LOCALES } from '../../i18n/languages';
22
23import globalMessages from '../../i18n/globalMessages'; 17import globalMessages from '../../i18n/globalMessages';
24import { DEFAULT_APP_SETTINGS, DEFAULT_SERVICE_SETTINGS } from '../../config'; 18import { DEFAULT_APP_SETTINGS, DEFAULT_SERVICE_SETTINGS } from '../../config';
25import withParams from '../../components/util/WithParams'; 19import withParams from '../../components/util/WithParams';
@@ -123,13 +117,22 @@ const messages = defineMessages({
123 }, 117 },
124}); 118});
125 119
126interface EditServicesScreenProps extends StoresProps { 120interface IProxyConfig {
127 intl: any; 121 isEnabled?: boolean;
122 host?: string;
123 port?: number;
124 user?: string;
125 password?: string;
126}
127
128interface IProps extends StoresProps, WrappedComponentProps {
128 params: Params; 129 params: Params;
129} 130}
130 131
131class EditServiceScreen extends Component<EditServicesScreenProps> { 132@inject('stores', 'actions')
132 onSubmit(data: any) { 133@observer
134class EditServiceScreen extends Component<IProps> {
135 onSubmit(data: any): void {
133 const { action } = this.props.params; 136 const { action } = this.props.params;
134 const { recipes, services } = this.props.stores; 137 const { recipes, services } = this.props.stores;
135 const { createService, updateService } = this.props.actions.service; 138 const { createService, updateService } = this.props.actions.service;
@@ -153,9 +156,7 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
153 } 156 }
154 157
155 prepareForm(recipe: IRecipe, service: Service | null, proxy: any): Form { 158 prepareForm(recipe: IRecipe, service: Service | null, proxy: any): Form {
156 const { intl } = this.props; 159 const { stores, intl } = this.props;
157
158 const { stores } = this.props;
159 160
160 let defaultSpellcheckerLanguage = 161 let defaultSpellcheckerLanguage =
161 SPELLCHECKER_LOCALES[stores.settings.app.spellcheckerLanguage]; 162 SPELLCHECKER_LOCALES[stores.settings.app.spellcheckerLanguage];
@@ -189,41 +190,49 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
189 label: intl.formatMessage(messages.enableService), 190 label: intl.formatMessage(messages.enableService),
190 value: service?.isEnabled, 191 value: service?.isEnabled,
191 default: DEFAULT_SERVICE_SETTINGS.isEnabled, 192 default: DEFAULT_SERVICE_SETTINGS.isEnabled,
193 type: 'checkbox',
192 }, 194 },
193 isHibernationEnabled: { 195 isHibernationEnabled: {
194 label: intl.formatMessage(messages.enableHibernation), 196 label: intl.formatMessage(messages.enableHibernation),
195 value: service?.isHibernationEnabled, 197 value: service?.isHibernationEnabled,
196 default: DEFAULT_SERVICE_SETTINGS.isHibernationEnabled, 198 default: DEFAULT_SERVICE_SETTINGS.isHibernationEnabled,
199 type: 'checkbox',
197 }, 200 },
198 isWakeUpEnabled: { 201 isWakeUpEnabled: {
199 label: intl.formatMessage(messages.enableWakeUp), 202 label: intl.formatMessage(messages.enableWakeUp),
200 value: service?.isWakeUpEnabled, 203 value: service?.isWakeUpEnabled,
201 default: DEFAULT_SERVICE_SETTINGS.isWakeUpEnabled, 204 default: DEFAULT_SERVICE_SETTINGS.isWakeUpEnabled,
205 type: 'checkbox',
202 }, 206 },
203 isNotificationEnabled: { 207 isNotificationEnabled: {
204 label: intl.formatMessage(messages.enableNotification), 208 label: intl.formatMessage(messages.enableNotification),
205 value: service?.isNotificationEnabled, 209 value: service?.isNotificationEnabled,
206 default: DEFAULT_SERVICE_SETTINGS.isNotificationEnabled, 210 default: DEFAULT_SERVICE_SETTINGS.isNotificationEnabled,
211 type: 'checkbox',
207 }, 212 },
208 isBadgeEnabled: { 213 isBadgeEnabled: {
209 label: intl.formatMessage(messages.enableBadge), 214 label: intl.formatMessage(messages.enableBadge),
210 value: service?.isBadgeEnabled, 215 value: service?.isBadgeEnabled,
211 default: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled, 216 default: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled,
217 type: 'checkbox',
212 }, 218 },
213 isMediaBadgeEnabled: { 219 isMediaBadgeEnabled: {
214 label: intl.formatMessage(messages.enableMediaBadge), 220 label: intl.formatMessage(messages.enableMediaBadge),
215 value: service?.isMediaBadgeEnabled, 221 value: service?.isMediaBadgeEnabled,
216 default: DEFAULT_SERVICE_SETTINGS.isMediaBadgeEnabled, 222 default: DEFAULT_SERVICE_SETTINGS.isMediaBadgeEnabled,
223 type: 'checkbox',
217 }, 224 },
218 trapLinkClicks: { 225 trapLinkClicks: {
219 label: intl.formatMessage(messages.trapLinkClicks), 226 label: intl.formatMessage(messages.trapLinkClicks),
220 value: service?.trapLinkClicks, 227 value: service?.trapLinkClicks,
221 default: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, 228 default: DEFAULT_SERVICE_SETTINGS.trapLinkClicks,
229 type: 'checkbox',
222 }, 230 },
223 isMuted: { 231 isMuted: {
224 label: intl.formatMessage(messages.enableAudio), 232 label: intl.formatMessage(messages.enableAudio),
225 value: !service?.isMuted, 233 value: !service?.isMuted,
226 default: DEFAULT_SERVICE_SETTINGS.isMuted, 234 default: DEFAULT_SERVICE_SETTINGS.isMuted,
235 type: 'checkbox',
227 }, 236 },
228 customIcon: { 237 customIcon: {
229 label: intl.formatMessage(messages.icon), 238 label: intl.formatMessage(messages.icon),
@@ -235,6 +244,7 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
235 label: intl.formatMessage(messages.enableDarkMode), 244 label: intl.formatMessage(messages.enableDarkMode),
236 value: service?.isDarkModeEnabled, 245 value: service?.isDarkModeEnabled,
237 default: stores.settings.app.darkMode, 246 default: stores.settings.app.darkMode,
247 type: 'checkbox',
238 }, 248 },
239 darkReaderBrightness: { 249 darkReaderBrightness: {
240 label: intl.formatMessage(messages.darkReaderBrightness), 250 label: intl.formatMessage(messages.darkReaderBrightness),
@@ -261,6 +271,7 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
261 label: intl.formatMessage(messages.enableProgressbar), 271 label: intl.formatMessage(messages.enableProgressbar),
262 value: service?.isProgressbarEnabled, 272 value: service?.isProgressbarEnabled,
263 default: DEFAULT_SERVICE_SETTINGS.isProgressbarEnabled, 273 default: DEFAULT_SERVICE_SETTINGS.isProgressbarEnabled,
274 type: 'checkbox',
264 }, 275 },
265 spellcheckerLanguage: { 276 spellcheckerLanguage: {
266 label: intl.formatMessage(globalMessages.spellcheckerLanguage), 277 label: intl.formatMessage(globalMessages.spellcheckerLanguage),
@@ -277,25 +288,28 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
277 }; 288 };
278 289
279 if (recipe.hasTeamId) { 290 if (recipe.hasTeamId) {
280 Object.assign(config.fields, { 291 config.fields = {
292 ...config.fields,
293
281 team: { 294 team: {
282 label: intl.formatMessage(messages.team), 295 label: intl.formatMessage(messages.team),
283 placeholder: intl.formatMessage(messages.team), 296 placeholder: intl.formatMessage(messages.team),
284 value: service?.team, 297 value: service?.team,
285 validators: [required], 298 validators: [required],
286 }, 299 },
287 }); 300 };
288 } 301 }
289 302
290 if (recipe.hasCustomUrl) { 303 if (recipe.hasCustomUrl) {
291 Object.assign(config.fields, { 304 config.fields = {
305 ...config.fields,
292 customUrl: { 306 customUrl: {
293 label: intl.formatMessage(messages.customUrl), 307 label: intl.formatMessage(messages.customUrl),
294 placeholder: "'http://' or 'https://' or 'file:///'", 308 placeholder: "'http://' or 'https://' or 'file:///'",
295 value: service?.customUrl || recipe.serviceURL, 309 value: service?.customUrl || recipe.serviceURL,
296 validators: [required, url], 310 validators: [required, url],
297 }, 311 },
298 }); 312 };
299 } 313 }
300 314
301 // More fine grained and use case specific validation rules 315 // More fine grained and use case specific validation rules
@@ -318,38 +332,37 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
318 } 332 }
319 333
320 if (recipe.hasIndirectMessages) { 334 if (recipe.hasIndirectMessages) {
321 Object.assign(config.fields, { 335 config.fields = {
336 ...config.fields,
322 isIndirectMessageBadgeEnabled: { 337 isIndirectMessageBadgeEnabled: {
323 label: intl.formatMessage(messages.indirectMessages), 338 label: intl.formatMessage(messages.indirectMessages),
324 value: service?.isIndirectMessageBadgeEnabled, 339 value: service?.isIndirectMessageBadgeEnabled,
325 default: DEFAULT_SERVICE_SETTINGS.hasIndirectMessages, 340 default: DEFAULT_SERVICE_SETTINGS.hasIndirectMessages,
341 type: 'checkbox',
326 }, 342 },
327 }); 343 };
328 } 344 }
329 345
330 if (recipe.allowFavoritesDelineationInUnreadCount) { 346 if (recipe.allowFavoritesDelineationInUnreadCount) {
331 Object.assign(config.fields, { 347 config.fields = {
348 ...config.fields,
332 onlyShowFavoritesInUnreadCount: { 349 onlyShowFavoritesInUnreadCount: {
333 label: intl.formatMessage(messages.onlyShowFavoritesInUnreadCount), 350 label: intl.formatMessage(messages.onlyShowFavoritesInUnreadCount),
334 value: service?.onlyShowFavoritesInUnreadCount, 351 value: service?.onlyShowFavoritesInUnreadCount,
335 default: DEFAULT_APP_SETTINGS.onlyShowFavoritesInUnreadCount, 352 default: DEFAULT_APP_SETTINGS.onlyShowFavoritesInUnreadCount,
353 type: 'checkbox',
336 }, 354 },
337 }); 355 };
338 } 356 }
339 357
340 if (proxy.isEnabled) { 358 if (proxy.isEnabled) {
341 let serviceProxyConfig: { 359 let serviceProxyConfig: IProxyConfig = {};
342 isEnabled?: boolean;
343 host?: string;
344 port?: number;
345 user?: string;
346 password?: string;
347 } = {};
348 if (service) { 360 if (service) {
349 serviceProxyConfig = stores.settings.proxy[service.id] || {}; 361 serviceProxyConfig = stores.settings.proxy[service.id] || {};
350 } 362 }
351 363
352 Object.assign(config.fields, { 364 config.fields = {
365 ...config.fields,
353 proxy: { 366 proxy: {
354 name: 'proxy', 367 name: 'proxy',
355 label: 'proxy', 368 label: 'proxy',
@@ -358,6 +371,7 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
358 label: intl.formatMessage(messages.enableProxy), 371 label: intl.formatMessage(messages.enableProxy),
359 value: serviceProxyConfig.isEnabled, 372 value: serviceProxyConfig.isEnabled,
360 default: DEFAULT_APP_SETTINGS.proxyFeatureEnabled, 373 default: DEFAULT_APP_SETTINGS.proxyFeatureEnabled,
374 type: 'checkbox',
361 }, 375 },
362 host: { 376 host: {
363 label: intl.formatMessage(messages.proxyHost), 377 label: intl.formatMessage(messages.proxyHost),
@@ -382,11 +396,10 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
382 }, 396 },
383 }, 397 },
384 }, 398 },
385 }); 399 };
386 } 400 }
387 401
388 // @ts-ignore: Remove this ignore once mobx-react-form v4 with typescript 402 // @ts-ignore: Remove this ignore once mobx-react-form v4 with typescript
389 // support has been released.
390 return new Form(config); 403 return new Form(config);
391 } 404 }
392 405
@@ -417,7 +430,11 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
417 } 430 }
418 431
419 render(): ReactElement { 432 render(): ReactElement {
420 const { recipes, services, user } = this.props.stores; 433 const {
434 recipes,
435 services,
436 // user
437 } = this.props.stores;
421 const { action } = this.props.params; 438 const { action } = this.props.params;
422 439
423 let recipe: null | IRecipe = null; 440 let recipe: null | IRecipe = null;
@@ -455,9 +472,9 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
455 action={action} 472 action={action}
456 recipe={recipe} 473 recipe={recipe}
457 service={service} 474 service={service}
458 user={user.data} 475 // user={user.data} // TODO - [TS DEBT] Need to check why its passed as its not used inside EditServiceForm
459 form={form} 476 form={form}
460 status={services.actionStatus} 477 // status={services.actionStatus} // TODO - [TS DEBT] Need to check why its passed as its not used inside EditServiceForm
461 isSaving={ 478 isSaving={
462 services.updateServiceRequest.isExecuting || 479 services.updateServiceRequest.isExecuting ||
463 services.createServiceRequest.isExecuting 480 services.createServiceRequest.isExecuting
@@ -473,8 +490,4 @@ class EditServiceScreen extends Component<EditServicesScreenProps> {
473 } 490 }
474} 491}
475 492
476export default withParams( 493export default withParams(injectIntl(EditServiceScreen));
477 injectIntl<'intl', EditServicesScreenProps>(
478 inject('stores', 'actions')(observer(EditServiceScreen)),
479 ),
480);
diff --git a/src/containers/settings/EditSettingsScreen.tsx b/src/containers/settings/EditSettingsScreen.tsx
index 91752ad43..f18eb24a7 100644
--- a/src/containers/settings/EditSettingsScreen.tsx
+++ b/src/containers/settings/EditSettingsScreen.tsx
@@ -544,26 +544,31 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
544 label: intl.formatMessage(messages.autoLaunchOnStart), 544 label: intl.formatMessage(messages.autoLaunchOnStart),
545 value: app.autoLaunchOnStart, 545 value: app.autoLaunchOnStart,
546 default: DEFAULT_APP_SETTINGS.autoLaunchOnStart, 546 default: DEFAULT_APP_SETTINGS.autoLaunchOnStart,
547 type: 'checkbox',
547 }, 548 },
548 autoLaunchInBackground: { 549 autoLaunchInBackground: {
549 label: intl.formatMessage(messages.autoLaunchInBackground), 550 label: intl.formatMessage(messages.autoLaunchInBackground),
550 value: app.launchInBackground, 551 value: app.launchInBackground,
551 default: DEFAULT_APP_SETTINGS.autoLaunchInBackground, 552 default: DEFAULT_APP_SETTINGS.autoLaunchInBackground,
553 type: 'checkbox',
552 }, 554 },
553 runInBackground: { 555 runInBackground: {
554 label: intl.formatMessage(messages.runInBackground), 556 label: intl.formatMessage(messages.runInBackground),
555 value: settings.all.app.runInBackground, 557 value: settings.all.app.runInBackground,
556 default: DEFAULT_APP_SETTINGS.runInBackground, 558 default: DEFAULT_APP_SETTINGS.runInBackground,
559 type: 'checkbox',
557 }, 560 },
558 startMinimized: { 561 startMinimized: {
559 label: intl.formatMessage(messages.startMinimized), 562 label: intl.formatMessage(messages.startMinimized),
560 value: settings.all.app.startMinimized, 563 value: settings.all.app.startMinimized,
561 default: DEFAULT_APP_SETTINGS.startMinimized, 564 default: DEFAULT_APP_SETTINGS.startMinimized,
565 type: 'checkbox',
562 }, 566 },
563 confirmOnQuit: { 567 confirmOnQuit: {
564 label: intl.formatMessage(messages.confirmOnQuit), 568 label: intl.formatMessage(messages.confirmOnQuit),
565 value: settings.all.app.confirmOnQuit, 569 value: settings.all.app.confirmOnQuit,
566 default: DEFAULT_APP_SETTINGS.confirmOnQuit, 570 default: DEFAULT_APP_SETTINGS.confirmOnQuit,
571 type: 'checkbox',
567 }, 572 },
568 enableSystemTray: { 573 enableSystemTray: {
569 label: intl.formatMessage( 574 label: intl.formatMessage(
@@ -571,11 +576,13 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
571 ), 576 ),
572 value: settings.all.app.enableSystemTray, 577 value: settings.all.app.enableSystemTray,
573 default: DEFAULT_APP_SETTINGS.enableSystemTray, 578 default: DEFAULT_APP_SETTINGS.enableSystemTray,
579 type: 'checkbox',
574 }, 580 },
575 reloadAfterResume: { 581 reloadAfterResume: {
576 label: intl.formatMessage(messages.reloadAfterResume), 582 label: intl.formatMessage(messages.reloadAfterResume),
577 value: settings.all.app.reloadAfterResume, 583 value: settings.all.app.reloadAfterResume,
578 default: DEFAULT_APP_SETTINGS.reloadAfterResume, 584 default: DEFAULT_APP_SETTINGS.reloadAfterResume,
585 type: 'checkbox',
579 }, 586 },
580 reloadAfterResumeTime: { 587 reloadAfterResumeTime: {
581 label: intl.formatMessage(messages.reloadAfterResumeTime), 588 label: intl.formatMessage(messages.reloadAfterResumeTime),
@@ -586,26 +593,31 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
586 label: intl.formatMessage(messages.minimizeToSystemTray), 593 label: intl.formatMessage(messages.minimizeToSystemTray),
587 value: settings.all.app.minimizeToSystemTray, 594 value: settings.all.app.minimizeToSystemTray,
588 default: DEFAULT_APP_SETTINGS.minimizeToSystemTray, 595 default: DEFAULT_APP_SETTINGS.minimizeToSystemTray,
596 type: 'checkbox',
589 }, 597 },
590 closeToSystemTray: { 598 closeToSystemTray: {
591 label: intl.formatMessage(messages.closeToSystemTray), 599 label: intl.formatMessage(messages.closeToSystemTray),
592 value: settings.all.app.closeToSystemTray, 600 value: settings.all.app.closeToSystemTray,
593 default: DEFAULT_APP_SETTINGS.closeToSystemTray, 601 default: DEFAULT_APP_SETTINGS.closeToSystemTray,
602 type: 'checkbox',
594 }, 603 },
595 privateNotifications: { 604 privateNotifications: {
596 label: intl.formatMessage(messages.privateNotifications), 605 label: intl.formatMessage(messages.privateNotifications),
597 value: settings.all.app.privateNotifications, 606 value: settings.all.app.privateNotifications,
598 default: DEFAULT_APP_SETTINGS.privateNotifications, 607 default: DEFAULT_APP_SETTINGS.privateNotifications,
608 type: 'checkbox',
599 }, 609 },
600 clipboardNotifications: { 610 clipboardNotifications: {
601 label: intl.formatMessage(messages.clipboardNotifications), 611 label: intl.formatMessage(messages.clipboardNotifications),
602 value: settings.all.app.clipboardNotifications, 612 value: settings.all.app.clipboardNotifications,
603 default: DEFAULT_APP_SETTINGS.clipboardNotifications, 613 default: DEFAULT_APP_SETTINGS.clipboardNotifications,
614 type: 'checkbox',
604 }, 615 },
605 notifyTaskBarOnMessage: { 616 notifyTaskBarOnMessage: {
606 label: intl.formatMessage(messages.notifyTaskBarOnMessage), 617 label: intl.formatMessage(messages.notifyTaskBarOnMessage),
607 value: settings.all.app.notifyTaskBarOnMessage, 618 value: settings.all.app.notifyTaskBarOnMessage,
608 default: DEFAULT_APP_SETTINGS.notifyTaskBarOnMessage, 619 default: DEFAULT_APP_SETTINGS.notifyTaskBarOnMessage,
620 type: 'checkbox',
609 }, 621 },
610 navigationBarBehaviour: { 622 navigationBarBehaviour: {
611 label: intl.formatMessage(messages.navigationBarBehaviour), 623 label: intl.formatMessage(messages.navigationBarBehaviour),
@@ -618,6 +630,7 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
618 value: settings.all.app.webRTCIPHandlingPolicy, 630 value: settings.all.app.webRTCIPHandlingPolicy,
619 default: DEFAULT_APP_SETTINGS.webRTCIPHandlingPolicy, 631 default: DEFAULT_APP_SETTINGS.webRTCIPHandlingPolicy,
620 options: webRTCIPHandlingPolicies, 632 options: webRTCIPHandlingPolicies,
633 type: 'checkbox',
621 }, 634 },
622 searchEngine: { 635 searchEngine: {
623 label: intl.formatMessage(messages.searchEngine), 636 label: intl.formatMessage(messages.searchEngine),
@@ -641,11 +654,13 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
641 label: intl.formatMessage(messages.sentry), 654 label: intl.formatMessage(messages.sentry),
642 value: settings.all.app.sentry, 655 value: settings.all.app.sentry,
643 default: DEFAULT_APP_SETTINGS.sentry, 656 default: DEFAULT_APP_SETTINGS.sentry,
657 type: 'checkbox',
644 }, 658 },
645 hibernateOnStartup: { 659 hibernateOnStartup: {
646 label: intl.formatMessage(messages.hibernateOnStartup), 660 label: intl.formatMessage(messages.hibernateOnStartup),
647 value: settings.all.app.hibernateOnStartup, 661 value: settings.all.app.hibernateOnStartup,
648 default: DEFAULT_APP_SETTINGS.hibernateOnStartup, 662 default: DEFAULT_APP_SETTINGS.hibernateOnStartup,
663 type: 'checkbox',
649 }, 664 },
650 hibernationStrategy: { 665 hibernationStrategy: {
651 label: intl.formatMessage(messages.hibernationStrategy), 666 label: intl.formatMessage(messages.hibernationStrategy),
@@ -669,6 +684,7 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
669 label: intl.formatMessage(messages.wakeUpHibernationSplay), 684 label: intl.formatMessage(messages.wakeUpHibernationSplay),
670 value: settings.all.app.wakeUpHibernationSplay, 685 value: settings.all.app.wakeUpHibernationSplay,
671 default: DEFAULT_APP_SETTINGS.wakeUpHibernationSplay, 686 default: DEFAULT_APP_SETTINGS.wakeUpHibernationSplay,
687 type: 'checkbox',
672 }, 688 },
673 predefinedTodoServer: { 689 predefinedTodoServer: {
674 label: intl.formatMessage(messages.predefinedTodoServer), 690 label: intl.formatMessage(messages.predefinedTodoServer),
@@ -685,6 +701,7 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
685 label: intl.formatMessage(messages.enableLock), 701 label: intl.formatMessage(messages.enableLock),
686 value: settings.all.app.lockingFeatureEnabled || false, 702 value: settings.all.app.lockingFeatureEnabled || false,
687 default: DEFAULT_APP_SETTINGS.lockingFeatureEnabled, 703 default: DEFAULT_APP_SETTINGS.lockingFeatureEnabled,
704 type: 'checkbox',
688 }, 705 },
689 lockedPassword: { 706 lockedPassword: {
690 label: intl.formatMessage(messages.lockPassword), 707 label: intl.formatMessage(messages.lockPassword),
@@ -696,6 +713,7 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
696 label: intl.formatMessage(messages.useTouchIdToUnlock), 713 label: intl.formatMessage(messages.useTouchIdToUnlock),
697 value: settings.all.app.useTouchIdToUnlock, 714 value: settings.all.app.useTouchIdToUnlock,
698 default: DEFAULT_APP_SETTINGS.useTouchIdToUnlock, 715 default: DEFAULT_APP_SETTINGS.useTouchIdToUnlock,
716 type: 'checkbox',
699 }, 717 },
700 inactivityLock: { 718 inactivityLock: {
701 label: intl.formatMessage(messages.inactivityLock), 719 label: intl.formatMessage(messages.inactivityLock),
@@ -707,6 +725,7 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
707 label: intl.formatMessage(messages.scheduledDNDEnabled), 725 label: intl.formatMessage(messages.scheduledDNDEnabled),
708 value: settings.all.app.scheduledDNDEnabled || false, 726 value: settings.all.app.scheduledDNDEnabled || false,
709 default: DEFAULT_APP_SETTINGS.scheduledDNDEnabled, 727 default: DEFAULT_APP_SETTINGS.scheduledDNDEnabled,
728 type: 'checkbox',
710 }, 729 },
711 scheduledDNDStart: { 730 scheduledDNDStart: {
712 label: intl.formatMessage(messages.scheduledDNDStart), 731 label: intl.formatMessage(messages.scheduledDNDStart),
@@ -724,31 +743,37 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
724 label: intl.formatMessage(messages.showDisabledServices), 743 label: intl.formatMessage(messages.showDisabledServices),
725 value: settings.all.app.showDisabledServices, 744 value: settings.all.app.showDisabledServices,
726 default: DEFAULT_APP_SETTINGS.showDisabledServices, 745 default: DEFAULT_APP_SETTINGS.showDisabledServices,
746 type: 'checkbox',
727 }, 747 },
728 showServiceName: { 748 showServiceName: {
729 label: intl.formatMessage(messages.showServiceName), 749 label: intl.formatMessage(messages.showServiceName),
730 value: settings.all.app.showServiceName, 750 value: settings.all.app.showServiceName,
731 default: DEFAULT_APP_SETTINGS.showServiceName, 751 default: DEFAULT_APP_SETTINGS.showServiceName,
752 type: 'checkbox',
732 }, 753 },
733 showMessageBadgeWhenMuted: { 754 showMessageBadgeWhenMuted: {
734 label: intl.formatMessage(messages.showMessageBadgeWhenMuted), 755 label: intl.formatMessage(messages.showMessageBadgeWhenMuted),
735 value: settings.all.app.showMessageBadgeWhenMuted, 756 value: settings.all.app.showMessageBadgeWhenMuted,
736 default: DEFAULT_APP_SETTINGS.showMessageBadgeWhenMuted, 757 default: DEFAULT_APP_SETTINGS.showMessageBadgeWhenMuted,
758 type: 'checkbox',
737 }, 759 },
738 showDragArea: { 760 showDragArea: {
739 label: intl.formatMessage(messages.showDragArea), 761 label: intl.formatMessage(messages.showDragArea),
740 value: settings.all.app.showDragArea, 762 value: settings.all.app.showDragArea,
741 default: DEFAULT_APP_SETTINGS.showDragArea, 763 default: DEFAULT_APP_SETTINGS.showDragArea,
764 type: 'checkbox',
742 }, 765 },
743 enableSpellchecking: { 766 enableSpellchecking: {
744 label: intl.formatMessage(messages.enableSpellchecking), 767 label: intl.formatMessage(messages.enableSpellchecking),
745 value: settings.all.app.enableSpellchecking, 768 value: settings.all.app.enableSpellchecking,
746 default: DEFAULT_APP_SETTINGS.enableSpellchecking, 769 default: DEFAULT_APP_SETTINGS.enableSpellchecking,
770 type: 'checkbox',
747 }, 771 },
748 enableTranslator: { 772 enableTranslator: {
749 label: intl.formatMessage(messages.enableTranslator), 773 label: intl.formatMessage(messages.enableTranslator),
750 value: settings.all.app.enableTranslator, 774 value: settings.all.app.enableTranslator,
751 default: DEFAULT_APP_SETTINGS.enableTranslator, 775 default: DEFAULT_APP_SETTINGS.enableTranslator,
776 type: 'checkbox',
752 }, 777 },
753 spellcheckerLanguage: { 778 spellcheckerLanguage: {
754 label: intl.formatMessage(globalMessages.spellcheckerLanguage), 779 label: intl.formatMessage(globalMessages.spellcheckerLanguage),
@@ -766,21 +791,25 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
766 label: intl.formatMessage(messages.darkMode), 791 label: intl.formatMessage(messages.darkMode),
767 value: settings.all.app.darkMode, 792 value: settings.all.app.darkMode,
768 default: DEFAULT_APP_SETTINGS.darkMode, 793 default: DEFAULT_APP_SETTINGS.darkMode,
794 type: 'checkbox',
769 }, 795 },
770 adaptableDarkMode: { 796 adaptableDarkMode: {
771 label: intl.formatMessage(messages.adaptableDarkMode), 797 label: intl.formatMessage(messages.adaptableDarkMode),
772 value: settings.all.app.adaptableDarkMode, 798 value: settings.all.app.adaptableDarkMode,
773 default: DEFAULT_APP_SETTINGS.adaptableDarkMode, 799 default: DEFAULT_APP_SETTINGS.adaptableDarkMode,
800 type: 'checkbox',
774 }, 801 },
775 universalDarkMode: { 802 universalDarkMode: {
776 label: intl.formatMessage(messages.universalDarkMode), 803 label: intl.formatMessage(messages.universalDarkMode),
777 value: settings.all.app.universalDarkMode, 804 value: settings.all.app.universalDarkMode,
778 default: DEFAULT_APP_SETTINGS.universalDarkMode, 805 default: DEFAULT_APP_SETTINGS.universalDarkMode,
806 type: 'checkbox',
779 }, 807 },
780 splitMode: { 808 splitMode: {
781 label: intl.formatMessage(messages.splitMode), 809 label: intl.formatMessage(messages.splitMode),
782 value: settings.all.app.splitMode, 810 value: settings.all.app.splitMode,
783 default: DEFAULT_APP_SETTINGS.splitMode, 811 default: DEFAULT_APP_SETTINGS.splitMode,
812 type: 'checkbox',
784 }, 813 },
785 splitColumns: { 814 splitColumns: {
786 label: `${intl.formatMessage( 815 label: `${intl.formatMessage(
@@ -811,31 +840,37 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
811 label: intl.formatMessage(messages.enableLongPressServiceHint), 840 label: intl.formatMessage(messages.enableLongPressServiceHint),
812 value: settings.all.app.enableLongPressServiceHint, 841 value: settings.all.app.enableLongPressServiceHint,
813 default: DEFAULT_APP_SETTINGS.enableLongPressServiceHint, 842 default: DEFAULT_APP_SETTINGS.enableLongPressServiceHint,
843 type: 'checkbox',
814 }, 844 },
815 useHorizontalStyle: { 845 useHorizontalStyle: {
816 label: intl.formatMessage(messages.useHorizontalStyle), 846 label: intl.formatMessage(messages.useHorizontalStyle),
817 value: settings.all.app.useHorizontalStyle, 847 value: settings.all.app.useHorizontalStyle,
818 default: DEFAULT_APP_SETTINGS.useHorizontalStyle, 848 default: DEFAULT_APP_SETTINGS.useHorizontalStyle,
849 type: 'checkbox',
819 }, 850 },
820 hideCollapseButton: { 851 hideCollapseButton: {
821 label: intl.formatMessage(messages.hideCollapseButton), 852 label: intl.formatMessage(messages.hideCollapseButton),
822 value: settings.all.app.hideCollapseButton, 853 value: settings.all.app.hideCollapseButton,
823 default: DEFAULT_APP_SETTINGS.hideCollapseButton, 854 default: DEFAULT_APP_SETTINGS.hideCollapseButton,
855 type: 'checkbox',
824 }, 856 },
825 hideRecipesButton: { 857 hideRecipesButton: {
826 label: intl.formatMessage(messages.hideRecipesButton), 858 label: intl.formatMessage(messages.hideRecipesButton),
827 value: settings.all.app.hideRecipesButton, 859 value: settings.all.app.hideRecipesButton,
828 default: DEFAULT_APP_SETTINGS.hideRecipesButton, 860 default: DEFAULT_APP_SETTINGS.hideRecipesButton,
861 type: 'checkbox',
829 }, 862 },
830 hideSplitModeButton: { 863 hideSplitModeButton: {
831 label: intl.formatMessage(messages.hideSplitModeButton), 864 label: intl.formatMessage(messages.hideSplitModeButton),
832 value: settings.all.app.hideSplitModeButton, 865 value: settings.all.app.hideSplitModeButton,
833 default: DEFAULT_APP_SETTINGS.hideSplitModeButton, 866 default: DEFAULT_APP_SETTINGS.hideSplitModeButton,
867 type: 'checkbox',
834 }, 868 },
835 useGrayscaleServices: { 869 useGrayscaleServices: {
836 label: intl.formatMessage(messages.useGrayscaleServices), 870 label: intl.formatMessage(messages.useGrayscaleServices),
837 value: settings.all.app.useGrayscaleServices, 871 value: settings.all.app.useGrayscaleServices,
838 default: DEFAULT_APP_SETTINGS.useGrayscaleServices, 872 default: DEFAULT_APP_SETTINGS.useGrayscaleServices,
873 type: 'checkbox',
839 }, 874 },
840 grayscaleServicesDim: { 875 grayscaleServicesDim: {
841 label: intl.formatMessage(messages.grayscaleServicesDim), 876 label: intl.formatMessage(messages.grayscaleServicesDim),
@@ -846,21 +881,25 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
846 label: intl.formatMessage(messages.hideWorkspacesButton), 881 label: intl.formatMessage(messages.hideWorkspacesButton),
847 value: settings.all.app.hideWorkspacesButton, 882 value: settings.all.app.hideWorkspacesButton,
848 default: DEFAULT_APP_SETTINGS.hideWorkspacesButton, 883 default: DEFAULT_APP_SETTINGS.hideWorkspacesButton,
884 type: 'checkbox',
849 }, 885 },
850 hideNotificationsButton: { 886 hideNotificationsButton: {
851 label: intl.formatMessage(messages.hideNotificationsButton), 887 label: intl.formatMessage(messages.hideNotificationsButton),
852 value: settings.all.app.hideNotificationsButton, 888 value: settings.all.app.hideNotificationsButton,
853 default: DEFAULT_APP_SETTINGS.hideNotificationsButton, 889 default: DEFAULT_APP_SETTINGS.hideNotificationsButton,
890 type: 'checkbox',
854 }, 891 },
855 hideSettingsButton: { 892 hideSettingsButton: {
856 label: intl.formatMessage(messages.hideSettingsButton), 893 label: intl.formatMessage(messages.hideSettingsButton),
857 value: settings.all.app.hideSettingsButton, 894 value: settings.all.app.hideSettingsButton,
858 default: DEFAULT_APP_SETTINGS.hideSettingsButton, 895 default: DEFAULT_APP_SETTINGS.hideSettingsButton,
896 type: 'checkbox',
859 }, 897 },
860 alwaysShowWorkspaces: { 898 alwaysShowWorkspaces: {
861 label: intl.formatMessage(messages.alwaysShowWorkspaces), 899 label: intl.formatMessage(messages.alwaysShowWorkspaces),
862 value: settings.all.app.alwaysShowWorkspaces, 900 value: settings.all.app.alwaysShowWorkspaces,
863 default: DEFAULT_APP_SETTINGS.alwaysShowWorkspaces, 901 default: DEFAULT_APP_SETTINGS.alwaysShowWorkspaces,
902 type: 'checkbox',
864 }, 903 },
865 accentColor: { 904 accentColor: {
866 label: intl.formatMessage(messages.accentColor), 905 label: intl.formatMessage(messages.accentColor),
@@ -876,11 +915,13 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
876 label: intl.formatMessage(messages.enableGPUAcceleration), 915 label: intl.formatMessage(messages.enableGPUAcceleration),
877 value: settings.all.app.enableGPUAcceleration, 916 value: settings.all.app.enableGPUAcceleration,
878 default: DEFAULT_APP_SETTINGS.enableGPUAcceleration, 917 default: DEFAULT_APP_SETTINGS.enableGPUAcceleration,
918 type: 'checkbox',
879 }, 919 },
880 enableGlobalHideShortcut: { 920 enableGlobalHideShortcut: {
881 label: intl.formatMessage(messages.enableGlobalHideShortcut), 921 label: intl.formatMessage(messages.enableGlobalHideShortcut),
882 value: settings.all.app.enableGlobalHideShortcut, 922 value: settings.all.app.enableGlobalHideShortcut,
883 default: DEFAULT_APP_SETTINGS.enableGlobalHideShortcut, 923 default: DEFAULT_APP_SETTINGS.enableGlobalHideShortcut,
924 type: 'checkbox',
884 }, 925 },
885 locale: { 926 locale: {
886 label: intl.formatMessage(messages.language), 927 label: intl.formatMessage(messages.language),
@@ -897,6 +938,7 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
897 label: intl.formatMessage(messages.automaticUpdates), 938 label: intl.formatMessage(messages.automaticUpdates),
898 value: settings.app.automaticUpdates, 939 value: settings.app.automaticUpdates,
899 default: DEFAULT_APP_SETTINGS.automaticUpdates, 940 default: DEFAULT_APP_SETTINGS.automaticUpdates,
941 type: 'checkbox',
900 }, 942 },
901 }, 943 },
902 }; 944 };
@@ -914,6 +956,7 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
914 label: intl.formatMessage(messages.keepAllWorkspacesLoaded), 956 label: intl.formatMessage(messages.keepAllWorkspacesLoaded),
915 value: workspaces.settings.keepAllWorkspacesLoaded, 957 value: workspaces.settings.keepAllWorkspacesLoaded,
916 default: DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, 958 default: DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED,
959 type: 'checkbox',
917 }; 960 };
918 } 961 }
919 962
@@ -922,6 +965,7 @@ class EditSettingsScreen extends Component<EditSettingsScreenProps> {
922 label: intl.formatMessage(messages.enableTodos), 965 label: intl.formatMessage(messages.enableTodos),
923 value: todos.settings.isFeatureEnabledByUser, 966 value: todos.settings.isFeatureEnabledByUser,
924 default: DEFAULT_IS_FEATURE_ENABLED_BY_USER, 967 default: DEFAULT_IS_FEATURE_ENABLED_BY_USER,
968 type: 'checkbox',
925 }; 969 };
926 } 970 }
927 971
diff --git a/src/features/workspaces/components/WorkspaceServiceListItem.tsx b/src/features/workspaces/components/WorkspaceServiceListItem.tsx
index 420aed595..e708d5cdf 100644
--- a/src/features/workspaces/components/WorkspaceServiceListItem.tsx
+++ b/src/features/workspaces/components/WorkspaceServiceListItem.tsx
@@ -53,7 +53,7 @@ class WorkspaceServiceListItem extends Component<IProps> {
53 </span> 53 </span>
54 <Toggle 54 <Toggle
55 className={classes.toggle} 55 className={classes.toggle}
56 value={isInWorkspace} 56 checked={isInWorkspace}
57 onChange={onToggle} 57 onChange={onToggle}
58 /> 58 />
59 </div> 59 </div>
diff --git a/src/models/Recipe.ts b/src/models/Recipe.ts
index 6911f7301..8b4c7a8ba 100644
--- a/src/models/Recipe.ts
+++ b/src/models/Recipe.ts
@@ -55,6 +55,11 @@ export interface IRecipe {
55 readonly modifyRequestHeaders?: null | Function; 55 readonly modifyRequestHeaders?: null | Function;
56 readonly knownCertificateHosts?: null | Function; 56 readonly knownCertificateHosts?: null | Function;
57 readonly events?: null | { (key: string): string }; 57 readonly events?: null | { (key: string): string };
58
59 // TODO - [TS DEBT] Need to check if below properties are needed and where is inherited / implemented from
60 author?: string[];
61 hasDarkMode?: boolean;
62 validateUrl?: (url: string) => boolean;
58} 63}
59 64
60export default class Recipe implements IRecipe { 65export default class Recipe implements IRecipe {
@@ -102,6 +107,9 @@ export default class Recipe implements IRecipe {
102 // TODO: Is this being used? 107 // TODO: Is this being used?
103 local = false; 108 local = false;
104 109
110 // TODO - [TS DEBT] introduced to address missing function but need to check how validateUrl is inherited / implemented in recipe
111 validateUrl?: (url: string) => boolean;
112
105 // TODO: Need to reconcile which of these are optional/mandatory 113 // TODO: Need to reconcile which of these are optional/mandatory
106 constructor(data: RecipeData) { 114 constructor(data: RecipeData) {
107 if (!data) { 115 if (!data) {