From 3843c2488df81840960d8db3cfdec33597e17159 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 4 Sep 2019 15:44:36 +0200 Subject: Resend todos config on Franz setting changes --- src/features/todos/components/TodosWebview.js | 74 ++++++++++++--------------- src/features/todos/store.js | 13 ++++- 2 files changed, 45 insertions(+), 42 deletions(-) (limited to 'src/features/todos') diff --git a/src/features/todos/components/TodosWebview.js b/src/features/todos/components/TodosWebview.js index 288c1906f..9dd313109 100644 --- a/src/features/todos/components/TodosWebview.js +++ b/src/features/todos/components/TodosWebview.js @@ -22,10 +22,6 @@ const styles = theme => ({ '&:hover $closeTodosButton': { opacity: 1, }, - }, - webview: { - height: '100%', - '& webview': { height: '100%', }, @@ -191,45 +187,43 @@ class TodosWebview extends Component { const { width, delta, isDragging } = this.state; return ( - <> -
this.stopResize()} - ref={(node) => { this.node = node; }} +
this.stopResize()} + ref={(node) => { this.node = node; }} + > + + + +
this.startResize(e)} + /> + {isDragging && (
this.startResize(e)} - /> - {isDragging && ( -
- )} - { - const { setTodosWebview } = this.props; - setTodosWebview(this.webview); - this.startListeningToIpcMessages(); - }} - partition="persist:todos" - preload="./features/todos/preload.js" - ref={(webview) => { this.webview = webview ? webview.view : null; }} - src={environment.TODOS_FRONTEND} + className={classes.dragIndicator} + style={{ left: delta }} // This hack is required as resizing with webviews beneath behaves quite bad /> -
- + )} + { + const { setTodosWebview } = this.props; + setTodosWebview(this.webview); + this.startListeningToIpcMessages(); + }} + partition="persist:todos" + preload="./features/todos/preload.js" + ref={(webview) => { this.webview = webview ? webview.view : null; }} + src={environment.TODOS_FRONTEND} + /> +
); } } diff --git a/src/features/todos/store.js b/src/features/todos/store.js index acf95df0d..bb1df9415 100644 --- a/src/features/todos/store.js +++ b/src/features/todos/store.js @@ -59,6 +59,7 @@ export default class TodoStore extends FeatureStore { this._allReactions = createReactions([ this._setFeatureEnabledReaction, + this._updateTodosConfig, ]); this._registerReactions(this._allReactions); @@ -121,11 +122,14 @@ export default class TodoStore extends FeatureStore { // Todos client message handlers _onTodosClientInitialized = () => { + const { authToken } = this.stores.user; + const { isDarkThemeActive } = this.stores.ui; + if (!this.webview) return; this.webview.send(IPC.TODOS_HOST_CHANNEL, { action: 'todos:configure', data: { - authToken: this.stores.user.authToken, - theme: this.stores.ui.isDarkThemeActive ? ThemeType.dark : ThemeType.default, + authToken, + theme: isDarkThemeActive ? ThemeType.dark : ThemeType.default, }, }); }; @@ -144,4 +148,9 @@ export default class TodoStore extends FeatureStore { this.isFeatureEnabled = isTodosEnabled; }; + + _updateTodosConfig = () => { + // Resend the config if any part changes in Franz: + this._onTodosClientInitialized(); + } } -- cgit v1.2.3-54-g00ecf