diff options
author | kytwb <kytwb@pm.me> | 2021-12-18 14:38:57 +0100 |
---|---|---|
committer | kytwb <kytwb@pm.me> | 2021-12-18 14:38:57 +0100 |
commit | 67b97a09382e9afbe78f3c64add24bd3440da908 (patch) | |
tree | 53f1614e1d6e13758c7e279228be9108ae65c0ef | |
parent | Remove duplicate edit button in account settings tab (diff) | |
download | ferdium-app-67b97a09382e9afbe78f3c64add24bd3440da908.tar.gz ferdium-app-67b97a09382e9afbe78f3c64add24bd3440da908.tar.zst ferdium-app-67b97a09382e9afbe78f3c64add24bd3440da908.zip |
Move LockedScreen to AppLayout
-rw-r--r-- | src/components/layout/AppLayout.js | 9 | ||||
-rw-r--r-- | src/containers/layout/AppLayoutContainer.js | 1 | ||||
-rw-r--r-- | src/lib/Menu.js | 17 | ||||
-rw-r--r-- | src/routes.tsx | 6 |
4 files changed, 20 insertions, 13 deletions
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index b47a6040d..eb36ea431 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js | |||
@@ -22,6 +22,8 @@ import AppUpdateInfoBar from '../AppUpdateInfoBar'; | |||
22 | import Todos from '../../features/todos/containers/TodosScreen'; | 22 | import Todos from '../../features/todos/containers/TodosScreen'; |
23 | import { Icon } from '../ui/icon'; | 23 | import { Icon } from '../ui/icon'; |
24 | 24 | ||
25 | import LockedScreen from '../../containers/auth/LockedScreen'; | ||
26 | |||
25 | const messages = defineMessages({ | 27 | const messages = defineMessages({ |
26 | servicesUpdated: { | 28 | servicesUpdated: { |
27 | id: 'infobar.servicesUpdated', | 29 | id: 'infobar.servicesUpdated', |
@@ -76,6 +78,7 @@ const toggleFullScreen = () => { | |||
76 | class AppLayout extends Component { | 78 | class AppLayout extends Component { |
77 | static propTypes = { | 79 | static propTypes = { |
78 | classes: PropTypes.object.isRequired, | 80 | classes: PropTypes.object.isRequired, |
81 | settings: PropTypes.object.isRequired, | ||
79 | isFullScreen: PropTypes.bool.isRequired, | 82 | isFullScreen: PropTypes.bool.isRequired, |
80 | sidebar: PropTypes.element.isRequired, | 83 | sidebar: PropTypes.element.isRequired, |
81 | workspacesDrawer: PropTypes.element.isRequired, | 84 | workspacesDrawer: PropTypes.element.isRequired, |
@@ -114,6 +117,7 @@ class AppLayout extends Component { | |||
114 | authRequestFailed, | 117 | authRequestFailed, |
115 | reloadServicesAfterUpdate, | 118 | reloadServicesAfterUpdate, |
116 | installAppUpdate, | 119 | installAppUpdate, |
120 | settings, | ||
117 | showRequiredRequestsError, | 121 | showRequiredRequestsError, |
118 | areRequiredRequestsSuccessful, | 122 | areRequiredRequestsSuccessful, |
119 | retryRequiredRequests, | 123 | retryRequiredRequests, |
@@ -122,6 +126,11 @@ class AppLayout extends Component { | |||
122 | 126 | ||
123 | const { intl } = this.props; | 127 | const { intl } = this.props; |
124 | 128 | ||
129 | const { locked } = settings.app; | ||
130 | if (locked) { | ||
131 | return <LockedScreen />; | ||
132 | } | ||
133 | |||
125 | return ( | 134 | return ( |
126 | <ErrorBoundary> | 135 | <ErrorBoundary> |
127 | <div className="app"> | 136 | <div className="app"> |
diff --git a/src/containers/layout/AppLayoutContainer.js b/src/containers/layout/AppLayoutContainer.js index 9b0edc85e..536083c4f 100644 --- a/src/containers/layout/AppLayoutContainer.js +++ b/src/containers/layout/AppLayoutContainer.js | |||
@@ -144,6 +144,7 @@ class AppLayoutContainer extends Component { | |||
144 | return ( | 144 | return ( |
145 | <ThemeProvider theme={ui.theme}> | 145 | <ThemeProvider theme={ui.theme}> |
146 | <AppLayout | 146 | <AppLayout |
147 | settings={settings} | ||
147 | isFullScreen={app.isFullScreen} | 148 | isFullScreen={app.isFullScreen} |
148 | isOnline={app.isOnline} | 149 | isOnline={app.isOnline} |
149 | showServicesUpdatedInfoBar={ui.showServicesUpdatedInfoBar} | 150 | showServicesUpdatedInfoBar={ui.showServicesUpdatedInfoBar} |
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 8e529d859..38302b40b 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -591,7 +591,10 @@ class FranzMenu { | |||
591 | } | 591 | } |
592 | 592 | ||
593 | const { intl } = window['ferdi']; | 593 | const { intl } = window['ferdi']; |
594 | const tpl = _titleBarTemplateFactory(intl, this.stores.settings.app.locked); | 594 | const locked = this.stores.settings.app.locked |
595 | && this.stores.settings.app.lockingFeatureEnabled | ||
596 | && this.stores.user.isLoggedIn; | ||
597 | const tpl = _titleBarTemplateFactory(intl, locked); | ||
595 | const { actions } = this; | 598 | const { actions } = this; |
596 | 599 | ||
597 | if (!isMac) { | 600 | if (!isMac) { |
@@ -611,7 +614,7 @@ class FranzMenu { | |||
611 | }); | 614 | }); |
612 | } | 615 | } |
613 | 616 | ||
614 | if (!this.stores.settings.app.locked) { | 617 | if (!locked) { |
615 | tpl[1].submenu.push( | 618 | tpl[1].submenu.push( |
616 | { | 619 | { |
617 | type: 'separator', | 620 | type: 'separator', |
@@ -755,18 +758,18 @@ class FranzMenu { | |||
755 | this.actions.ui.openSettings({ path: 'app' }); | 758 | this.actions.ui.openSettings({ path: 'app' }); |
756 | }, | 759 | }, |
757 | enabled: this.stores.user.isLoggedIn, | 760 | enabled: this.stores.user.isLoggedIn, |
758 | visible: !this.stores.settings.app.locked, | 761 | visible: !locked, |
759 | }, | 762 | }, |
760 | { | 763 | { |
761 | label: intl.formatMessage(menuItems.checkForUpdates), | 764 | label: intl.formatMessage(menuItems.checkForUpdates), |
762 | visible: !this.stores.settings.app.locked, | 765 | visible: !locked, |
763 | click: () => { | 766 | click: () => { |
764 | this.actions.app.checkForUpdates(); | 767 | this.actions.app.checkForUpdates(); |
765 | }, | 768 | }, |
766 | }, | 769 | }, |
767 | { | 770 | { |
768 | type: 'separator', | 771 | type: 'separator', |
769 | visible: !this.stores.settings.app.locked, | 772 | visible: !locked, |
770 | }, | 773 | }, |
771 | { | 774 | { |
772 | label: intl.formatMessage(menuItems.services), | 775 | label: intl.formatMessage(menuItems.services), |
@@ -846,7 +849,7 @@ class FranzMenu { | |||
846 | this.actions.ui.openSettings({ path: 'app' }); | 849 | this.actions.ui.openSettings({ path: 'app' }); |
847 | }, | 850 | }, |
848 | enabled: this.stores.user.isLoggedIn, | 851 | enabled: this.stores.user.isLoggedIn, |
849 | visible: !this.stores.settings.locked, | 852 | visible: !locked, |
850 | }, | 853 | }, |
851 | { | 854 | { |
852 | type: 'separator', | 855 | type: 'separator', |
@@ -868,7 +871,7 @@ class FranzMenu { | |||
868 | ); | 871 | ); |
869 | } | 872 | } |
870 | 873 | ||
871 | if (!this.stores.settings.app.locked) { | 874 | if (!locked) { |
872 | if (serviceTpl.length > 0) { | 875 | if (serviceTpl.length > 0) { |
873 | tpl[3].submenu = serviceTpl; | 876 | tpl[3].submenu = serviceTpl; |
874 | } | 877 | } |
diff --git a/src/routes.tsx b/src/routes.tsx index 192090737..62e6f5066 100644 --- a/src/routes.tsx +++ b/src/routes.tsx | |||
@@ -15,7 +15,6 @@ import InviteSettingsScreen from './containers/settings/InviteScreen'; | |||
15 | import SupportFerdiScreen from './containers/settings/SupportScreen'; | 15 | import SupportFerdiScreen from './containers/settings/SupportScreen'; |
16 | import WelcomeScreen from './containers/auth/WelcomeScreen'; | 16 | import WelcomeScreen from './containers/auth/WelcomeScreen'; |
17 | import LoginScreen from './containers/auth/LoginScreen'; | 17 | import LoginScreen from './containers/auth/LoginScreen'; |
18 | import LockedScreen from './containers/auth/LockedScreen'; | ||
19 | import PasswordScreen from './containers/auth/PasswordScreen'; | 18 | import PasswordScreen from './containers/auth/PasswordScreen'; |
20 | import ChangeServerScreen from './containers/auth/ChangeServerScreen'; | 19 | import ChangeServerScreen from './containers/auth/ChangeServerScreen'; |
21 | import SignupScreen from './containers/auth/SignupScreen'; | 20 | import SignupScreen from './containers/auth/SignupScreen'; |
@@ -38,14 +37,9 @@ type Props = { | |||
38 | 37 | ||
39 | class Routes extends Component<Props> { | 38 | class Routes extends Component<Props> { |
40 | render() { | 39 | render() { |
41 | const { locked } = this.props.stores.settings.app; | ||
42 | 40 | ||
43 | const { history } = this.props; | 41 | const { history } = this.props; |
44 | 42 | ||
45 | if (locked) { | ||
46 | return <LockedScreen />; | ||
47 | } | ||
48 | |||
49 | return ( | 43 | return ( |
50 | <Router history={history}> | 44 | <Router history={history}> |
51 | <Route path="/" component={AppLayoutContainer}> | 45 | <Route path="/" component={AppLayoutContainer}> |