2019-04-09 11:05:20 +00:00
|
|
|
// @flow
|
2018-10-30 05:02:23 +00:00
|
|
|
|
2017-11-09 13:34:42 +00:00
|
|
|
import { Component } from 'react';
|
|
|
|
|
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link AbstractSuspendedOverlay}.
|
2017-11-09 13:34:42 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
type Props = {
|
|
|
|
|
2017-11-09 13:34:42 +00:00
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The function to translate human-readable text.
|
2017-11-09 13:34:42 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
t: Function
|
|
|
|
};
|
2017-11-09 13:34:42 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* Implements a React {@link Component} for suspended overlay. Shown when a
|
|
|
|
* suspend is detected.
|
|
|
|
*/
|
|
|
|
export default class AbstractSuspendedOverlay extends Component<Props> {
|
2017-11-09 13:34:42 +00:00
|
|
|
/**
|
2017-11-27 22:08:12 +00:00
|
|
|
* Determines whether this overlay needs to be rendered (according to a
|
|
|
|
* specific redux state). Called by {@link OverlayContainer}.
|
2017-11-09 13:34:42 +00:00
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
2017-11-27 22:08:12 +00:00
|
|
|
* @returns {boolean} - If this overlay needs to be rendered, {@code true};
|
|
|
|
* {@code false}, otherwise.
|
2017-11-09 13:34:42 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
static needsRender(state: Object) {
|
2023-02-14 09:50:46 +00:00
|
|
|
return state['features/power-monitor']?.suspendDetected;
|
2017-11-09 13:34:42 +00:00
|
|
|
}
|
|
|
|
}
|