diff options
Diffstat (limited to 'src/components/layout')
-rw-r--r-- | src/components/layout/AppLayout.js | 136 | ||||
-rw-r--r-- | src/components/layout/Sidebar.js | 3 |
2 files changed, 74 insertions, 65 deletions
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index 3ababe54a..dbe0bb4b6 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js | |||
@@ -6,6 +6,8 @@ import { TitleBar } from 'electron-react-titlebar'; | |||
6 | 6 | ||
7 | import InfoBar from '../ui/InfoBar'; | 7 | import InfoBar from '../ui/InfoBar'; |
8 | import { Component as DelayApp } from '../../features/delayApp'; | 8 | import { Component as DelayApp } from '../../features/delayApp'; |
9 | import ErrorBoundary from '../util/ErrorBoundary'; | ||
10 | |||
9 | import globalMessages from '../../i18n/globalMessages'; | 11 | import globalMessages from '../../i18n/globalMessages'; |
10 | 12 | ||
11 | import { isWindows } from '../../environment'; | 13 | import { isWindows } from '../../environment'; |
@@ -94,74 +96,78 @@ export default @observer class AppLayout extends Component { | |||
94 | const { intl } = this.context; | 96 | const { intl } = this.context; |
95 | 97 | ||
96 | return ( | 98 | return ( |
97 | <div className={(darkMode ? 'theme__dark' : '')}> | 99 | <ErrorBoundary> |
98 | <div className="app"> | 100 | <div className={(darkMode ? 'theme__dark' : '')}> |
99 | {isWindows && !isFullScreen && <TitleBar menu={window.franz.menu.template} icon={'assets/images/logo.svg'} />} | 101 | <div className="app"> |
100 | <div className="app__content"> | 102 | {isWindows && !isFullScreen && <TitleBar menu={window.franz.menu.template} icon="assets/images/logo.svg" />} |
101 | {sidebar} | 103 | <div className="app__content"> |
102 | <div className="app__service"> | 104 | {sidebar} |
103 | {news.length > 0 && news.map(item => ( | 105 | <div className="app__service"> |
104 | <InfoBar | 106 | {news.length > 0 && news.map(item => ( |
105 | key={item.id} | 107 | <InfoBar |
106 | position="top" | 108 | key={item.id} |
107 | type={item.type} | 109 | position="top" |
108 | sticky={item.sticky} | 110 | type={item.type} |
109 | onHide={() => removeNewsItem({ newsId: item.id })} | 111 | sticky={item.sticky} |
110 | > | 112 | onHide={() => removeNewsItem({ newsId: item.id })} |
111 | <span dangerouslySetInnerHTML={createMarkup(item.message)} /> | 113 | > |
112 | </InfoBar> | 114 | <span dangerouslySetInnerHTML={createMarkup(item.message)} /> |
113 | ))} | 115 | </InfoBar> |
114 | {!isOnline && ( | 116 | ))} |
115 | <InfoBar | 117 | {!isOnline && ( |
116 | type="danger" | 118 | <InfoBar |
117 | > | 119 | type="danger" |
118 | <span className="mdi mdi-flash" /> | 120 | > |
119 | {intl.formatMessage(globalMessages.notConnectedToTheInternet)} | 121 | <span className="mdi mdi-flash" /> |
120 | </InfoBar> | 122 | {intl.formatMessage(globalMessages.notConnectedToTheInternet)} |
121 | )} | 123 | </InfoBar> |
122 | {!areRequiredRequestsSuccessful && showRequiredRequestsError && ( | 124 | )} |
123 | <InfoBar | 125 | {!areRequiredRequestsSuccessful && showRequiredRequestsError && ( |
124 | type="danger" | 126 | <InfoBar |
125 | ctaLabel="Try again" | 127 | type="danger" |
126 | ctaLoading={areRequiredRequestsLoading} | 128 | ctaLabel="Try again" |
127 | sticky | 129 | ctaLoading={areRequiredRequestsLoading} |
128 | onClick={retryRequiredRequests} | 130 | sticky |
129 | > | 131 | onClick={retryRequiredRequests} |
130 | <span className="mdi mdi-flash" /> | 132 | > |
131 | {intl.formatMessage(messages.requiredRequestsFailed)} | 133 | <span className="mdi mdi-flash" /> |
132 | </InfoBar> | 134 | {intl.formatMessage(messages.requiredRequestsFailed)} |
133 | )} | 135 | </InfoBar> |
134 | {showServicesUpdatedInfoBar && ( | 136 | )} |
135 | <InfoBar | 137 | {showServicesUpdatedInfoBar && ( |
136 | type="primary" | 138 | <InfoBar |
137 | ctaLabel={intl.formatMessage(messages.buttonReloadServices)} | 139 | type="primary" |
138 | onClick={reloadServicesAfterUpdate} | 140 | ctaLabel={intl.formatMessage(messages.buttonReloadServices)} |
139 | sticky | 141 | onClick={reloadServicesAfterUpdate} |
140 | > | 142 | sticky |
141 | <span className="mdi mdi-power-plug" /> | 143 | > |
142 | {intl.formatMessage(messages.servicesUpdated)} | 144 | <span className="mdi mdi-power-plug" /> |
143 | </InfoBar> | 145 | {intl.formatMessage(messages.servicesUpdated)} |
144 | )} | 146 | </InfoBar> |
145 | {appUpdateIsDownloaded && ( | 147 | )} |
146 | <InfoBar | 148 | {appUpdateIsDownloaded && ( |
147 | type="primary" | 149 | <InfoBar |
148 | ctaLabel={intl.formatMessage(messages.buttonInstallUpdate)} | 150 | type="primary" |
149 | onClick={installAppUpdate} | 151 | ctaLabel={intl.formatMessage(messages.buttonInstallUpdate)} |
150 | sticky | 152 | onClick={installAppUpdate} |
151 | > | 153 | sticky |
152 | <span className="mdi mdi-information" /> | 154 | > |
153 | {intl.formatMessage(messages.updateAvailable)} <a href="https://meetfranz.com/changelog" target="_blank"> | 155 | <span className="mdi mdi-information" /> |
154 | <u>{intl.formatMessage(messages.changelog)}</u> | 156 | {intl.formatMessage(messages.updateAvailable)} |
155 | </a> | 157 | {' '} |
156 | </InfoBar> | 158 | <a href="https://meetfranz.com/changelog" target="_blank"> |
157 | )} | 159 | <u>{intl.formatMessage(messages.changelog)}</u> |
158 | {isDelayAppScreenVisible && (<DelayApp />)} | 160 | </a> |
159 | {services} | 161 | </InfoBar> |
162 | )} | ||
163 | {isDelayAppScreenVisible && (<DelayApp />)} | ||
164 | {services} | ||
165 | </div> | ||
160 | </div> | 166 | </div> |
161 | </div> | 167 | </div> |
168 | {children} | ||
162 | </div> | 169 | </div> |
163 | {children} | 170 | </ErrorBoundary> |
164 | </div> | ||
165 | ); | 171 | ); |
166 | } | 172 | } |
167 | } | 173 | } |
diff --git a/src/components/layout/Sidebar.js b/src/components/layout/Sidebar.js index 6ea95bf88..609a3b604 100644 --- a/src/components/layout/Sidebar.js +++ b/src/components/layout/Sidebar.js | |||
@@ -65,6 +65,7 @@ export default @observer class Sidebar extends Component { | |||
65 | disableToolTip={() => this.disableToolTip()} | 65 | disableToolTip={() => this.disableToolTip()} |
66 | /> | 66 | /> |
67 | <button | 67 | <button |
68 | type="button" | ||
68 | onClick={toggleMuteApp} | 69 | onClick={toggleMuteApp} |
69 | className={`sidebar__button sidebar__button--audio ${isAppMuted ? 'is-muted' : ''}`} | 70 | className={`sidebar__button sidebar__button--audio ${isAppMuted ? 'is-muted' : ''}`} |
70 | data-tip={`${intl.formatMessage(isAppMuted ? messages.unmute : messages.mute)} (${ctrlKey}+Shift+M)`} | 71 | data-tip={`${intl.formatMessage(isAppMuted ? messages.unmute : messages.mute)} (${ctrlKey}+Shift+M)`} |
@@ -72,6 +73,7 @@ export default @observer class Sidebar extends Component { | |||
72 | <i className={`mdi mdi-bell${isAppMuted ? '-off' : ''}`} /> | 73 | <i className={`mdi mdi-bell${isAppMuted ? '-off' : ''}`} /> |
73 | </button> | 74 | </button> |
74 | <button | 75 | <button |
76 | type="button" | ||
75 | onClick={() => openSettings({ path: 'recipes' })} | 77 | onClick={() => openSettings({ path: 'recipes' })} |
76 | className="sidebar__button sidebar__button--new-service" | 78 | className="sidebar__button sidebar__button--new-service" |
77 | data-tip={`${intl.formatMessage(messages.addNewService)} (${ctrlKey}+N)`} | 79 | data-tip={`${intl.formatMessage(messages.addNewService)} (${ctrlKey}+N)`} |
@@ -79,6 +81,7 @@ export default @observer class Sidebar extends Component { | |||
79 | <i className="mdi mdi-plus-box" /> | 81 | <i className="mdi mdi-plus-box" /> |
80 | </button> | 82 | </button> |
81 | <button | 83 | <button |
84 | type="button" | ||
82 | onClick={() => openSettings({ path: 'app' })} | 85 | onClick={() => openSettings({ path: 'app' })} |
83 | className="sidebar__button sidebar__button--settings" | 86 | className="sidebar__button sidebar__button--settings" |
84 | data-tip={`${intl.formatMessage(messages.settings)} (${ctrlKey}+,)`} | 87 | data-tip={`${intl.formatMessage(messages.settings)} (${ctrlKey}+,)`} |