aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/todos
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-02 09:24:32 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-02 09:24:32 +0200
commitbfe8847d72cd0893230f2e654242658214943e61 (patch)
tree3384b02ebad7a74cbb106ddd95546e0e24ff0bb8 /src/features/todos
parentfix: Fix navigation shortcut accelerator for non-macos (fixes #1172) (#2012) (diff)
downloadferdium-app-bfe8847d72cd0893230f2e654242658214943e61.tar.gz
ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.tar.zst
ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.zip
chore: convert various files from JS to TS (#2010)
Diffstat (limited to 'src/features/todos')
-rw-r--r--src/features/todos/actions.js28
-rw-r--r--src/features/todos/actions.ts31
-rw-r--r--src/features/todos/constants.ts (renamed from src/features/todos/constants.js)0
-rw-r--r--src/features/todos/index.ts (renamed from src/features/todos/index.js)11
4 files changed, 37 insertions, 33 deletions
diff --git a/src/features/todos/actions.js b/src/features/todos/actions.js
deleted file mode 100644
index cc17e919b..000000000
--- a/src/features/todos/actions.js
+++ /dev/null
@@ -1,28 +0,0 @@
1import PropTypes from 'prop-types';
2import { createActionsFromDefinitions } from '../../actions/lib/actions';
3
4export const todoActions = createActionsFromDefinitions({
5 resize: {
6 width: PropTypes.number.isRequired,
7 },
8 toggleTodosPanel: {},
9 toggleTodosFeatureVisibility: {},
10 setTodosWebview: {
11 webview: PropTypes.instanceOf(Element).isRequired,
12 },
13 handleHostMessage: {
14 action: PropTypes.string.isRequired,
15 data: PropTypes.object,
16 },
17 handleClientMessage: {
18 channel: PropTypes.string.isRequired,
19 message: PropTypes.shape({
20 action: PropTypes.string.isRequired,
21 data: PropTypes.object,
22 }),
23 },
24 openDevTools: {},
25 reload: {},
26}, PropTypes.checkPropTypes);
27
28export default todoActions;
diff --git a/src/features/todos/actions.ts b/src/features/todos/actions.ts
new file mode 100644
index 000000000..04e299e71
--- /dev/null
+++ b/src/features/todos/actions.ts
@@ -0,0 +1,31 @@
1import PropTypes from 'prop-types';
2import { createActionsFromDefinitions } from '../../actions/lib/actions';
3
4export const todoActions = createActionsFromDefinitions(
5 {
6 resize: {
7 width: PropTypes.number.isRequired,
8 },
9 toggleTodosPanel: {},
10 toggleTodosFeatureVisibility: {},
11 setTodosWebview: {
12 webview: PropTypes.instanceOf(Element).isRequired,
13 },
14 handleHostMessage: {
15 action: PropTypes.string.isRequired,
16 data: PropTypes.object,
17 },
18 handleClientMessage: {
19 channel: PropTypes.string.isRequired,
20 message: PropTypes.shape({
21 action: PropTypes.string.isRequired,
22 data: PropTypes.object,
23 }),
24 },
25 openDevTools: {},
26 reload: {},
27 },
28 PropTypes.checkPropTypes,
29);
30
31export default todoActions;
diff --git a/src/features/todos/constants.js b/src/features/todos/constants.ts
index 303a7a16e..303a7a16e 100644
--- a/src/features/todos/constants.js
+++ b/src/features/todos/constants.ts
diff --git a/src/features/todos/index.js b/src/features/todos/index.ts
index 573190881..3665812e6 100644
--- a/src/features/todos/index.js
+++ b/src/features/todos/index.ts
@@ -5,16 +5,17 @@ const debug = require('debug')('Ferdi:feature:todos');
5 5
6export const todosStore = new TodoStore(); 6export const todosStore = new TodoStore();
7 7
8export default function initTodos(stores, actions) { 8export default function initTodos(
9 stores: { todos?: any; features?: any },
10 actions: any,
11) {
9 stores.todos = todosStore; 12 stores.todos = todosStore;
10 const { features } = stores; 13 const { features } = stores;
11 14
12 // Toggle todos feature 15 // Toggle todos feature
13 reaction( 16 reaction(
14 () => ( 17 () => features.features.isTodosEnabled,
15 features.features.isTodosEnabled 18 isEnabled => {
16 ),
17 (isEnabled) => {
18 if (isEnabled) { 19 if (isEnabled) {
19 debug('Initializing `todos` feature'); 20 debug('Initializing `todos` feature');
20 todosStore.start(stores, actions); 21 todosStore.start(stores, actions);