diff options
Diffstat (limited to 'src/components/services/content/ServiceView.js')
-rw-r--r-- | src/components/services/content/ServiceView.js | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/components/services/content/ServiceView.js b/src/components/services/content/ServiceView.js index 3fc084ff0..fa866e153 100644 --- a/src/components/services/content/ServiceView.js +++ b/src/components/services/content/ServiceView.js | |||
@@ -15,7 +15,9 @@ import SettingsStore from '../../../stores/SettingsStore'; | |||
15 | import WebControlsScreen from '../../../features/webControls/containers/WebControlsScreen'; | 15 | import WebControlsScreen from '../../../features/webControls/containers/WebControlsScreen'; |
16 | import { CUSTOM_WEBSITE_RECIPE_ID } from '../../../config'; | 16 | import { CUSTOM_WEBSITE_RECIPE_ID } from '../../../config'; |
17 | 17 | ||
18 | export default @inject('stores', 'actions') @observer class ServiceView extends Component { | 18 | @inject('stores', 'actions') |
19 | @observer | ||
20 | class ServiceView extends Component { | ||
19 | static propTypes = { | 21 | static propTypes = { |
20 | service: PropTypes.instanceOf(ServiceModel).isRequired, | 22 | service: PropTypes.instanceOf(ServiceModel).isRequired, |
21 | setWebviewReference: PropTypes.func.isRequired, | 23 | setWebviewReference: PropTypes.func.isRequired, |
@@ -63,7 +65,7 @@ export default @inject('stores', 'actions') @observer class ServiceView extends | |||
63 | clearTimeout(this.hibernationTimer); | 65 | clearTimeout(this.hibernationTimer); |
64 | } | 66 | } |
65 | 67 | ||
66 | updateTargetUrl = (event) => { | 68 | updateTargetUrl = event => { |
67 | let visible = true; | 69 | let visible = true; |
68 | if (event.url === '' || event.url === '#') { | 70 | if (event.url === '' || event.url === '#') { |
69 | visible = false; | 71 | visible = false; |
@@ -86,11 +88,12 @@ export default @inject('stores', 'actions') @observer class ServiceView extends | |||
86 | isSpellcheckerEnabled, | 88 | isSpellcheckerEnabled, |
87 | } = this.props; | 89 | } = this.props; |
88 | 90 | ||
89 | const { | 91 | const { navigationBarBehaviour } = stores.settings.app; |
90 | navigationBarBehaviour, | ||
91 | } = stores.settings.app; | ||
92 | 92 | ||
93 | const showNavBar = navigationBarBehaviour === 'always' || (navigationBarBehaviour === 'custom' && service.recipe.id === CUSTOM_WEBSITE_RECIPE_ID); | 93 | const showNavBar = |
94 | navigationBarBehaviour === 'always' || | ||
95 | (navigationBarBehaviour === 'custom' && | ||
96 | service.recipe.id === CUSTOM_WEBSITE_RECIPE_ID); | ||
94 | 97 | ||
95 | const webviewClasses = classnames({ | 98 | const webviewClasses = classnames({ |
96 | services__webview: true, | 99 | services__webview: true, |
@@ -101,9 +104,7 @@ export default @inject('stores', 'actions') @observer class ServiceView extends | |||
101 | 104 | ||
102 | let statusBar = null; | 105 | let statusBar = null; |
103 | if (this.state.statusBarVisible) { | 106 | if (this.state.statusBarVisible) { |
104 | statusBar = ( | 107 | statusBar = <StatusBarTargetUrl text={this.state.targetUrl} />; |
105 | <StatusBarTargetUrl text={this.state.targetUrl} /> | ||
106 | ); | ||
107 | } | 108 | } |
108 | 109 | ||
109 | return ( | 110 | return ( |
@@ -117,11 +118,11 @@ export default @inject('stores', 'actions') @observer class ServiceView extends | |||
117 | reload={reload} | 118 | reload={reload} |
118 | /> | 119 | /> |
119 | )} | 120 | )} |
120 | {service.isEnabled && service.isLoading && service.isFirstLoad && !service.isServiceAccessRestricted && ( | 121 | {service.isEnabled && |
121 | <WebviewLoader | 122 | service.isLoading && |
122 | loaded={false} | 123 | service.isFirstLoad && |
123 | name={service.name} | 124 | !service.isServiceAccessRestricted && ( |
124 | /> | 125 | <WebviewLoader loaded={false} name={service.name} /> |
125 | )} | 126 | )} |
126 | {service.isError && ( | 127 | {service.isError && ( |
127 | <WebviewErrorHandler | 128 | <WebviewErrorHandler |
@@ -147,9 +148,7 @@ export default @inject('stores', 'actions') @observer class ServiceView extends | |||
147 | <> | 148 | <> |
148 | {!service.isHibernating ? ( | 149 | {!service.isHibernating ? ( |
149 | <> | 150 | <> |
150 | {showNavBar && ( | 151 | {showNavBar && <WebControlsScreen service={service} />} |
151 | <WebControlsScreen service={service} /> | ||
152 | )} | ||
153 | <ServiceWebview | 152 | <ServiceWebview |
154 | service={service} | 153 | service={service} |
155 | setWebviewReference={setWebviewReference} | 154 | setWebviewReference={setWebviewReference} |
@@ -159,9 +158,11 @@ export default @inject('stores', 'actions') @observer class ServiceView extends | |||
159 | </> | 158 | </> |
160 | ) : ( | 159 | ) : ( |
161 | <div> | 160 | <div> |
162 | <span role="img" aria-label="Sleeping Emoji">😴</span> | 161 | <span role="img" aria-label="Sleeping Emoji"> |
163 | {' '} | 162 | 😴 |
164 | This service is currently hibernating. If this page doesn't close soon, please try reloading Ferdi. | 163 | </span>{' '} |
164 | This service is currently hibernating. If this page doesn't | ||
165 | close soon, please try reloading Ferdi. | ||
165 | </div> | 166 | </div> |
166 | )} | 167 | )} |
167 | </> | 168 | </> |
@@ -171,3 +172,5 @@ export default @inject('stores', 'actions') @observer class ServiceView extends | |||
171 | ); | 172 | ); |
172 | } | 173 | } |
173 | } | 174 | } |
175 | |||
176 | export default ServiceView; | ||