aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/todos
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-15 09:48:06 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-15 09:48:06 +0200
commit14d2364fc69e0222133115c55a36286986006098 (patch)
tree9e9b3c41ef742bbe87ca1632b292c67043051957 /src/features/todos
parent5.6.3-nightly.34 [skip ci] (diff)
downloadferdium-app-14d2364fc69e0222133115c55a36286986006098.tar.gz
ferdium-app-14d2364fc69e0222133115c55a36286986006098.tar.zst
ferdium-app-14d2364fc69e0222133115c55a36286986006098.zip
chore: update eslint setup (#2074)
Diffstat (limited to 'src/features/todos')
-rw-r--r--src/features/todos/components/TodosWebview.js15
-rw-r--r--src/features/todos/containers/TodosScreen.js17
2 files changed, 20 insertions, 12 deletions
diff --git a/src/features/todos/components/TodosWebview.js b/src/features/todos/components/TodosWebview.js
index b31c7d858..1d423544b 100644
--- a/src/features/todos/components/TodosWebview.js
+++ b/src/features/todos/components/TodosWebview.js
@@ -7,14 +7,15 @@ import classnames from 'classnames';
7 7
8import { TODOS_PARTITION_ID } from '../../../config'; 8import { TODOS_PARTITION_ID } from '../../../config';
9 9
10const styles = (theme) => ({ 10const styles = theme => ({
11 root: { 11 root: {
12 background: theme.colorBackground, 12 background: theme.colorBackground,
13 position: 'relative', 13 position: 'relative',
14 borderLeft: [1, 'solid', theme.todos.todosLayer.borderLeftColor], 14 borderLeft: [1, 'solid', theme.todos.todosLayer.borderLeftColor],
15 zIndex: 300, 15 zIndex: 300,
16 16
17 transform: ({ isVisible, width, isTodosServiceActive }) => `translateX(${isVisible || isTodosServiceActive ? 0 : width}px)`, 17 transform: ({ isVisible, width, isTodosServiceActive }) =>
18 `translateX(${isVisible || isTodosServiceActive ? 0 : width}px)`,
18 19
19 '& webview': { 20 '& webview': {
20 height: '100%', 21 height: '100%',
@@ -79,7 +80,7 @@ class TodosWebview extends Component {
79 this.node.addEventListener('mouseleave', this.stopResize.bind(this)); 80 this.node.addEventListener('mouseleave', this.stopResize.bind(this));
80 } 81 }
81 82
82 startResize = (event) => { 83 startResize = event => {
83 this.setState({ 84 this.setState({
84 isDragging: true, 85 isDragging: true,
85 initialPos: event.clientX, 86 initialPos: event.clientX,
@@ -126,7 +127,7 @@ class TodosWebview extends Component {
126 startListeningToIpcMessages() { 127 startListeningToIpcMessages() {
127 const { handleClientMessage } = this.props; 128 const { handleClientMessage } = this.props;
128 if (!this.webview) return; 129 if (!this.webview) return;
129 this.webview.addEventListener('ipc-message', (e) => { 130 this.webview.addEventListener('ipc-message', e => {
130 // console.log(e); 131 // console.log(e);
131 handleClientMessage({ channel: e.channel, message: e.args[0] }); 132 handleClientMessage({ channel: e.channel, message: e.args[0] });
132 }); 133 });
@@ -159,7 +160,7 @@ class TodosWebview extends Component {
159 })} 160 })}
160 style={{ width: displayedWidth }} 161 style={{ width: displayedWidth }}
161 onMouseUp={() => this.stopResize()} 162 onMouseUp={() => this.stopResize()}
162 ref={(node) => { 163 ref={node => {
163 this.node = node; 164 this.node = node;
164 }} 165 }}
165 id="todos-panel" 166 id="todos-panel"
@@ -170,7 +171,7 @@ class TodosWebview extends Component {
170 left: delta, 171 left: delta,
171 ...(isDragging ? { width: 600, marginLeft: -200 } : {}), 172 ...(isDragging ? { width: 600, marginLeft: -200 } : {}),
172 }} // This hack is required as resizing with webviews beneath behaves quite bad 173 }} // This hack is required as resizing with webviews beneath behaves quite bad
173 onMouseDown={(e) => this.startResize(e)} 174 onMouseDown={e => this.startResize(e)}
174 /> 175 />
175 {isDragging && ( 176 {isDragging && (
176 <div 177 <div
@@ -188,7 +189,7 @@ class TodosWebview extends Component {
188 }} 189 }}
189 partition={TODOS_PARTITION_ID} 190 partition={TODOS_PARTITION_ID}
190 preload="./features/todos/preload.js" 191 preload="./features/todos/preload.js"
191 ref={(webview) => { 192 ref={webview => {
192 this.webview = webview ? webview.view : null; 193 this.webview = webview ? webview.view : null;
193 }} 194 }}
194 useragent={userAgent} 195 useragent={userAgent}
diff --git a/src/features/todos/containers/TodosScreen.js b/src/features/todos/containers/TodosScreen.js
index c2b6a5af4..536810d2d 100644
--- a/src/features/todos/containers/TodosScreen.js
+++ b/src/features/todos/containers/TodosScreen.js
@@ -10,24 +10,31 @@ import { TODOS_MIN_WIDTH } from '../../../config';
10import { todoActions } from '../actions'; 10import { todoActions } from '../actions';
11import ServicesStore from '../../../stores/ServicesStore'; 11import ServicesStore from '../../../stores/ServicesStore';
12 12
13@inject('stores', 'actions') @observer 13@inject('stores', 'actions')
14@observer
14class TodosScreen extends Component { 15class TodosScreen extends Component {
15 render() { 16 render() {
16 if (!todosStore || !todosStore.isFeatureActive || todosStore.isTodosPanelForceHidden) { 17 if (
18 !todosStore ||
19 !todosStore.isFeatureActive ||
20 todosStore.isTodosPanelForceHidden
21 ) {
17 return null; 22 return null;
18 } 23 }
19 24
20 return ( 25 return (
21 <ErrorBoundary> 26 <ErrorBoundary>
22 <TodosWebview 27 <TodosWebview
23 isTodosServiceActive={this.props.stores.services.isTodosServiceActive || false} 28 isTodosServiceActive={
29 this.props.stores.services.isTodosServiceActive || false
30 }
24 isVisible={todosStore.isTodosPanelVisible} 31 isVisible={todosStore.isTodosPanelVisible}
25 togglePanel={todoActions.toggleTodosPanel} 32 togglePanel={todoActions.toggleTodosPanel}
26 handleClientMessage={todoActions.handleClientMessage} 33 handleClientMessage={todoActions.handleClientMessage}
27 setTodosWebview={(webview) => todoActions.setTodosWebview({ webview })} 34 setTodosWebview={webview => todoActions.setTodosWebview({ webview })}
28 width={todosStore.width} 35 width={todosStore.width}
29 minWidth={TODOS_MIN_WIDTH} 36 minWidth={TODOS_MIN_WIDTH}
30 resize={(width) => todoActions.resize({ width })} 37 resize={width => todoActions.resize({ width })}
31 userAgent={todosStore.userAgent} 38 userAgent={todosStore.userAgent}
32 todoUrl={todosStore.todoUrl} 39 todoUrl={todosStore.todoUrl}
33 isTodoUrlValid={todosStore.isTodoUrlValid} 40 isTodoUrlValid={todosStore.isTodoUrlValid}