diff options
author | 2019-08-05 20:44:20 +0700 | |
---|---|---|
committer | 2019-08-05 20:44:20 +0700 | |
commit | db4d9cbd72e20b6f196b0eb73272f532e9cc94e5 (patch) | |
tree | 4dc552d2d00f9db288933978f777296a53df02a2 /src | |
parent | Trigger new build (diff) | |
parent | Update README.md (diff) | |
download | ferdium-app-db4d9cbd72e20b6f196b0eb73272f532e9cc94e5.tar.gz ferdium-app-db4d9cbd72e20b6f196b0eb73272f532e9cc94e5.tar.zst ferdium-app-db4d9cbd72e20b6f196b0eb73272f532e9cc94e5.zip |
Merge branch 'master' of github.com:kytwb/ferdi
Diffstat (limited to 'src')
-rw-r--r-- | src/components/layout/AppLayout.js | 95 |
1 files changed, 42 insertions, 53 deletions
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index 5edf96523..2d7ac42f2 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js | |||
@@ -1,21 +1,21 @@ | |||
1 | import React, { Component } from "react"; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from "prop-types"; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer, PropTypes as MobxPropTypes } from "mobx-react"; | 3 | import { observer, PropTypes as MobxPropTypes } from 'mobx-react'; |
4 | import { defineMessages, intlShape } from "react-intl"; | 4 | import { defineMessages, intlShape } from 'react-intl'; |
5 | import { TitleBar } from "electron-react-titlebar"; | 5 | import { TitleBar } from 'electron-react-titlebar'; |
6 | import injectSheet from "react-jss"; | 6 | import injectSheet from 'react-jss'; |
7 | 7 | ||
8 | import InfoBar from "../ui/InfoBar"; | 8 | import InfoBar from '../ui/InfoBar'; |
9 | import { Component as BasicAuth } from "../../features/basicAuth"; | 9 | import { Component as BasicAuth } from '../../features/basicAuth'; |
10 | import { Component as ShareFranz } from "../../features/shareFranz"; | 10 | import { Component as ShareFranz } from '../../features/shareFranz'; |
11 | import ErrorBoundary from "../util/ErrorBoundary"; | 11 | import ErrorBoundary from '../util/ErrorBoundary'; |
12 | 12 | ||
13 | // import globalMessages from '../../i18n/globalMessages'; | 13 | // import globalMessages from '../../i18n/globalMessages'; |
14 | 14 | ||
15 | import { isWindows } from "../../environment"; | 15 | import { isWindows } from '../../environment'; |
16 | import WorkspaceSwitchingIndicator from "../../features/workspaces/components/WorkspaceSwitchingIndicator"; | 16 | import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; |
17 | import { workspaceStore } from "../../features/workspaces"; | 17 | import { workspaceStore } from '../../features/workspaces'; |
18 | import AppUpdateInfoBar from "../AppUpdateInfoBar"; | 18 | import AppUpdateInfoBar from '../AppUpdateInfoBar'; |
19 | 19 | ||
20 | function createMarkup(HTMLString) { | 20 | function createMarkup(HTMLString) { |
21 | return { __html: HTMLString }; | 21 | return { __html: HTMLString }; |
@@ -23,33 +23,30 @@ function createMarkup(HTMLString) { | |||
23 | 23 | ||
24 | const messages = defineMessages({ | 24 | const messages = defineMessages({ |
25 | servicesUpdated: { | 25 | servicesUpdated: { |
26 | id: "infobar.servicesUpdated", | 26 | id: 'infobar.servicesUpdated', |
27 | defaultMessage: "!!!Your services have been updated." | 27 | defaultMessage: '!!!Your services have been updated.', |
28 | }, | 28 | }, |
29 | buttonReloadServices: { | 29 | buttonReloadServices: { |
30 | id: "infobar.buttonReloadServices", | 30 | id: 'infobar.buttonReloadServices', |
31 | defaultMessage: "!!!Reload services" | 31 | defaultMessage: '!!!Reload services', |
32 | }, | 32 | }, |
33 | requiredRequestsFailed: { | 33 | requiredRequestsFailed: { |
34 | id: "infobar.requiredRequestsFailed", | 34 | id: 'infobar.requiredRequestsFailed', |
35 | defaultMessage: "!!!Could not load services and user information" | 35 | defaultMessage: '!!!Could not load services and user information', |
36 | } | 36 | }, |
37 | }); | 37 | }); |
38 | 38 | ||
39 | const styles = theme => ({ | 39 | const styles = theme => ({ |
40 | appContent: { | 40 | appContent: { |
41 | width: `calc(100% + ${theme.workspaces.drawer.width}px)`, | 41 | width: `calc(100% + ${theme.workspaces.drawer.width}px)`, |
42 | transition: "transform 0.5s ease", | 42 | transition: 'transform 0.5s ease', |
43 | transform() { | 43 | transform() { |
44 | return workspaceStore.isWorkspaceDrawerOpen | 44 | return workspaceStore.isWorkspaceDrawerOpen ? 'translateX(0)' : `translateX(-${theme.workspaces.drawer.width}px)`; |
45 | ? "translateX(0)" | 45 | }, |
46 | : `translateX(-${theme.workspaces.drawer.width}px)`; | 46 | }, |
47 | } | ||
48 | } | ||
49 | }); | 47 | }); |
50 | 48 | ||
51 | @injectSheet(styles) | 49 | @injectSheet(styles) @observer |
52 | @observer | ||
53 | class AppLayout extends Component { | 50 | class AppLayout extends Component { |
54 | static propTypes = { | 51 | static propTypes = { |
55 | classes: PropTypes.object.isRequired, | 52 | classes: PropTypes.object.isRequired, |
@@ -69,16 +66,16 @@ class AppLayout extends Component { | |||
69 | showRequiredRequestsError: PropTypes.bool.isRequired, | 66 | showRequiredRequestsError: PropTypes.bool.isRequired, |
70 | areRequiredRequestsSuccessful: PropTypes.bool.isRequired, | 67 | areRequiredRequestsSuccessful: PropTypes.bool.isRequired, |
71 | retryRequiredRequests: PropTypes.func.isRequired, | 68 | retryRequiredRequests: PropTypes.func.isRequired, |
72 | areRequiredRequestsLoading: PropTypes.bool.isRequired | 69 | areRequiredRequestsLoading: PropTypes.bool.isRequired, |
73 | }; | 70 | }; |
74 | 71 | ||
75 | static defaultProps = { | 72 | static defaultProps = { |
76 | children: [], | 73 | children: [], |
77 | nextAppReleaseVersion: null | 74 | nextAppReleaseVersion: null, |
78 | }; | 75 | }; |
79 | 76 | ||
80 | static contextTypes = { | 77 | static contextTypes = { |
81 | intl: intlShape | 78 | intl: intlShape, |
82 | }; | 79 | }; |
83 | 80 | ||
84 | render() { | 81 | render() { |
@@ -100,7 +97,7 @@ class AppLayout extends Component { | |||
100 | showRequiredRequestsError, | 97 | showRequiredRequestsError, |
101 | areRequiredRequestsSuccessful, | 98 | areRequiredRequestsSuccessful, |
102 | retryRequiredRequests, | 99 | retryRequiredRequests, |
103 | areRequiredRequestsLoading | 100 | areRequiredRequestsLoading, |
104 | } = this.props; | 101 | } = this.props; |
105 | 102 | ||
106 | const { intl } = this.context; | 103 | const { intl } = this.context; |
@@ -108,31 +105,23 @@ class AppLayout extends Component { | |||
108 | return ( | 105 | return ( |
109 | <ErrorBoundary> | 106 | <ErrorBoundary> |
110 | <div className="app"> | 107 | <div className="app"> |
111 | {isWindows && !isFullScreen && ( | 108 | {isWindows && !isFullScreen && <TitleBar menu={window.franz.menu.template} icon="assets/images/logo.svg" />} |
112 | <TitleBar | ||
113 | menu={window.franz.menu.template} | ||
114 | icon="assets/images/logo.svg" | ||
115 | /> | ||
116 | )} | ||
117 | <div className={`app__content ${classes.appContent}`}> | 109 | <div className={`app__content ${classes.appContent}`}> |
118 | {workspacesDrawer} | 110 | {workspacesDrawer} |
119 | {sidebar} | 111 | {sidebar} |
120 | <div className="app__service"> | 112 | <div className="app__service"> |
121 | <WorkspaceSwitchingIndicator /> | 113 | <WorkspaceSwitchingIndicator /> |
122 | {news.length > 0 && | 114 | {news.length > 0 && news.map(item => ( |
123 | news.map(item => ( | 115 | <InfoBar |
124 | <InfoBar | 116 | key={item.id} |
125 | key={item.id} | 117 | position="top" |
126 | position="top" | 118 | type={item.type} |
127 | type={item.type} | 119 | sticky={item.sticky} |
128 | sticky={item.sticky} | 120 | onHide={() => removeNewsItem({ newsId: item.id })} |
129 | onHide={() => removeNewsItem({ newsId: item.id })} | 121 | > |
130 | > | 122 | <span dangerouslySetInnerHTML={createMarkup(item.message)} /> |
131 | <span | 123 | </InfoBar> |
132 | dangerouslySetInnerHTML={createMarkup(item.message)} | 124 | ))} |
133 | /> | ||
134 | </InfoBar> | ||
135 | ))} | ||
136 | {/* {!isOnline && ( | 125 | {/* {!isOnline && ( |
137 | <InfoBar | 126 | <InfoBar |
138 | type="danger" | 127 | type="danger" |