diff options
author | 2021-02-08 10:34:45 +0100 | |
---|---|---|
committer | 2021-02-08 10:34:45 +0100 | |
commit | 035002ceedf78d5ec73eabc0df7f06139939b967 (patch) | |
tree | 1c0d1e9531bae05fb65d70b9ea25baf404b74fe1 /src/features/todos/components | |
parent | docs: add k0staa as a contributor (#1193) (diff) | |
download | ferdium-app-035002ceedf78d5ec73eabc0df7f06139939b967.tar.gz ferdium-app-035002ceedf78d5ec73eabc0df7f06139939b967.tar.zst ferdium-app-035002ceedf78d5ec73eabc0df7f06139939b967.zip |
Synchronize with Franz 5.6.0 (#1033)
Co-authored-by: FranzBot <i18n@meetfranz.com>
Co-authored-by: vantezzen <hello@vantezzen.io>
Co-authored-by: Makazzz <makazzzpro@live.ca>
Co-authored-by: Stefan Malzner <stefan@adlk.io>
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
Diffstat (limited to 'src/features/todos/components')
-rw-r--r-- | src/features/todos/components/TodosWebview.js | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/features/todos/components/TodosWebview.js b/src/features/todos/components/TodosWebview.js index c612702b0..90575ebac 100644 --- a/src/features/todos/components/TodosWebview.js +++ b/src/features/todos/components/TodosWebview.js | |||
@@ -5,12 +5,14 @@ import injectSheet from 'react-jss'; | |||
5 | import Webview from 'react-electron-web-view'; | 5 | import Webview from 'react-electron-web-view'; |
6 | import { Icon } from '@meetfranz/ui'; | 6 | import { Icon } from '@meetfranz/ui'; |
7 | import { defineMessages, intlShape } from 'react-intl'; | 7 | import { defineMessages, intlShape } from 'react-intl'; |
8 | import classnames from 'classnames'; | ||
8 | 9 | ||
9 | import { mdiCheckAll } from '@mdi/js'; | 10 | import { mdiCheckAll } from '@mdi/js'; |
10 | import SettingsStore from '../../../stores/SettingsStore'; | 11 | import SettingsStore from '../../../stores/SettingsStore'; |
11 | 12 | ||
12 | import Appear from '../../../components/ui/effects/Appear'; | 13 | import Appear from '../../../components/ui/effects/Appear'; |
13 | import UpgradeButton from '../../../components/ui/UpgradeButton'; | 14 | import UpgradeButton from '../../../components/ui/UpgradeButton'; |
15 | import { TODOS_PARTITION_ID } from '..'; | ||
14 | 16 | ||
15 | import userAgent from '../../../helpers/userAgent-helpers'; | 17 | import userAgent from '../../../helpers/userAgent-helpers'; |
16 | 18 | ||
@@ -49,7 +51,7 @@ const styles = theme => ({ | |||
49 | borderLeft: [1, 'solid', theme.todos.todosLayer.borderLeftColor], | 51 | borderLeft: [1, 'solid', theme.todos.todosLayer.borderLeftColor], |
50 | zIndex: 300, | 52 | zIndex: 300, |
51 | 53 | ||
52 | transform: ({ isVisible, width }) => `translateX(${isVisible ? 0 : width}px)`, | 54 | transform: ({ isVisible, width, isTodosServiceActive }) => `translateX(${isVisible || isTodosServiceActive ? 0 : width}px)`, |
53 | 55 | ||
54 | '& webview': { | 56 | '& webview': { |
55 | height: '100%', | 57 | height: '100%', |
@@ -91,12 +93,19 @@ const styles = theme => ({ | |||
91 | premiumCTA: { | 93 | premiumCTA: { |
92 | marginTop: 40, | 94 | marginTop: 40, |
93 | }, | 95 | }, |
96 | isTodosServiceActive: { | ||
97 | width: 'calc(100% - 368px)', | ||
98 | position: 'absolute', | ||
99 | right: 0, | ||
100 | zIndex: 0, | ||
101 | }, | ||
94 | }); | 102 | }); |
95 | 103 | ||
96 | @injectSheet(styles) @inject('stores') @observer | 104 | @injectSheet(styles) @inject('stores') @observer |
97 | class TodosWebview extends Component { | 105 | class TodosWebview extends Component { |
98 | static propTypes = { | 106 | static propTypes = { |
99 | classes: PropTypes.object.isRequired, | 107 | classes: PropTypes.object.isRequired, |
108 | isTodosServiceActive: PropTypes.bool.isRequired, | ||
100 | isVisible: PropTypes.bool.isRequired, | 109 | isVisible: PropTypes.bool.isRequired, |
101 | handleClientMessage: PropTypes.func.isRequired, | 110 | handleClientMessage: PropTypes.func.isRequired, |
102 | setTodosWebview: PropTypes.func.isRequired, | 111 | setTodosWebview: PropTypes.func.isRequired, |
@@ -194,12 +203,16 @@ class TodosWebview extends Component { | |||
194 | startListeningToIpcMessages() { | 203 | startListeningToIpcMessages() { |
195 | const { handleClientMessage } = this.props; | 204 | const { handleClientMessage } = this.props; |
196 | if (!this.webview) return; | 205 | if (!this.webview) return; |
197 | this.webview.addEventListener('ipc-message', e => handleClientMessage(e.args[0])); | 206 | this.webview.addEventListener('ipc-message', (e) => { |
207 | // console.log(e); | ||
208 | handleClientMessage({ channel: e.channel, message: e.args[0] }); | ||
209 | }); | ||
198 | } | 210 | } |
199 | 211 | ||
200 | render() { | 212 | render() { |
201 | const { | 213 | const { |
202 | classes, | 214 | classes, |
215 | isTodosServiceActive, | ||
203 | isVisible, | 216 | isVisible, |
204 | isTodosIncludedInCurrentPlan, | 217 | isTodosIncludedInCurrentPlan, |
205 | stores, | 218 | stores, |
@@ -222,13 +235,21 @@ class TodosWebview extends Component { | |||
222 | isTodoUrlValid = validURL(todoUrl); | 235 | isTodoUrlValid = validURL(todoUrl); |
223 | } | 236 | } |
224 | 237 | ||
238 | let displayedWidth = isVisible ? width : 0; | ||
239 | if (isTodosServiceActive) { | ||
240 | displayedWidth = null; | ||
241 | } | ||
225 | 242 | ||
226 | return ( | 243 | return ( |
227 | <div | 244 | <div |
228 | className={classes.root} | 245 | className={classnames({ |
229 | style={{ width: isVisible ? width : 0 }} | 246 | [classes.root]: true, |
247 | [classes.isTodosServiceActive]: isTodosServiceActive, | ||
248 | })} | ||
249 | style={{ width: displayedWidth }} | ||
230 | onMouseUp={() => this.stopResize()} | 250 | onMouseUp={() => this.stopResize()} |
231 | ref={(node) => { this.node = node; }} | 251 | ref={(node) => { this.node = node; }} |
252 | id="todos-panel" | ||
232 | > | 253 | > |
233 | <div | 254 | <div |
234 | className={classes.resizeHandler} | 255 | className={classes.resizeHandler} |
@@ -251,7 +272,7 @@ class TodosWebview extends Component { | |||
251 | setTodosWebview(this.webview); | 272 | setTodosWebview(this.webview); |
252 | this.startListeningToIpcMessages(); | 273 | this.startListeningToIpcMessages(); |
253 | }} | 274 | }} |
254 | partition="persist:todos" | 275 | partition={TODOS_PARTITION_ID} |
255 | preload="./features/todos/preload.js" | 276 | preload="./features/todos/preload.js" |
256 | ref={(webview) => { this.webview = webview ? webview.view : null; }} | 277 | ref={(webview) => { this.webview = webview ? webview.view : null; }} |
257 | src={todoUrl} | 278 | src={todoUrl} |