diff options
Diffstat (limited to 'src')
39 files changed, 201 insertions, 226 deletions
diff --git a/src/@types/kebab-case.d.ts b/src/@types/kebab-case.d.ts deleted file mode 100644 index 712405ac0..000000000 --- a/src/@types/kebab-case.d.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | declare module 'kebab-case'; | ||
diff --git a/src/@types/mobx-form.types.ts b/src/@types/mobx-form.types.ts index 07234a47a..aa274b9db 100644 --- a/src/@types/mobx-form.types.ts +++ b/src/@types/mobx-form.types.ts | |||
@@ -1,17 +1,17 @@ | |||
1 | import { File } from 'electron-dl'; | ||
2 | import { ChangeEventHandler, FocusEventHandler } from 'react'; | 1 | import { ChangeEventHandler, FocusEventHandler } from 'react'; |
3 | import { GlobalError } from './ferdium-components.types'; | 2 | import { GlobalError } from './ferdium-components.types'; |
4 | 3 | ||
5 | export interface FormFieldOptions { | 4 | interface SelectOptions { |
6 | value?: string; | ||
7 | label?: string; | ||
8 | disabled?: boolean; | 5 | disabled?: boolean; |
6 | label?: string; | ||
7 | value?: string; | ||
9 | } | 8 | } |
10 | 9 | ||
11 | export interface FormFields { | 10 | interface Listeners { |
12 | fields: { | 11 | onChange?: ChangeEventHandler<HTMLInputElement | HTMLSelectElement>; |
13 | [key: string]: Field; | 12 | onBlur?: FocusEventHandler<HTMLElement>; |
14 | }; | 13 | onFocus?: FocusEventHandler<HTMLElement>; |
14 | onDrop?: (file: File) => void; | ||
15 | } | 15 | } |
16 | 16 | ||
17 | export interface Field extends Listeners { | 17 | export interface Field extends Listeners { |
@@ -29,16 +29,8 @@ export interface Field extends Listeners { | |||
29 | set?: (value: any) => void; | 29 | set?: (value: any) => void; |
30 | [key: string]: any; | 30 | [key: string]: any; |
31 | } | 31 | } |
32 | 32 | export interface FormFields { | |
33 | export interface SelectOptions { | 33 | fields: { |
34 | disabled?: boolean; | 34 | [key: string]: Field; |
35 | label?: string; | 35 | }; |
36 | value?: string; | ||
37 | } | ||
38 | |||
39 | export interface Listeners { | ||
40 | onChange?: ChangeEventHandler<HTMLInputElement | HTMLSelectElement>; | ||
41 | onBlur?: FocusEventHandler<HTMLElement>; | ||
42 | onFocus?: FocusEventHandler<HTMLElement>; | ||
43 | onDrop?: (file: File) => void; | ||
44 | } | 36 | } |
diff --git a/src/@types/stores.types.ts b/src/@types/stores.types.ts index ff8f127ed..dc5da563f 100644 --- a/src/@types/stores.types.ts +++ b/src/@types/stores.types.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | /* eslint-disable no-use-before-define */ | ||
1 | import Workspace from '../features/workspaces/models/Workspace'; | 2 | import Workspace from '../features/workspaces/models/Workspace'; |
2 | import Recipe from '../models/Recipe'; | 3 | import Recipe from '../models/Recipe'; |
3 | import Service from '../models/Service'; | 4 | import Service from '../models/Service'; |
@@ -201,7 +202,7 @@ interface RouterStore { | |||
201 | replace: () => void; | 202 | replace: () => void; |
202 | } | 203 | } |
203 | 204 | ||
204 | export interface ServicesStore extends TypedStore { | 205 | interface ServicesStore extends TypedStore { |
205 | clearCacheRequest: () => void; | 206 | clearCacheRequest: () => void; |
206 | createServiceRequest: CachedRequest; | 207 | createServiceRequest: CachedRequest; |
207 | deleteServiceRequest: () => void; | 208 | deleteServiceRequest: () => void; |
@@ -227,7 +228,7 @@ interface ISettings { | |||
227 | [key: string]: any; | 228 | [key: string]: any; |
228 | } | 229 | } |
229 | 230 | ||
230 | export interface SettingsStore extends TypedStore { | 231 | interface SettingsStore extends TypedStore { |
231 | update: (value: any) => void; | 232 | update: (value: any) => void; |
232 | remove: (value: any) => void; | 233 | remove: (value: any) => void; |
233 | fileSystemSettingsTypes: any[]; | 234 | fileSystemSettingsTypes: any[]; |
@@ -288,7 +289,7 @@ interface UIStore extends TypedStore { | |||
288 | theme: () => void; | 289 | theme: () => void; |
289 | } | 290 | } |
290 | 291 | ||
291 | export interface UserStore extends TypedStore { | 292 | interface UserStore extends TypedStore { |
292 | BASE_ROUTE: '/auth'; | 293 | BASE_ROUTE: '/auth'; |
293 | CHANGE_SERVER_ROUTE: '/auth/server'; | 294 | CHANGE_SERVER_ROUTE: '/auth/server'; |
294 | IMPORT_ROUTE: '/auth/signup/import'; | 295 | IMPORT_ROUTE: '/auth/signup/import'; |
@@ -338,7 +339,7 @@ export interface UserStore extends TypedStore { | |||
338 | team: () => void; | 339 | team: () => void; |
339 | } | 340 | } |
340 | 341 | ||
341 | export interface WorkspacesStore extends TypedStore { | 342 | interface WorkspacesStore extends TypedStore { |
342 | activeWorkspace: () => void; | 343 | activeWorkspace: () => void; |
343 | delete: ({ workspace }) => void; | 344 | delete: ({ workspace }) => void; |
344 | update: ({ workspace }) => void; | 345 | update: ({ workspace }) => void; |
diff --git a/src/actions/index.ts b/src/actions/index.ts index 983afa64b..5297a7a7b 100644 --- a/src/actions/index.ts +++ b/src/actions/index.ts | |||
@@ -10,7 +10,7 @@ import user from './user'; | |||
10 | import settings from './settings'; | 10 | import settings from './settings'; |
11 | import requests from './requests'; | 11 | import requests from './requests'; |
12 | import workspaces from '../features/workspaces/actions'; | 12 | import workspaces from '../features/workspaces/actions'; |
13 | import todos from '../features/todos/actions'; | 13 | import { todoActions } from '../features/todos/actions'; |
14 | 14 | ||
15 | const actions = { | 15 | const actions = { |
16 | service, | 16 | service, |
@@ -26,5 +26,5 @@ const actions = { | |||
26 | export default Object.assign( | 26 | export default Object.assign( |
27 | defineActions(actions, PropTypes.checkPropTypes), | 27 | defineActions(actions, PropTypes.checkPropTypes), |
28 | { workspaces }, | 28 | { workspaces }, |
29 | { todos }, | 29 | { todos: todoActions }, |
30 | ); | 30 | ); |
diff --git a/src/api/server/ServerApi.ts b/src/api/server/ServerApi.ts index 860b7b76e..de8e0a85c 100644 --- a/src/api/server/ServerApi.ts +++ b/src/api/server/ServerApi.ts | |||
@@ -15,8 +15,8 @@ import { | |||
15 | } from 'fs-extra'; | 15 | } from 'fs-extra'; |
16 | 16 | ||
17 | import ServiceModel from '../../models/Service'; | 17 | import ServiceModel from '../../models/Service'; |
18 | import RecipePreviewModel from '../../models/RecipePreview'; | 18 | import RecipePreviewModel, { IRecipePreview } from '../../models/RecipePreview'; |
19 | import RecipeModel from '../../models/Recipe'; | 19 | import RecipeModel, { IRecipe } from '../../models/Recipe'; |
20 | import UserModel from '../../models/User'; | 20 | import UserModel from '../../models/User'; |
21 | 21 | ||
22 | import sleep from '../../helpers/async-helpers'; | 22 | import sleep from '../../helpers/async-helpers'; |
@@ -44,9 +44,9 @@ const debug = require('../../preload-safe-debug')('Ferdium:ServerApi'); | |||
44 | module.paths.unshift(getDevRecipeDirectory(), getRecipeDirectory()); | 44 | module.paths.unshift(getDevRecipeDirectory(), getRecipeDirectory()); |
45 | 45 | ||
46 | export default class ServerApi { | 46 | export default class ServerApi { |
47 | recipePreviews: any[] = []; | 47 | recipePreviews: IRecipePreview[] = []; |
48 | 48 | ||
49 | recipes: any[] = []; | 49 | recipes: IRecipe[] = []; |
50 | 50 | ||
51 | // User | 51 | // User |
52 | async login(email: string, passwordHash: string) { | 52 | async login(email: string, passwordHash: string) { |
@@ -55,7 +55,9 @@ export default class ServerApi { | |||
55 | { | 55 | { |
56 | method: 'POST', | 56 | method: 'POST', |
57 | headers: { | 57 | headers: { |
58 | Authorization: `Basic ${window.btoa(`${email}:${passwordHash}`)}`, | 58 | Authorization: `Basic ${Buffer.from( |
59 | `${email}:${passwordHash}`, | ||
60 | ).toString('base64')}`, | ||
59 | }, | 61 | }, |
60 | }, | 62 | }, |
61 | false, | 63 | false, |
@@ -346,6 +348,7 @@ export default class ServerApi { | |||
346 | }) | 348 | }) |
347 | .filter(recipe => recipe.id); | 349 | .filter(recipe => recipe.id); |
348 | 350 | ||
351 | // @ts-expect-error Type 'boolean' is not assignable to type 'ConcatArray<IRecipe>'. | ||
349 | // eslint-disable-next-line unicorn/prefer-spread | 352 | // eslint-disable-next-line unicorn/prefer-spread |
350 | this.recipes = this.recipes.concat(this._getDevRecipes()); | 353 | this.recipes = this.recipes.concat(this._getDevRecipes()); |
351 | 354 | ||
@@ -515,9 +518,8 @@ export default class ServerApi { | |||
515 | } | 518 | } |
516 | 519 | ||
517 | async _prepareServiceModel(service: { recipeId: string }) { | 520 | async _prepareServiceModel(service: { recipeId: string }) { |
518 | let recipe: undefined; | ||
519 | try { | 521 | try { |
520 | recipe = this.recipes.find(r => r.id === service.recipeId); | 522 | const recipe = this.recipes.find(r => r.id === service.recipeId); |
521 | 523 | ||
522 | if (!recipe) { | 524 | if (!recipe) { |
523 | console.warn(`Recipe ${service.recipeId} not loaded`); | 525 | console.warn(`Recipe ${service.recipeId} not loaded`); |
@@ -531,11 +533,10 @@ export default class ServerApi { | |||
531 | } | 533 | } |
532 | } | 534 | } |
533 | 535 | ||
534 | async _bulkRecipeCheck(unfilteredRecipes: any[]) { | 536 | async _bulkRecipeCheck(unfilteredRecipes: string[]) { |
535 | // Filter recipe duplicates as we don't need to download 3 Slack recipes | 537 | // Filter recipe duplicates as we don't need to download 3 Slack recipes |
536 | const recipes = unfilteredRecipes.filter( | 538 | const recipes = unfilteredRecipes.filter( |
537 | (elem: any, pos: number, arr: string | any[]) => | 539 | (elem: string, pos: number, arr: string[]) => arr.indexOf(elem) === pos, |
538 | arr.indexOf(elem) === pos, | ||
539 | ); | 540 | ); |
540 | 541 | ||
541 | return Promise.all( | 542 | return Promise.all( |
@@ -565,7 +566,7 @@ export default class ServerApi { | |||
565 | ).catch(error => console.error("Can't load recipe", error)); | 566 | ).catch(error => console.error("Can't load recipe", error)); |
566 | } | 567 | } |
567 | 568 | ||
568 | _mapRecipePreviewModel(recipes: any[]) { | 569 | _mapRecipePreviewModel(recipes: IRecipePreview[]) { |
569 | return recipes | 570 | return recipes |
570 | .map(recipe => { | 571 | .map(recipe => { |
571 | try { | 572 | try { |
@@ -575,7 +576,7 @@ export default class ServerApi { | |||
575 | return null; | 576 | return null; |
576 | } | 577 | } |
577 | }) | 578 | }) |
578 | .filter(recipe => recipe !== null); | 579 | .filter(Boolean); |
579 | } | 580 | } |
580 | 581 | ||
581 | _getDevRecipes() { | 582 | _getDevRecipes() { |
@@ -589,15 +590,14 @@ export default class ServerApi { | |||
589 | 590 | ||
590 | const recipes = paths | 591 | const recipes = paths |
591 | .map(id => { | 592 | .map(id => { |
592 | let Recipe; | ||
593 | try { | 593 | try { |
594 | // eslint-disable-next-line import/no-dynamic-require | 594 | // eslint-disable-next-line import/no-dynamic-require |
595 | Recipe = require(id)(RecipeModel); | 595 | const Recipe = require(id)(RecipeModel); |
596 | |||
596 | return new Recipe(loadRecipeConfig(id)); | 597 | return new Recipe(loadRecipeConfig(id)); |
597 | } catch (error) { | 598 | } catch (error) { |
598 | console.error(error); | 599 | console.error(error); |
599 | } | 600 | } |
600 | |||
601 | return false; | 601 | return false; |
602 | }) | 602 | }) |
603 | .filter(recipe => recipe.id) | 603 | .filter(recipe => recipe.id) |
diff --git a/src/components/auth/Login.tsx b/src/components/auth/Login.tsx index eaa04256c..cf7abe654 100644 --- a/src/components/auth/Login.tsx +++ b/src/components/auth/Login.tsx | |||
@@ -99,7 +99,7 @@ class Login extends Component<IProps> { | |||
99 | submit(e: FormEvent<HTMLFormElement>): void { | 99 | submit(e: FormEvent<HTMLFormElement>): void { |
100 | e.preventDefault(); | 100 | e.preventDefault(); |
101 | this.form.submit({ | 101 | this.form.submit({ |
102 | onSuccess: form => { | 102 | onSuccess: (form: Form) => { |
103 | this.props.onSubmit(form.values()); | 103 | this.props.onSubmit(form.values()); |
104 | }, | 104 | }, |
105 | onError: noop, | 105 | onError: noop, |
diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index ceb9cfff9..6fd911a24 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx | |||
@@ -80,6 +80,7 @@ interface IProps extends WrappedComponentProps { | |||
80 | showServiceNameSetting: boolean; | 80 | showServiceNameSetting: boolean; |
81 | showMessageBadgesEvenWhenMuted: boolean; | 81 | showMessageBadgesEvenWhenMuted: boolean; |
82 | isAppMuted: boolean; | 82 | isAppMuted: boolean; |
83 | // eslint-disable-next-line react/no-unused-prop-types | ||
83 | isMenuCollapsed: boolean; | 84 | isMenuCollapsed: boolean; |
84 | isWorkspaceDrawerOpen: boolean; | 85 | isWorkspaceDrawerOpen: boolean; |
85 | isTodosServiceActive: boolean; | 86 | isTodosServiceActive: boolean; |
@@ -90,6 +91,7 @@ interface IProps extends WrappedComponentProps { | |||
90 | toggleCollapseMenu: () => void; | 91 | toggleCollapseMenu: () => void; |
91 | toggleWorkspaceDrawer: () => void; | 92 | toggleWorkspaceDrawer: () => void; |
92 | openSettings: (args: { path: string }) => void; | 93 | openSettings: (args: { path: string }) => void; |
94 | // eslint-disable-next-line react/no-unused-prop-types | ||
93 | closeSettings: () => void; | 95 | closeSettings: () => void; |
94 | setActive: (args: { serviceId: string }) => void; | 96 | setActive: (args: { serviceId: string }) => void; |
95 | reorder: (args: { oldIndex: number; newIndex: number }) => void; | 97 | reorder: (args: { oldIndex: number; newIndex: number }) => void; |
diff --git a/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx b/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx index ff7c45bb1..9b17e551c 100644 --- a/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx +++ b/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
3 | import { defineMessages, injectIntl } from 'react-intl'; | 3 | import { IntlShape, defineMessages, injectIntl } from 'react-intl'; |
4 | import Markdown from 'markdown-to-jsx'; | 4 | import Markdown from 'markdown-to-jsx'; |
5 | import { ferdiumVersion } from '../../../environment-remote'; | 5 | import { ferdiumVersion } from '../../../environment-remote'; |
6 | import { | 6 | import { |
@@ -26,14 +26,14 @@ const messages = defineMessages({ | |||
26 | }); | 26 | }); |
27 | 27 | ||
28 | interface IProps { | 28 | interface IProps { |
29 | intl: any; | 29 | intl: IntlShape; |
30 | } | 30 | } |
31 | 31 | ||
32 | class ReleaseNotesDashboard extends Component<IProps> { | 32 | interface IState { |
33 | state = { | 33 | data: string; |
34 | data: '', | 34 | } |
35 | }; | ||
36 | 35 | ||
36 | class ReleaseNotesDashboard extends Component<IProps, IState> { | ||
37 | constructor(props) { | 37 | constructor(props) { |
38 | super(props); | 38 | super(props); |
39 | 39 | ||
diff --git a/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx b/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx index bc38aa603..4a6fe54f4 100644 --- a/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx +++ b/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx | |||
@@ -19,6 +19,7 @@ const messages = defineMessages({ | |||
19 | 19 | ||
20 | interface IProps extends WrappedComponentProps { | 20 | interface IProps extends WrappedComponentProps { |
21 | actions?: Actions; | 21 | actions?: Actions; |
22 | // eslint-disable-next-line react/no-unused-prop-types | ||
22 | children?: React.ReactNode; | 23 | children?: React.ReactNode; |
23 | } | 24 | } |
24 | 25 | ||
diff --git a/src/components/settings/settings/EditSettingsForm.tsx b/src/components/settings/settings/EditSettingsForm.tsx index 11ae63737..099a27ebe 100644 --- a/src/components/settings/settings/EditSettingsForm.tsx +++ b/src/components/settings/settings/EditSettingsForm.tsx | |||
@@ -333,7 +333,7 @@ class EditSettingsForm extends Component<IProps, IState> { | |||
333 | } | 333 | } |
334 | 334 | ||
335 | this.props.form.submit({ | 335 | this.props.form.submit({ |
336 | onSuccess: form => { | 336 | onSuccess: (form: Form) => { |
337 | const values = form.values(); | 337 | const values = form.values(); |
338 | const { accentColor } = values; | 338 | const { accentColor } = values; |
339 | if (accentColor.trim().length === 0) { | 339 | if (accentColor.trim().length === 0) { |
@@ -386,8 +386,9 @@ class EditSettingsForm extends Component<IProps, IState> { | |||
386 | const { lockingFeatureEnabled, scheduledDNDEnabled, reloadAfterResume } = | 386 | const { lockingFeatureEnabled, scheduledDNDEnabled, reloadAfterResume } = |
387 | window['ferdium'].stores.settings.all.app; | 387 | window['ferdium'].stores.settings.all.app; |
388 | 388 | ||
389 | let cacheSize; | 389 | let cacheSize: string; |
390 | let notCleared; | 390 | let notCleared: boolean; |
391 | |||
391 | if (this.state.activeSetttingsTab === 'advanced') { | 392 | if (this.state.activeSetttingsTab === 'advanced') { |
392 | const cacheSizeBytes = getCacheSize(); | 393 | const cacheSizeBytes = getCacheSize(); |
393 | debug('cacheSizeBytes:', cacheSizeBytes); | 394 | debug('cacheSizeBytes:', cacheSizeBytes); |
@@ -740,38 +741,35 @@ class EditSettingsForm extends Component<IProps, IState> { | |||
740 | defaultAccentColor: DEFAULT_APP_SETTINGS.accentColor, | 741 | defaultAccentColor: DEFAULT_APP_SETTINGS.accentColor, |
741 | })} | 742 | })} |
742 | </p> | 743 | </p> |
743 | <p> | 744 | <p>{intl.formatMessage(messages.overallTheme)}</p> |
744 | {intl.formatMessage(messages.overallTheme)} | 745 | <div className="settings__settings-group__apply-color"> |
745 | <div className="settings__settings-group__apply-color"> | 746 | <ColorPickerInput |
746 | <ColorPickerInput | 747 | {...form.$('accentColor').bind()} |
747 | {...form.$('accentColor').bind()} | 748 | name="accentColor" |
748 | onColorChange={this.submit.bind(this)} | 749 | onColorChange={e => this.submit(e)} |
749 | className="color-picker-input" | 750 | className="color-picker-input" |
750 | /> | 751 | /> |
751 | </div> | 752 | </div> |
752 | </p> | 753 | <p>{intl.formatMessage(messages.progressbarTheme)}</p> |
753 | <p> | 754 | <div className="settings__settings-group__apply-color"> |
754 | {intl.formatMessage(messages.progressbarTheme)} | 755 | <ColorPickerInput |
755 | <div className="settings__settings-group__apply-color"> | 756 | {...form.$('progressbarAccentColor').bind()} |
756 | <ColorPickerInput | 757 | name="progressbarAccentColor" |
757 | {...form.$('progressbarAccentColor').bind()} | 758 | onColorChange={e => this.submit(e)} |
758 | onColorChange={this.submit.bind(this)} | 759 | className="color-picker-input" |
759 | className="color-picker-input" | 760 | /> |
760 | /> | 761 | </div> |
761 | </div> | 762 | |
762 | </p> | 763 | <div className="settings__settings-group__apply-color"> |
763 | <p> | 764 | <Button |
764 | <div className="settings__settings-group__apply-color"> | 765 | buttonType="secondary" |
765 | <Button | 766 | className="settings__settings-group__apply-color__button" |
766 | buttonType="secondary" | 767 | label="Apply color" |
767 | className="settings__settings-group__apply-color__button" | 768 | onClick={e => { |
768 | label="Apply color" | 769 | this.submit(e); |
769 | onClick={e => { | 770 | }} |
770 | this.submit(e); | 771 | /> |
771 | }} | 772 | </div> |
772 | /> | ||
773 | </div> | ||
774 | </p> | ||
775 | <HrSections /> | 773 | <HrSections /> |
776 | 774 | ||
777 | <H2 className="settings__section_header"> | 775 | <H2 className="settings__section_header"> |
diff --git a/src/components/ui/badge/ProBadge.tsx b/src/components/ui/badge/ProBadge.tsx index 62c45b77c..a5947d3a8 100644 --- a/src/components/ui/badge/ProBadge.tsx +++ b/src/components/ui/badge/ProBadge.tsx | |||
@@ -7,13 +7,6 @@ import { Theme } from '../../../themes'; | |||
7 | import Icon from '../icon'; | 7 | import Icon from '../icon'; |
8 | import Badge from './index'; | 8 | import Badge from './index'; |
9 | 9 | ||
10 | interface IProps extends WithStylesProps<typeof styles> { | ||
11 | badgeClasses?: string; | ||
12 | iconClasses?: string; | ||
13 | inverted?: boolean; | ||
14 | className?: string; | ||
15 | } | ||
16 | |||
17 | const styles = (theme: Theme) => ({ | 10 | const styles = (theme: Theme) => ({ |
18 | badge: { | 11 | badge: { |
19 | height: 'auto', | 12 | height: 'auto', |
@@ -32,6 +25,13 @@ const styles = (theme: Theme) => ({ | |||
32 | }, | 25 | }, |
33 | }); | 26 | }); |
34 | 27 | ||
28 | interface IProps extends WithStylesProps<typeof styles> { | ||
29 | badgeClasses?: string; | ||
30 | iconClasses?: string; | ||
31 | inverted?: boolean; | ||
32 | className?: string; | ||
33 | } | ||
34 | |||
35 | class ProBadgeComponent extends Component<IProps> { | 35 | class ProBadgeComponent extends Component<IProps> { |
36 | render() { | 36 | render() { |
37 | const { classes, badgeClasses, iconClasses, inverted, className } = | 37 | const { classes, badgeClasses, iconClasses, inverted, className } = |
diff --git a/src/components/ui/badge/index.tsx b/src/components/ui/badge/index.tsx index 33e2f5d53..44fbf2d4a 100644 --- a/src/components/ui/badge/index.tsx +++ b/src/components/ui/badge/index.tsx | |||
@@ -4,23 +4,17 @@ import injectStyle, { WithStylesProps } from 'react-jss'; | |||
4 | 4 | ||
5 | import { Theme } from '../../../themes'; | 5 | import { Theme } from '../../../themes'; |
6 | 6 | ||
7 | interface IProps extends WithStylesProps<typeof styles> { | ||
8 | type: string; | ||
9 | className?: string; | ||
10 | children: ReactNode; | ||
11 | } | ||
12 | |||
13 | const badgeStyles = (theme: Theme) => { | 7 | const badgeStyles = (theme: Theme) => { |
14 | const styles = {}; | 8 | const styles = {}; |
15 | Object.keys(theme.styleTypes).map(style => { | 9 | Object.keys(theme.styleTypes).map(style => |
16 | Object.assign(styles, { | 10 | Object.assign(styles, { |
17 | [style]: { | 11 | [style]: { |
18 | background: theme.styleTypes[style].accent, | 12 | background: theme.styleTypes[style].accent, |
19 | color: theme.styleTypes[style].contrast, | 13 | color: theme.styleTypes[style].contrast, |
20 | border: theme.styleTypes[style].border, | 14 | border: theme.styleTypes[style].border, |
21 | }, | 15 | }, |
22 | }); | 16 | }), |
23 | }); | 17 | ); |
24 | 18 | ||
25 | return styles; | 19 | return styles; |
26 | }; | 20 | }; |
@@ -44,6 +38,12 @@ const styles = (theme: Theme) => ({ | |||
44 | ...badgeStyles(theme), | 38 | ...badgeStyles(theme), |
45 | }); | 39 | }); |
46 | 40 | ||
41 | interface IProps extends WithStylesProps<typeof styles> { | ||
42 | type: string; | ||
43 | className?: string; | ||
44 | children: ReactNode; | ||
45 | } | ||
46 | |||
47 | class BadgeComponent extends Component<IProps> { | 47 | class BadgeComponent extends Component<IProps> { |
48 | public static defaultProps = { | 48 | public static defaultProps = { |
49 | type: 'primary', | 49 | type: 'primary', |
diff --git a/src/components/ui/button/index.tsx b/src/components/ui/button/index.tsx index 1b648b1d5..3c31ca952 100644 --- a/src/components/ui/button/index.tsx +++ b/src/components/ui/button/index.tsx | |||
@@ -1,3 +1,4 @@ | |||
1 | /* eslint-disable no-use-before-define */ | ||
1 | import Icon from '@mdi/react'; | 2 | import Icon from '@mdi/react'; |
2 | import classnames from 'classnames'; | 3 | import classnames from 'classnames'; |
3 | import { Property } from 'csstype'; | 4 | import { Property } from 'csstype'; |
@@ -135,7 +136,7 @@ interface IProps extends IFormField, WithStylesProps<typeof styles> { | |||
135 | label?: string; | 136 | label?: string; |
136 | disabled?: boolean; | 137 | disabled?: boolean; |
137 | id?: string; | 138 | id?: string; |
138 | type?: 'button' | 'reset' | 'submit' | undefined; | 139 | type?: 'button' | 'reset' | 'submit'; |
139 | onClick?: MouseEventHandler<HTMLInputElement>; | 140 | onClick?: MouseEventHandler<HTMLInputElement>; |
140 | buttonType?: ButtonType; | 141 | buttonType?: ButtonType; |
141 | loaded?: boolean; | 142 | loaded?: boolean; |
diff --git a/src/components/ui/colorPickerInput/index.tsx b/src/components/ui/colorPickerInput/index.tsx index 2367175bd..39fd0220a 100644 --- a/src/components/ui/colorPickerInput/index.tsx +++ b/src/components/ui/colorPickerInput/index.tsx | |||
@@ -1,21 +1,18 @@ | |||
1 | import { | 1 | import { |
2 | ChangeEvent, | ||
2 | Component, | 3 | Component, |
3 | createRef, | 4 | createRef, |
4 | InputHTMLAttributes, | 5 | InputHTMLAttributes, |
5 | ReactElement, | ||
6 | RefObject, | 6 | RefObject, |
7 | } from 'react'; | 7 | } from 'react'; |
8 | import { observer } from 'mobx-react'; | 8 | import { observer } from 'mobx-react'; |
9 | import classnames from 'classnames'; | 9 | import classnames from 'classnames'; |
10 | import { SliderPicker } from 'react-color'; | 10 | import { Color, ColorResult, SliderPicker } from 'react-color'; |
11 | import { noop } from 'lodash'; | 11 | import { noop } from 'lodash'; |
12 | import { FormFields } from '../../../@types/mobx-form.types'; | 12 | import { FormFields } from '../../../@types/mobx-form.types'; |
13 | 13 | ||
14 | interface IProps extends InputHTMLAttributes<HTMLInputElement>, FormFields { | 14 | interface IProps extends InputHTMLAttributes<HTMLInputElement>, FormFields { |
15 | className?: string; | 15 | onColorChange: (event: ChangeEvent<HTMLInputElement>) => void; |
16 | focus?: boolean; | ||
17 | onColorChange?: () => void; | ||
18 | error: string; | ||
19 | } | 16 | } |
20 | 17 | ||
21 | @observer | 18 | @observer |
@@ -23,20 +20,13 @@ class ColorPickerInput extends Component<IProps> { | |||
23 | private inputElement: RefObject<HTMLInputElement> = | 20 | private inputElement: RefObject<HTMLInputElement> = |
24 | createRef<HTMLInputElement>(); | 21 | createRef<HTMLInputElement>(); |
25 | 22 | ||
26 | componentDidMount(): void { | 23 | onChange(color: ColorResult, event: ChangeEvent<HTMLInputElement>): void { |
27 | const { focus = false } = this.props; | 24 | const { onColorChange, onChange = noop } = this.props; |
28 | if (focus && this.inputElement?.current) { | 25 | onColorChange(event); |
29 | this.inputElement.current.focus(); | 26 | onChange(color.hex); |
30 | } | ||
31 | } | 27 | } |
32 | 28 | ||
33 | onChange({ hex }: { hex: string }): void { | 29 | render() { |
34 | const { onColorChange = noop, onChange = noop } = this.props; | ||
35 | onColorChange(); | ||
36 | onChange(hex); | ||
37 | } | ||
38 | |||
39 | render(): ReactElement { | ||
40 | const { | 30 | const { |
41 | id, | 31 | id, |
42 | name, | 32 | name, |
@@ -45,7 +35,6 @@ class ColorPickerInput extends Component<IProps> { | |||
45 | disabled = false, | 35 | disabled = false, |
46 | className = null, | 36 | className = null, |
47 | type = 'text', | 37 | type = 'text', |
48 | error = '', | ||
49 | onChange = noop, | 38 | onChange = noop, |
50 | } = this.props; | 39 | } = this.props; |
51 | 40 | ||
@@ -53,20 +42,14 @@ class ColorPickerInput extends Component<IProps> { | |||
53 | <div | 42 | <div |
54 | className={classnames({ | 43 | className={classnames({ |
55 | 'franz-form__field': true, | 44 | 'franz-form__field': true, |
56 | 'has-error': error, | ||
57 | [`${className}`]: className, | 45 | [`${className}`]: className, |
58 | })} | 46 | })} |
59 | ref={this.inputElement} | 47 | ref={this.inputElement} |
60 | > | 48 | > |
61 | <SliderPicker | 49 | <SliderPicker |
62 | color={value} | 50 | color={value as Color} |
63 | onChange={this.onChange.bind(this)} | 51 | onChange={(color, event) => this.onChange(color, event)} |
64 | id={`${id}-SliderPicker`} | ||
65 | type={type} | ||
66 | className="franz-form__input" | 52 | className="franz-form__input" |
67 | name={name} | ||
68 | placeholder={placeholder} | ||
69 | disabled={disabled} | ||
70 | /> | 53 | /> |
71 | <div className="franz-form__input-wrapper franz-form__input-wrapper__color-picker"> | 54 | <div className="franz-form__input-wrapper franz-form__input-wrapper__color-picker"> |
72 | <input | 55 | <input |
diff --git a/src/components/ui/headline/index.tsx b/src/components/ui/headline/index.tsx index 424190a6a..8e40fa896 100644 --- a/src/components/ui/headline/index.tsx +++ b/src/components/ui/headline/index.tsx | |||
@@ -11,14 +11,6 @@ import injectStyle, { WithStylesProps } from 'react-jss'; | |||
11 | import { Theme } from '../../../themes'; | 11 | import { Theme } from '../../../themes'; |
12 | import { Omit } from '../typings/generic'; | 12 | import { Omit } from '../typings/generic'; |
13 | 13 | ||
14 | interface IProps extends WithStylesProps<typeof styles> { | ||
15 | children: ReactNode; | ||
16 | level?: number; | ||
17 | className?: string; | ||
18 | id?: string; | ||
19 | onClick?: MouseEventHandler<HTMLButtonElement>; | ||
20 | } | ||
21 | |||
22 | const styles = (theme: Theme) => ({ | 14 | const styles = (theme: Theme) => ({ |
23 | headline: { | 15 | headline: { |
24 | fontWeight: 'lighter', | 16 | fontWeight: 'lighter', |
@@ -45,6 +37,14 @@ const styles = (theme: Theme) => ({ | |||
45 | }, | 37 | }, |
46 | }); | 38 | }); |
47 | 39 | ||
40 | interface IProps extends WithStylesProps<typeof styles> { | ||
41 | children: ReactNode; | ||
42 | level?: number; | ||
43 | className?: string; | ||
44 | id?: string; | ||
45 | onClick?: MouseEventHandler<HTMLButtonElement>; | ||
46 | } | ||
47 | |||
48 | class HeadlineComponent extends Component<IProps> { | 48 | class HeadlineComponent extends Component<IProps> { |
49 | render(): ReactElement { | 49 | render(): ReactElement { |
50 | const { classes, level, className, children, id, onClick } = this.props; | 50 | const { classes, level, className, children, id, onClick } = this.props; |
diff --git a/src/components/ui/icon/index.tsx b/src/components/ui/icon/index.tsx index 5b432a194..04a00d0e0 100644 --- a/src/components/ui/icon/index.tsx +++ b/src/components/ui/icon/index.tsx | |||
@@ -5,18 +5,18 @@ import injectStyle, { WithStylesProps } from 'react-jss'; | |||
5 | 5 | ||
6 | import { Theme } from '../../../themes'; | 6 | import { Theme } from '../../../themes'; |
7 | 7 | ||
8 | interface IProps extends WithStylesProps<typeof styles> { | ||
9 | icon: string; | ||
10 | size?: number; | ||
11 | className?: string; | ||
12 | } | ||
13 | |||
14 | const styles = (theme: Theme) => ({ | 8 | const styles = (theme: Theme) => ({ |
15 | icon: { | 9 | icon: { |
16 | fill: theme.colorText, | 10 | fill: theme.colorText, |
17 | }, | 11 | }, |
18 | }); | 12 | }); |
19 | 13 | ||
14 | interface IProps extends WithStylesProps<typeof styles> { | ||
15 | icon: string; | ||
16 | size?: number; | ||
17 | className?: string; | ||
18 | } | ||
19 | |||
20 | class IconComponent extends Component<IProps> { | 20 | class IconComponent extends Component<IProps> { |
21 | render(): ReactElement { | 21 | render(): ReactElement { |
22 | const { classes, icon, size = 1, className } = this.props; | 22 | const { classes, icon, size = 1, className } = this.props; |
diff --git a/src/components/ui/infobox/index.tsx b/src/components/ui/infobox/index.tsx index 28ec2ff90..a1c4f9d21 100644 --- a/src/components/ui/infobox/index.tsx +++ b/src/components/ui/infobox/index.tsx | |||
@@ -1,3 +1,4 @@ | |||
1 | /* eslint-disable no-use-before-define */ | ||
1 | import { mdiClose } from '@mdi/js'; | 2 | import { mdiClose } from '@mdi/js'; |
2 | import classnames from 'classnames'; | 3 | import classnames from 'classnames'; |
3 | import { noop } from 'lodash'; | 4 | import { noop } from 'lodash'; |
diff --git a/src/components/ui/loader/index.tsx b/src/components/ui/loader/index.tsx index 361fc477b..957899bdc 100644 --- a/src/components/ui/loader/index.tsx +++ b/src/components/ui/loader/index.tsx | |||
@@ -2,13 +2,9 @@ import classnames from 'classnames'; | |||
2 | import { Component } from 'react'; | 2 | import { Component } from 'react'; |
3 | import injectStyle, { WithStylesProps } from 'react-jss'; | 3 | import injectStyle, { WithStylesProps } from 'react-jss'; |
4 | import ReactLoader from 'react-loader'; | 4 | import ReactLoader from 'react-loader'; |
5 | import { Theme } from '../../../themes'; | ||
5 | 6 | ||
6 | interface IProps extends WithStylesProps<typeof styles> { | 7 | const styles = (theme: Theme) => ({ |
7 | className?: string; | ||
8 | color?: string; | ||
9 | } | ||
10 | |||
11 | const styles = theme => ({ | ||
12 | container: { | 8 | container: { |
13 | position: 'relative', | 9 | position: 'relative', |
14 | height: 60, | 10 | height: 60, |
@@ -17,6 +13,11 @@ const styles = theme => ({ | |||
17 | color: theme.colorText, | 13 | color: theme.colorText, |
18 | }); | 14 | }); |
19 | 15 | ||
16 | interface IProps extends WithStylesProps<typeof styles> { | ||
17 | className?: string; | ||
18 | color?: string; | ||
19 | } | ||
20 | |||
20 | class LoaderComponent extends Component<IProps> { | 21 | class LoaderComponent extends Component<IProps> { |
21 | render() { | 22 | render() { |
22 | const { classes, className, color } = this.props; | 23 | const { classes, className, color } = this.props; |
diff --git a/src/components/ui/toggle/index.tsx b/src/components/ui/toggle/index.tsx index 48f68943b..275d28bf6 100644 --- a/src/components/ui/toggle/index.tsx +++ b/src/components/ui/toggle/index.tsx | |||
@@ -9,13 +9,6 @@ import Label from '../label'; | |||
9 | import { IFormField } from '../typings/generic'; | 9 | import { IFormField } from '../typings/generic'; |
10 | import Wrapper from '../wrapper'; | 10 | import Wrapper from '../wrapper'; |
11 | 11 | ||
12 | interface IProps | ||
13 | extends InputHTMLAttributes<HTMLInputElement>, | ||
14 | IFormField, | ||
15 | WithStylesProps<typeof styles> { | ||
16 | className?: string; | ||
17 | } | ||
18 | |||
19 | const buttonTransition: string = window?.matchMedia( | 12 | const buttonTransition: string = window?.matchMedia( |
20 | '(prefers-reduced-motion: no-preference)', | 13 | '(prefers-reduced-motion: no-preference)', |
21 | ) | 14 | ) |
@@ -62,6 +55,13 @@ const styles = (theme: Theme) => ({ | |||
62 | }, | 55 | }, |
63 | }); | 56 | }); |
64 | 57 | ||
58 | interface IProps | ||
59 | extends InputHTMLAttributes<HTMLInputElement>, | ||
60 | IFormField, | ||
61 | WithStylesProps<typeof styles> { | ||
62 | className?: string; | ||
63 | } | ||
64 | |||
65 | class Toggle extends Component<IProps> { | 65 | class Toggle extends Component<IProps> { |
66 | render(): ReactElement { | 66 | render(): ReactElement { |
67 | const { | 67 | const { |
diff --git a/src/components/ui/typings/generic.ts b/src/components/ui/typings/generic.ts index 3aec0bc40..bf45e4ce0 100644 --- a/src/components/ui/typings/generic.ts +++ b/src/components/ui/typings/generic.ts | |||
@@ -6,5 +6,5 @@ export interface IFormField { | |||
6 | noMargin?: boolean; | 6 | noMargin?: boolean; |
7 | } | 7 | } |
8 | 8 | ||
9 | export type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N; | ||
10 | export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | 9 | export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; |
10 | export type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N; | ||
diff --git a/src/components/ui/wrapper/index.tsx b/src/components/ui/wrapper/index.tsx index d733d050e..450d09fd1 100644 --- a/src/components/ui/wrapper/index.tsx +++ b/src/components/ui/wrapper/index.tsx | |||
@@ -2,10 +2,12 @@ import classnames from 'classnames'; | |||
2 | import { Component, ReactNode } from 'react'; | 2 | import { Component, ReactNode } from 'react'; |
3 | import injectStyle, { WithStylesProps } from 'react-jss'; | 3 | import injectStyle, { WithStylesProps } from 'react-jss'; |
4 | 4 | ||
5 | // eslint-disable-next-line no-use-before-define | ||
5 | interface IProps extends WithStylesProps<typeof styles> { | 6 | interface IProps extends WithStylesProps<typeof styles> { |
6 | children: ReactNode; | 7 | children: ReactNode; |
7 | className?: string; | 8 | className?: string; |
8 | identifier: string; | 9 | identifier: string; |
10 | // eslint-disable-next-line react/no-unused-prop-types | ||
9 | noMargin?: boolean; | 11 | noMargin?: boolean; |
10 | } | 12 | } |
11 | 13 | ||
diff --git a/src/components/util/ErrorBoundary/index.tsx b/src/components/util/ErrorBoundary/index.tsx index bef211ef9..66f860835 100644 --- a/src/components/util/ErrorBoundary/index.tsx +++ b/src/components/util/ErrorBoundary/index.tsx | |||
@@ -23,10 +23,18 @@ interface ErrorBoundaryProps extends WithStylesProps<typeof styles> { | |||
23 | children?: React.ReactNode; | 23 | children?: React.ReactNode; |
24 | } | 24 | } |
25 | 25 | ||
26 | class ErrorBoundary extends Component<ErrorBoundaryProps> { | 26 | interface ErrorBoundaryState { |
27 | state = { | 27 | hasError: boolean; |
28 | hasError: false, | 28 | } |
29 | }; | 29 | |
30 | class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> { | ||
31 | constructor(props) { | ||
32 | super(props); | ||
33 | |||
34 | this.state = { | ||
35 | hasError: false, | ||
36 | }; | ||
37 | } | ||
30 | 38 | ||
31 | componentDidCatch(): void { | 39 | componentDidCatch(): void { |
32 | this.setState({ hasError: true }); | 40 | this.setState({ hasError: true }); |
diff --git a/src/config.ts b/src/config.ts index 336085685..21a7462b9 100644 --- a/src/config.ts +++ b/src/config.ts | |||
@@ -92,9 +92,9 @@ export const NAVIGATION_BAR_BEHAVIOURS = { | |||
92 | never: 'Never show navigation bar', | 92 | never: 'Never show navigation bar', |
93 | }; | 93 | }; |
94 | 94 | ||
95 | export const SEARCH_ENGINE_STARTPAGE = 'startPage'; | 95 | const SEARCH_ENGINE_STARTPAGE = 'startPage'; |
96 | export const SEARCH_ENGINE_GOOGLE = 'google'; | 96 | const SEARCH_ENGINE_GOOGLE = 'google'; |
97 | export const SEARCH_ENGINE_DDG = 'duckDuckGo'; | 97 | const SEARCH_ENGINE_DDG = 'duckDuckGo'; |
98 | export const SEARCH_ENGINE_NAMES = { | 98 | export const SEARCH_ENGINE_NAMES = { |
99 | [SEARCH_ENGINE_STARTPAGE]: 'Startpage', | 99 | [SEARCH_ENGINE_STARTPAGE]: 'Startpage', |
100 | [SEARCH_ENGINE_GOOGLE]: 'Google', | 100 | [SEARCH_ENGINE_GOOGLE]: 'Google', |
diff --git a/src/containers/auth/AuthReleaseNotesScreen.tsx b/src/containers/auth/AuthReleaseNotesScreen.tsx index c717529fa..c9d2286e1 100644 --- a/src/containers/auth/AuthReleaseNotesScreen.tsx +++ b/src/containers/auth/AuthReleaseNotesScreen.tsx | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
3 | 3 | ||
4 | import { defineMessages, injectIntl } from 'react-intl'; | 4 | import { IntlShape, defineMessages, injectIntl } from 'react-intl'; |
5 | import Markdown from 'markdown-to-jsx'; | 5 | import Markdown from 'markdown-to-jsx'; |
6 | import { mdiArrowLeftCircle } from '@mdi/js'; | 6 | import { mdiArrowLeftCircle } from '@mdi/js'; |
7 | import { openExternalUrl } from '../../helpers/url-helpers'; | 7 | import { openExternalUrl } from '../../helpers/url-helpers'; |
@@ -20,14 +20,14 @@ const messages = defineMessages({ | |||
20 | }); | 20 | }); |
21 | 21 | ||
22 | interface IProps { | 22 | interface IProps { |
23 | intl: any; | 23 | intl: IntlShape; |
24 | } | 24 | } |
25 | 25 | ||
26 | class AuthReleaseNotesScreen extends Component<IProps> { | 26 | interface IState { |
27 | state = { | 27 | data: string; |
28 | data: '', | 28 | } |
29 | }; | ||
30 | 29 | ||
30 | class AuthReleaseNotesScreen extends Component<IProps, IState> { | ||
31 | constructor(props) { | 31 | constructor(props) { |
32 | super(props); | 32 | super(props); |
33 | 33 | ||
diff --git a/src/containers/settings/EditSettingsScreen.tsx b/src/containers/settings/EditSettingsScreen.tsx index 7cdff7fde..b9732ead0 100644 --- a/src/containers/settings/EditSettingsScreen.tsx +++ b/src/containers/settings/EditSettingsScreen.tsx | |||
@@ -319,12 +319,23 @@ const messages = defineMessages({ | |||
319 | 319 | ||
320 | interface EditSettingsScreenProps extends StoresProps, WrappedComponentProps {} | 320 | interface EditSettingsScreenProps extends StoresProps, WrappedComponentProps {} |
321 | 321 | ||
322 | interface EditSettingsScreenState { | ||
323 | lockedPassword: string; | ||
324 | } | ||
325 | |||
322 | @inject('stores', 'actions') | 326 | @inject('stores', 'actions') |
323 | @observer | 327 | @observer |
324 | class EditSettingsScreen extends Component<EditSettingsScreenProps> { | 328 | class EditSettingsScreen extends Component< |
325 | state = { | 329 | EditSettingsScreenProps, |
326 | lockedPassword: '', | 330 | EditSettingsScreenState |
327 | }; | 331 | > { |
332 | constructor(props) { | ||
333 | super(props); | ||
334 | |||
335 | this.state = { | ||
336 | lockedPassword: '', | ||
337 | }; | ||
338 | } | ||
328 | 339 | ||
329 | onSubmit(settingsData) { | 340 | onSubmit(settingsData) { |
330 | const { todos, workspaces } = this.props.stores; | 341 | const { todos, workspaces } = this.props.stores; |
diff --git a/src/containers/settings/EditUserScreen.tsx b/src/containers/settings/EditUserScreen.tsx index 10c308524..62df170fc 100644 --- a/src/containers/settings/EditUserScreen.tsx +++ b/src/containers/settings/EditUserScreen.tsx | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, ReactElement } from 'react'; | 1 | import { Component, ReactElement } from 'react'; |
2 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
3 | import { defineMessages, injectIntl } from 'react-intl'; | 3 | import { IntlShape, defineMessages, injectIntl } from 'react-intl'; |
4 | 4 | ||
5 | import { StoresProps } from '../../@types/ferdium-components.types'; | 5 | import { StoresProps } from '../../@types/ferdium-components.types'; |
6 | import { FormFields } from '../../@types/mobx-form.types'; | 6 | import { FormFields } from '../../@types/mobx-form.types'; |
@@ -50,7 +50,7 @@ const messages = defineMessages({ | |||
50 | }); | 50 | }); |
51 | 51 | ||
52 | interface EditUserScreenProps extends StoresProps { | 52 | interface EditUserScreenProps extends StoresProps { |
53 | intl: any; | 53 | intl: IntlShape; |
54 | } | 54 | } |
55 | 55 | ||
56 | class EditUserScreen extends Component<EditUserScreenProps> { | 56 | class EditUserScreen extends Component<EditUserScreenProps> { |
diff --git a/src/features/communityRecipes/store.ts b/src/features/communityRecipes/store.ts index d3b3318fa..1c21908e2 100644 --- a/src/features/communityRecipes/store.ts +++ b/src/features/communityRecipes/store.ts | |||
@@ -37,5 +37,3 @@ export class CommunityRecipesStore extends FeatureStore { | |||
37 | ); | 37 | ); |
38 | } | 38 | } |
39 | } | 39 | } |
40 | |||
41 | export default CommunityRecipesStore; | ||
diff --git a/src/features/todos/actions.ts b/src/features/todos/actions.ts index 31b14d40b..5273cc858 100644 --- a/src/features/todos/actions.ts +++ b/src/features/todos/actions.ts | |||
@@ -44,5 +44,3 @@ export const todoActions = createActionsFromDefinitions<TodoActionsType>( | |||
44 | }, | 44 | }, |
45 | PropTypes.checkPropTypes, | 45 | PropTypes.checkPropTypes, |
46 | ); | 46 | ); |
47 | |||
48 | export default todoActions; | ||
diff --git a/src/features/workspaces/actions.ts b/src/features/workspaces/actions.ts index 5f3fefec4..cfe4f9e8e 100644 --- a/src/features/workspaces/actions.ts +++ b/src/features/workspaces/actions.ts | |||
@@ -3,7 +3,8 @@ import Workspace from './models/Workspace'; | |||
3 | import { createActionsFromDefinitions } from '../../actions/lib/actions'; | 3 | import { createActionsFromDefinitions } from '../../actions/lib/actions'; |
4 | 4 | ||
5 | type WorkspaceArg = { workspace: Workspace }; | 5 | type WorkspaceArg = { workspace: Workspace }; |
6 | export interface WorkspaceActions { | 6 | |
7 | interface WorkspaceActions { | ||
7 | openWorkspaceSettings: () => void; | 8 | openWorkspaceSettings: () => void; |
8 | toggleWorkspaceDrawer: () => void; | 9 | toggleWorkspaceDrawer: () => void; |
9 | deactivate: () => void; | 10 | deactivate: () => void; |
diff --git a/src/i18n/languages.ts b/src/i18n/languages.ts index 6a4101bc0..209848b37 100644 --- a/src/i18n/languages.ts +++ b/src/i18n/languages.ts | |||
@@ -145,5 +145,3 @@ export const SPELLCHECKER_LOCALES = { | |||
145 | uk: 'Українська (Ukrainian)', | 145 | uk: 'Українська (Ukrainian)', |
146 | vi: 'Tiếng Việt', | 146 | vi: 'Tiếng Việt', |
147 | }; | 147 | }; |
148 | |||
149 | export default APP_LOCALES; | ||
diff --git a/src/index.ts b/src/index.ts index 0487d692c..1c616b499 100644 --- a/src/index.ts +++ b/src/index.ts | |||
@@ -156,16 +156,6 @@ if (gotTheLock) { | |||
156 | app.quit(); | 156 | app.quit(); |
157 | } | 157 | } |
158 | 158 | ||
159 | // Fix Unity indicator issue | ||
160 | // https://github.com/electron/electron/issues/9046 | ||
161 | if ( | ||
162 | isLinux && | ||
163 | process.env.XDG_CURRENT_DESKTOP && | ||
164 | ['Pantheon', 'Unity:Unity7'].includes(process.env.XDG_CURRENT_DESKTOP) | ||
165 | ) { | ||
166 | process.env.XDG_CURRENT_DESKTOP = 'Unity'; | ||
167 | } | ||
168 | |||
169 | // Disable GPU acceleration | 159 | // Disable GPU acceleration |
170 | if ( | 160 | if ( |
171 | !retrieveSettingValue( | 161 | !retrieveSettingValue( |
@@ -674,8 +664,11 @@ ipcMain.handle('get-desktop-capturer-sources', () => | |||
674 | ); | 664 | ); |
675 | 665 | ||
676 | ipcMain.on('window.toolbar-double-clicked', () => { | 666 | ipcMain.on('window.toolbar-double-clicked', () => { |
677 | // eslint-disable-next-line @typescript-eslint/no-unused-expressions | 667 | if (mainWindow?.isMaximized()) { |
678 | mainWindow?.isMaximized() ? mainWindow.unmaximize() : mainWindow?.maximize(); | 668 | mainWindow.unmaximize(); |
669 | } else { | ||
670 | mainWindow?.maximize(); | ||
671 | } | ||
679 | }); | 672 | }); |
680 | 673 | ||
681 | // Quit when all windows are closed. | 674 | // Quit when all windows are closed. |
diff --git a/src/internal-server/app/Controllers/Http/UserController.js b/src/internal-server/app/Controllers/Http/UserController.js index a9c67a1b2..43d925119 100644 --- a/src/internal-server/app/Controllers/Http/UserController.js +++ b/src/internal-server/app/Controllers/Http/UserController.js | |||
@@ -4,7 +4,6 @@ const Service = use('App/Models/Service'); | |||
4 | const Workspace = use('App/Models/Workspace'); | 4 | const Workspace = use('App/Models/Workspace'); |
5 | const { validateAll } = use('Validator'); | 5 | const { validateAll } = use('Validator'); |
6 | 6 | ||
7 | const btoa = require('btoa'); | ||
8 | const fetch = require('node-fetch'); | 7 | const fetch = require('node-fetch'); |
9 | const { v4: uuid } = require('uuid'); | 8 | const { v4: uuid } = require('uuid'); |
10 | const crypto = require('crypto'); | 9 | const crypto = require('crypto'); |
@@ -152,7 +151,9 @@ class UserController { | |||
152 | // Try to get an authentication token | 151 | // Try to get an authentication token |
153 | let token; | 152 | let token; |
154 | try { | 153 | try { |
155 | const basicToken = btoa(`${email}:${hashedPassword}`); | 154 | const basicToken = Buffer.from(`${email}:${hashedPassword}`).toString( |
155 | 'base64', | ||
156 | ); | ||
156 | 157 | ||
157 | const rawResponse = await fetch(`${server}/${API_VERSION}/auth/login`, { | 158 | const rawResponse = await fetch(`${server}/${API_VERSION}/auth/login`, { |
158 | method: 'POST', | 159 | method: 'POST', |
diff --git a/src/models/RecipePreview.ts b/src/models/RecipePreview.ts index 33b5e1432..8ace01a33 100644 --- a/src/models/RecipePreview.ts +++ b/src/models/RecipePreview.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | interface IRecipePreview { | 1 | export interface IRecipePreview { |
2 | id: string; | 2 | id: string; |
3 | name: string; | 3 | name: string; |
4 | icon: string; | 4 | icon: string; |
diff --git a/src/stores/ServicesStore.ts b/src/stores/ServicesStore.ts index 7f4693cad..82f3b95ce 100644 --- a/src/stores/ServicesStore.ts +++ b/src/stores/ServicesStore.ts | |||
@@ -594,7 +594,7 @@ export default class ServicesStore extends TypedStore { | |||
594 | this.stores.router.push(redirect); | 594 | this.stores.router.push(redirect); |
595 | } | 595 | } |
596 | 596 | ||
597 | this.allServicesRequest.patch(result => { | 597 | this.allServicesRequest.patch((result: Service[]) => { |
598 | remove(result, (c: Service) => c.id === serviceId); | 598 | remove(result, (c: Service) => c.id === serviceId); |
599 | }); | 599 | }); |
600 | 600 | ||
@@ -606,7 +606,7 @@ export default class ServicesStore extends TypedStore { | |||
606 | // Get directory for recipe | 606 | // Get directory for recipe |
607 | const normalDirectory = getRecipeDirectory(recipe); | 607 | const normalDirectory = getRecipeDirectory(recipe); |
608 | const devDirectory = getDevRecipeDirectory(recipe); | 608 | const devDirectory = getDevRecipeDirectory(recipe); |
609 | let directory; | 609 | let directory: string; |
610 | 610 | ||
611 | if (pathExistsSync(normalDirectory)) { | 611 | if (pathExistsSync(normalDirectory)) { |
612 | directory = normalDirectory; | 612 | directory = normalDirectory; |
@@ -1028,7 +1028,7 @@ export default class ServicesStore extends TypedStore { | |||
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | this.reorderServicesRequest.execute(services); | 1030 | this.reorderServicesRequest.execute(services); |
1031 | this.allServicesRequest.patch(data => { | 1031 | this.allServicesRequest.patch((data: Service[]) => { |
1032 | for (const s of data) { | 1032 | for (const s of data) { |
1033 | s.order = services[s.id]; | 1033 | s.order = services[s.id]; |
1034 | } | 1034 | } |
@@ -1172,7 +1172,7 @@ export default class ServicesStore extends TypedStore { | |||
1172 | ); | 1172 | ); |
1173 | 1173 | ||
1174 | // eslint-disable-next-line unicorn/consistent-function-scoping | 1174 | // eslint-disable-next-line unicorn/consistent-function-scoping |
1175 | const resetTimer = service => { | 1175 | const resetTimer = (service: Service) => { |
1176 | service.lastPollAnswer = Date.now(); | 1176 | service.lastPollAnswer = Date.now(); |
1177 | service.lastPoll = Date.now(); | 1177 | service.lastPoll = Date.now(); |
1178 | }; | 1178 | }; |
@@ -1306,7 +1306,7 @@ export default class ServicesStore extends TypedStore { | |||
1306 | }); | 1306 | }); |
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | _cleanUpTeamIdAndCustomUrl(recipeId, data): any { | 1309 | _cleanUpTeamIdAndCustomUrl(recipeId: string, data: Service): any { |
1310 | const serviceData = data; | 1310 | const serviceData = data; |
1311 | const recipe = this.stores.recipes.one(recipeId); | 1311 | const recipe = this.stores.recipes.one(recipeId); |
1312 | 1312 | ||
@@ -1318,6 +1318,7 @@ export default class ServicesStore extends TypedStore { | |||
1318 | data.team && | 1318 | data.team && |
1319 | data.customUrl | 1319 | data.customUrl |
1320 | ) { | 1320 | ) { |
1321 | // @ts-expect-error The operand of a 'delete' operator must be optional. | ||
1321 | delete serviceData.team; | 1322 | delete serviceData.team; |
1322 | } | 1323 | } |
1323 | 1324 | ||
@@ -1343,7 +1344,7 @@ export default class ServicesStore extends TypedStore { | |||
1343 | } | 1344 | } |
1344 | 1345 | ||
1345 | // Helper | 1346 | // Helper |
1346 | _initializeServiceRecipeInWebview(serviceId) { | 1347 | _initializeServiceRecipeInWebview(serviceId: string) { |
1347 | const service = this.one(serviceId); | 1348 | const service = this.one(serviceId); |
1348 | 1349 | ||
1349 | if (service.webview) { | 1350 | if (service.webview) { |
@@ -1362,7 +1363,7 @@ export default class ServicesStore extends TypedStore { | |||
1362 | } | 1363 | } |
1363 | } | 1364 | } |
1364 | 1365 | ||
1365 | _initRecipePolling(serviceId) { | 1366 | _initRecipePolling(serviceId: string) { |
1366 | const service = this.one(serviceId); | 1367 | const service = this.one(serviceId); |
1367 | 1368 | ||
1368 | const delay = ms('2s'); | 1369 | const delay = ms('2s'); |
@@ -1385,7 +1386,7 @@ export default class ServicesStore extends TypedStore { | |||
1385 | } | 1386 | } |
1386 | } | 1387 | } |
1387 | 1388 | ||
1388 | _wrapIndex(index, delta, size) { | 1389 | _wrapIndex(index: number, delta: number, size: number) { |
1389 | return (((index + delta) % size) + size) % size; | 1390 | return (((index + delta) % size) + size) % size; |
1390 | } | 1391 | } |
1391 | } | 1392 | } |
diff --git a/src/stores/lib/CachedRequest.ts b/src/stores/lib/CachedRequest.ts index 25cc365e2..b24336fe6 100644 --- a/src/stores/lib/CachedRequest.ts +++ b/src/stores/lib/CachedRequest.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { action } from 'mobx'; | 1 | import { action } from 'mobx'; |
2 | import { isEqual, remove } from 'lodash'; | 2 | import { isEqual } from 'lodash'; |
3 | import Request from './Request'; | 3 | import Request from './Request'; |
4 | 4 | ||
5 | export default class CachedRequest extends Request { | 5 | export default class CachedRequest extends Request { |
@@ -110,10 +110,6 @@ export default class CachedRequest extends Request { | |||
110 | }); | 110 | }); |
111 | } | 111 | } |
112 | 112 | ||
113 | removeCacheForCallWith(...args: any): void { | ||
114 | remove(this._apiCalls, c => isEqual(c.args, args)); | ||
115 | } | ||
116 | |||
117 | _addApiCall(args: any) { | 113 | _addApiCall(args: any) { |
118 | const newCall = { args, result: null }; | 114 | const newCall = { args, result: null }; |
119 | this._apiCalls.push(newCall); | 115 | this._apiCalls.push(newCall); |
diff --git a/src/stores/lib/Request.ts b/src/stores/lib/Request.ts index f9424ac99..911c5ccfb 100644 --- a/src/stores/lib/Request.ts +++ b/src/stores/lib/Request.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { observable, action, computed, makeObservable } from 'mobx'; | 1 | import { observable, action, computed, makeObservable } from 'mobx'; |
2 | import { isEqual } from 'lodash/fp'; | 2 | import { isEqual } from 'lodash/fp'; |
3 | 3 | ||
4 | // eslint-disable-next-line no-use-before-define | ||
4 | type Hook = (request: Request) => void; | 5 | type Hook = (request: Request) => void; |
5 | 6 | ||
6 | export default class Request { | 7 | export default class Request { |
diff --git a/src/themes/default/index.ts b/src/themes/default/index.ts index 2e18e1307..31c6cbd63 100644 --- a/src/themes/default/index.ts +++ b/src/themes/default/index.ts | |||
@@ -15,7 +15,7 @@ export default (brandPrimary: string) => { | |||
15 | const uiFontSize = 14; | 15 | const uiFontSize = 14; |
16 | const colorBackground = legacyStyles.themeGrayLighter; | 16 | const colorBackground = legacyStyles.themeGrayLighter; |
17 | const colorContentBackground = '#FFFFFF'; | 17 | const colorContentBackground = '#FFFFFF'; |
18 | const colorText = legacyStyles.themeTextColor; | 18 | const colorText = legacyStyles.themeGrayDark; |
19 | const inputColor = legacyStyles.themeGray; | 19 | const inputColor = legacyStyles.themeGray; |
20 | const inputBackground = legacyStyles.themeGrayLightest; | 20 | const inputBackground = legacyStyles.themeGrayLightest; |
21 | const inputHeight = 40; | 21 | const inputHeight = 40; |
diff --git a/src/themes/legacy/index.ts b/src/themes/legacy/index.ts index ca3216e7f..9caefc698 100644 --- a/src/themes/legacy/index.ts +++ b/src/themes/legacy/index.ts | |||
@@ -1,10 +1,7 @@ | |||
1 | /* legacy config, injected into sass */ | 1 | /* legacy config, injected into sass */ |
2 | export { DEFAULT_ACCENT_COLOR as themeBrandPrimary } from '../../config'; | 2 | export { DEFAULT_ACCENT_COLOR as themeBrandPrimary } from '../../config'; |
3 | 3 | ||
4 | export const themeBrandSuccess = '#5cb85c'; | ||
5 | export const themeBrandInfo = '#5bc0de'; | 4 | export const themeBrandInfo = '#5bc0de'; |
6 | export const themeBrandWarning = '#FF9F00'; | ||
7 | export const themeBrandDanger = '#d9534f'; | ||
8 | 5 | ||
9 | export const themeGrayDark = '#373a3c'; | 6 | export const themeGrayDark = '#373a3c'; |
10 | export const themeGray = '#55595c'; | 7 | export const themeGray = '#55595c'; |
@@ -15,14 +12,6 @@ export const themeGrayLightest = '#f7f7f9'; | |||
15 | export const themeBorderRadius = '6px'; | 12 | export const themeBorderRadius = '6px'; |
16 | export const themeBorderRadiusSmall = '3px'; | 13 | export const themeBorderRadiusSmall = '3px'; |
17 | 14 | ||
18 | export const themeSidebarWidth = '68px'; | ||
19 | |||
20 | export const themeTextColor = themeGrayDark; | ||
21 | |||
22 | export const themeTransitionTime = '.5s'; | ||
23 | |||
24 | export const themeInsetShadow = 'inset 0 2px 5px rgba(0, 0, 0, .03)'; | ||
25 | |||
26 | export const darkThemeBlack = '#1A1A1A'; | 15 | export const darkThemeBlack = '#1A1A1A'; |
27 | 16 | ||
28 | export const darkThemeGrayDarkest = '#1E1E1E'; | 17 | export const darkThemeGrayDarkest = '#1E1E1E'; |
diff --git a/src/webview/contextMenuBuilder.ts b/src/webview/contextMenuBuilder.ts index 0d8b659f0..93dfbebb6 100644 --- a/src/webview/contextMenuBuilder.ts +++ b/src/webview/contextMenuBuilder.ts | |||
@@ -675,7 +675,7 @@ export class ContextMenuBuilder { | |||
675 | const clickHandler = menuInfo.srcURL.startsWith('blob:') | 675 | const clickHandler = menuInfo.srcURL.startsWith('blob:') |
676 | ? () => { | 676 | ? () => { |
677 | const urlWithoutBlob = menuInfo.srcURL.slice(5); | 677 | const urlWithoutBlob = menuInfo.srcURL.slice(5); |
678 | this.convertImageToBase64(menuInfo.srcURL, (dataURL: any) => { | 678 | this.convertImageToBase64(menuInfo.srcURL, (dataURL: string) => { |
679 | const url = new window.URL(urlWithoutBlob); | 679 | const url = new window.URL(urlWithoutBlob); |
680 | const fileName = url.pathname.slice(1); | 680 | const fileName = url.pathname.slice(1); |
681 | ipcRenderer.send('download-file', { | 681 | ipcRenderer.send('download-file', { |
@@ -834,9 +834,8 @@ export class ContextMenuBuilder { | |||
834 | convertImageToBase64( | 834 | convertImageToBase64( |
835 | url: string, | 835 | url: string, |
836 | callback: { | 836 | callback: { |
837 | (dataURL: any): void; | 837 | (dataURL: string): void; |
838 | (dataURL: any): void; | 838 | (dataURL: string): void; |
839 | // eslint-disable-next-line @typescript-eslint/unified-signatures | ||
840 | (arg0: string): void; | 839 | (arg0: string): void; |
841 | }, | 840 | }, |
842 | outputFormat: string = 'image/png', | 841 | outputFormat: string = 'image/png', |