diff options
author | kytwb <kytwb@pm.me> | 2021-12-21 17:30:24 +0100 |
---|---|---|
committer | kytwb <kytwb@pm.me> | 2021-12-21 17:30:24 +0100 |
commit | b054bd77a89c75c6288841c524773888ca981dcb (patch) | |
tree | 0deef05f007d2934ff41b8ebae060d61a3ca4afd /src/components/layout | |
parent | 5.6.4 (diff) | |
parent | 5.6.5-nightly.5 [skip ci] (diff) | |
download | ferdium-app-b054bd77a89c75c6288841c524773888ca981dcb.tar.gz ferdium-app-b054bd77a89c75c6288841c524773888ca981dcb.tar.zst ferdium-app-b054bd77a89c75c6288841c524773888ca981dcb.zip |
Merge branch 'nightly' into release
Diffstat (limited to 'src/components/layout')
-rw-r--r-- | src/components/layout/AppLayout.js | 11 | ||||
-rw-r--r-- | src/components/layout/Sidebar.js | 140 |
2 files changed, 73 insertions, 78 deletions
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index 084d93ecd..eb36ea431 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js | |||
@@ -10,7 +10,6 @@ import { mdiFlash, mdiPowerPlug } from '@mdi/js'; | |||
10 | import InfoBar from '../ui/InfoBar'; | 10 | import InfoBar from '../ui/InfoBar'; |
11 | import { Component as BasicAuth } from '../../features/basicAuth'; | 11 | import { Component as BasicAuth } from '../../features/basicAuth'; |
12 | import { Component as QuickSwitch } from '../../features/quickSwitch'; | 12 | import { Component as QuickSwitch } from '../../features/quickSwitch'; |
13 | import { Component as NightlyBuilds } from '../../features/nightlyBuilds'; | ||
14 | import { Component as PublishDebugInfo } from '../../features/publishDebugInfo'; | 13 | import { Component as PublishDebugInfo } from '../../features/publishDebugInfo'; |
15 | import ErrorBoundary from '../util/ErrorBoundary'; | 14 | import ErrorBoundary from '../util/ErrorBoundary'; |
16 | 15 | ||
@@ -23,6 +22,8 @@ import AppUpdateInfoBar from '../AppUpdateInfoBar'; | |||
23 | import Todos from '../../features/todos/containers/TodosScreen'; | 22 | import Todos from '../../features/todos/containers/TodosScreen'; |
24 | import { Icon } from '../ui/icon'; | 23 | import { Icon } from '../ui/icon'; |
25 | 24 | ||
25 | import LockedScreen from '../../containers/auth/LockedScreen'; | ||
26 | |||
26 | const messages = defineMessages({ | 27 | const messages = defineMessages({ |
27 | servicesUpdated: { | 28 | servicesUpdated: { |
28 | id: 'infobar.servicesUpdated', | 29 | id: 'infobar.servicesUpdated', |
@@ -77,6 +78,7 @@ const toggleFullScreen = () => { | |||
77 | class AppLayout extends Component { | 78 | class AppLayout extends Component { |
78 | static propTypes = { | 79 | static propTypes = { |
79 | classes: PropTypes.object.isRequired, | 80 | classes: PropTypes.object.isRequired, |
81 | settings: PropTypes.object.isRequired, | ||
80 | isFullScreen: PropTypes.bool.isRequired, | 82 | isFullScreen: PropTypes.bool.isRequired, |
81 | sidebar: PropTypes.element.isRequired, | 83 | sidebar: PropTypes.element.isRequired, |
82 | workspacesDrawer: PropTypes.element.isRequired, | 84 | workspacesDrawer: PropTypes.element.isRequired, |
@@ -115,6 +117,7 @@ class AppLayout extends Component { | |||
115 | authRequestFailed, | 117 | authRequestFailed, |
116 | reloadServicesAfterUpdate, | 118 | reloadServicesAfterUpdate, |
117 | installAppUpdate, | 119 | installAppUpdate, |
120 | settings, | ||
118 | showRequiredRequestsError, | 121 | showRequiredRequestsError, |
119 | areRequiredRequestsSuccessful, | 122 | areRequiredRequestsSuccessful, |
120 | retryRequiredRequests, | 123 | retryRequiredRequests, |
@@ -123,6 +126,11 @@ class AppLayout extends Component { | |||
123 | 126 | ||
124 | const { intl } = this.props; | 127 | const { intl } = this.props; |
125 | 128 | ||
129 | const { locked } = settings.app; | ||
130 | if (locked) { | ||
131 | return <LockedScreen />; | ||
132 | } | ||
133 | |||
126 | return ( | 134 | return ( |
127 | <ErrorBoundary> | 135 | <ErrorBoundary> |
128 | <div className="app"> | 136 | <div className="app"> |
@@ -193,7 +201,6 @@ class AppLayout extends Component { | |||
193 | )} | 201 | )} |
194 | <BasicAuth /> | 202 | <BasicAuth /> |
195 | <QuickSwitch /> | 203 | <QuickSwitch /> |
196 | <NightlyBuilds /> | ||
197 | <PublishDebugInfo /> | 204 | <PublishDebugInfo /> |
198 | {services} | 205 | {services} |
199 | {children} | 206 | {children} |
diff --git a/src/components/layout/Sidebar.js b/src/components/layout/Sidebar.js index 4f67a8719..e3df9c2ea 100644 --- a/src/components/layout/Sidebar.js +++ b/src/components/layout/Sidebar.js | |||
@@ -3,12 +3,10 @@ import PropTypes from 'prop-types'; | |||
3 | import ReactTooltip from 'react-tooltip'; | 3 | import ReactTooltip from 'react-tooltip'; |
4 | import { defineMessages, injectIntl } from 'react-intl'; | 4 | import { defineMessages, injectIntl } from 'react-intl'; |
5 | import { inject, observer } from 'mobx-react'; | 5 | import { inject, observer } from 'mobx-react'; |
6 | import { Link } from 'react-router'; | ||
7 | import { | 6 | import { |
8 | mdiCheckAll, | 7 | mdiCheckAll, |
9 | mdiViewGrid, | 8 | mdiViewGrid, |
10 | mdiPlusBox, | 9 | mdiPlusBox, |
11 | mdiLoginVariant, | ||
12 | mdiCog, | 10 | mdiCog, |
13 | mdiBellOff, | 11 | mdiBellOff, |
14 | mdiBell, | 12 | mdiBell, |
@@ -137,7 +135,6 @@ class Sidebar extends Component { | |||
137 | const workspaceToggleMessage = isWorkspaceDrawerOpen | 135 | const workspaceToggleMessage = isWorkspaceDrawerOpen |
138 | ? messages.closeWorkspaceDrawer | 136 | ? messages.closeWorkspaceDrawer |
139 | : messages.openWorkspaceDrawer; | 137 | : messages.openWorkspaceDrawer; |
140 | const isLoggedIn = Boolean(localStorage.getItem('authToken')); | ||
141 | 138 | ||
142 | return ( | 139 | return ( |
143 | <div className="sidebar"> | 140 | <div className="sidebar"> |
@@ -147,95 +144,86 @@ class Sidebar extends Component { | |||
147 | disableToolTip={() => this.disableToolTip()} | 144 | disableToolTip={() => this.disableToolTip()} |
148 | useVerticalStyle={stores.settings.all.app.useVerticalStyle} | 145 | useVerticalStyle={stores.settings.all.app.useVerticalStyle} |
149 | /> | 146 | /> |
150 | {isLoggedIn ? ( | 147 | <> |
151 | <> | 148 | <button |
152 | {stores.settings.all.app.lockingFeatureEnabled ? ( | 149 | type="button" |
153 | <button | 150 | onClick={() => openSettings({ path: 'recipes' })} |
154 | type="button" | 151 | className="sidebar__button sidebar__button--new-service" |
155 | className="sidebar__button" | 152 | data-tip={`${intl.formatMessage( |
156 | onClick={() => { | 153 | messages.addNewService, |
157 | actions.settings.update({ | 154 | )} (${addNewServiceShortcutKey(false)})`} |
158 | type: 'app', | 155 | > |
159 | data: { | 156 | <Icon icon={mdiPlusBox} size={1.5} /> |
160 | locked: true, | 157 | </button> |
161 | }, | 158 | <button |
162 | }); | 159 | type="button" |
163 | }} | 160 | onClick={() => { |
164 | data-tip={`${intl.formatMessage( | 161 | toggleWorkspaceDrawer(); |
165 | messages.lockFerdi, | 162 | this.updateToolTip(); |
166 | )} (${lockFerdiShortcutKey(false)})`} | 163 | }} |
167 | > | 164 | className={`sidebar__button sidebar__button--workspaces ${ |
168 | <Icon icon={mdiLock} size={1.5} /> | 165 | isWorkspaceDrawerOpen ? 'is-active' : '' |
169 | </button> | 166 | }`} |
170 | ) : null} | 167 | data-tip={`${intl.formatMessage( |
171 | {todosStore.isFeatureEnabledByUser ? ( | 168 | workspaceToggleMessage, |
172 | <button | 169 | )} (${workspaceToggleShortcutKey(false)})`} |
173 | type="button" | 170 | > |
174 | onClick={() => { | 171 | <Icon icon={mdiViewGrid} size={1.5} /> |
175 | todoActions.toggleTodosPanel(); | 172 | </button> |
176 | this.updateToolTip(); | 173 | {todosStore.isFeatureEnabledByUser ? ( |
177 | }} | ||
178 | disabled={isTodosServiceActive} | ||
179 | className={`sidebar__button sidebar__button--todos ${ | ||
180 | todosStore.isTodosPanelVisible ? 'is-active' : '' | ||
181 | }`} | ||
182 | data-tip={`${intl.formatMessage( | ||
183 | todosToggleMessage, | ||
184 | )} (${todosToggleShortcutKey(false)})`} | ||
185 | > | ||
186 | <Icon icon={mdiCheckAll} size={1.5} /> | ||
187 | </button> | ||
188 | ) : null} | ||
189 | <button | 174 | <button |
190 | type="button" | 175 | type="button" |
191 | onClick={() => { | 176 | onClick={() => { |
192 | toggleWorkspaceDrawer(); | 177 | todoActions.toggleTodosPanel(); |
193 | this.updateToolTip(); | 178 | this.updateToolTip(); |
194 | }} | 179 | }} |
195 | className={`sidebar__button sidebar__button--workspaces ${ | 180 | disabled={isTodosServiceActive} |
196 | isWorkspaceDrawerOpen ? 'is-active' : '' | 181 | className={`sidebar__button sidebar__button--todos ${ |
182 | todosStore.isTodosPanelVisible ? 'is-active' : '' | ||
197 | }`} | 183 | }`} |
198 | data-tip={`${intl.formatMessage( | 184 | data-tip={`${intl.formatMessage( |
199 | workspaceToggleMessage, | 185 | todosToggleMessage, |
200 | )} (${workspaceToggleShortcutKey(false)})`} | 186 | )} (${todosToggleShortcutKey(false)})`} |
201 | > | 187 | > |
202 | <Icon icon={mdiViewGrid} size={1.5} /> | 188 | <Icon icon={mdiCheckAll} size={1.5} /> |
203 | </button> | 189 | </button> |
190 | ) : null} | ||
191 | <button | ||
192 | type="button" | ||
193 | onClick={() => { | ||
194 | toggleMuteApp(); | ||
195 | this.updateToolTip(); | ||
196 | }} | ||
197 | className={`sidebar__button sidebar__button--audio ${ | ||
198 | isAppMuted ? 'is-muted' : '' | ||
199 | }`} | ||
200 | data-tip={`${intl.formatMessage( | ||
201 | isAppMuted ? messages.unmute : messages.mute, | ||
202 | )} (${muteFerdiShortcutKey(false)})`} | ||
203 | > | ||
204 | <Icon icon={isAppMuted ? mdiBellOff : mdiBell} size={1.5} /> | ||
205 | </button> | ||
206 | |||
207 | {stores.settings.all.app.lockingFeatureEnabled ? ( | ||
204 | <button | 208 | <button |
205 | type="button" | 209 | type="button" |
210 | className="sidebar__button" | ||
206 | onClick={() => { | 211 | onClick={() => { |
207 | toggleMuteApp(); | 212 | actions.settings.update({ |
208 | this.updateToolTip(); | 213 | type: 'app', |
214 | data: { | ||
215 | locked: true, | ||
216 | }, | ||
217 | }); | ||
209 | }} | 218 | }} |
210 | className={`sidebar__button sidebar__button--audio ${ | ||
211 | isAppMuted ? 'is-muted' : '' | ||
212 | }`} | ||
213 | data-tip={`${intl.formatMessage( | 219 | data-tip={`${intl.formatMessage( |
214 | isAppMuted ? messages.unmute : messages.mute, | 220 | messages.lockFerdi, |
215 | )} (${muteFerdiShortcutKey(false)})`} | 221 | )} (${lockFerdiShortcutKey(false)})`} |
216 | > | 222 | > |
217 | <Icon icon={isAppMuted ? mdiBellOff : mdiBell} size={1.5} /> | 223 | <Icon icon={mdiLock} size={1.5} /> |
218 | </button> | 224 | </button> |
219 | <button | 225 | ) : null} |
220 | type="button" | 226 | </> |
221 | onClick={() => openSettings({ path: 'recipes' })} | ||
222 | className="sidebar__button sidebar__button--new-service" | ||
223 | data-tip={`${intl.formatMessage( | ||
224 | messages.addNewService, | ||
225 | )} (${addNewServiceShortcutKey(false)})`} | ||
226 | > | ||
227 | <Icon icon={mdiPlusBox} size={1.5} /> | ||
228 | </button> | ||
229 | </> | ||
230 | ) : ( | ||
231 | <Link | ||
232 | to="/auth/welcome" | ||
233 | className="sidebar__button sidebar__button--new-service" | ||
234 | data-tip="Login" | ||
235 | > | ||
236 | <Icon icon={mdiLoginVariant} size={1.5} /> | ||
237 | </Link> | ||
238 | )} | ||
239 | <button | 227 | <button |
240 | type="button" | 228 | type="button" |
241 | onClick={() => openSettings({ path: 'app' })} | 229 | onClick={() => openSettings({ path: 'app' })} |