-

+
Ups, es ist ein Fehler passiert!
Bitte überprüfe deine Internetverbindung.
Fehlermeldung:
diff --git a/src/js/components/Errors/UpgradeRequiredError.js b/src/js/components/Errors/UpgradeRequiredError.js
index 6a4ab7d..6c20c34 100644
--- a/src/js/components/Errors/UpgradeRequiredError.js
+++ b/src/js/components/Errors/UpgradeRequiredError.js
@@ -5,7 +5,12 @@ import firefoxAddons from "images/firefox_addons.png"
const UpgradeRequiredError = () => (
-

+
Bitte aktualisieren
Die installierte MOCO Browser-Erweiterung ist veraltet — bitte aktualisieren.
{isChrome() ? (
@@ -18,7 +23,12 @@ const UpgradeRequiredError = () => (
) : (
<>
Unter folgender URL:
-

+

>
)}
diff --git a/src/js/components/Popup.js b/src/js/components/Popup.js
index eeeb5ac..870f562 100644
--- a/src/js/components/Popup.js
+++ b/src/js/components/Popup.js
@@ -1,41 +1,24 @@
-import React, { Component } from "react"
+import React, { useEffect, useRef } from "react"
import PropTypes from "prop-types"
import queryString from "query-string"
-import { ERROR_UNKNOWN, ERROR_UNAUTHORIZED, ERROR_UPGRADE_REQUIRED, serializeProps } from "utils"
-import { isChrome } from "utils/browser"
+import { serializeProps } from "utils"
-function getStyles(errorType) {
- return {
- width: "516px",
- height:
- errorType === ERROR_UNAUTHORIZED
- ? "590px"
- : errorType === ERROR_UPGRADE_REQUIRED
- ? isChrome()
- ? "429px"
- : "472px"
- : errorType === ERROR_UNKNOWN
- ? "408px"
- : isChrome()
- ? "558px"
- : "574px",
- }
-}
+function Popup(props) {
+ const iFrameRef = useRef()
-class Popup extends Component {
- static propTypes = {
- service: PropTypes.object,
- errorType: PropTypes.string,
- onRequestClose: PropTypes.func.isRequired,
- }
-
- handleRequestClose = event => {
+ const handleRequestClose = event => {
if (event.target.classList.contains("moco-bx-popup")) {
- this.props.onRequestClose()
+ props.onRequestClose()
}
}
- componentDidMount() {
+ const handleMessage = event => {
+ if (iFrameRef.current) {
+ iFrameRef.current.style.height = `${event.data}px`
+ }
+ }
+
+ useEffect(() => {
// Document might lose focus when clicking the browser action.
// Document might be out of focus when hitting the shortcut key.
// This puts the focus back to the document and ensures that:
@@ -43,39 +26,45 @@ class Popup extends Component {
// - the ESC key closes the popup without closing anything else
window.focus()
document.activeElement?.blur()
- }
+ window.addEventListener("message", handleMessage)
+ return () => {
+ window.removeEventListener("message", handleMessage)
+ }
+ }, [])
- render() {
- const serializedProps = serializeProps([
- "loading",
- "service",
- "subdomain",
- "projects",
- "activities",
- "schedules",
- "timedActivity",
- "lastProjectId",
- "lastTaskId",
- "fromDate",
- "toDate",
- "errorType",
- "errorMessage",
- ])(this.props)
+ const serializedProps = serializeProps([
+ "loading",
+ "service",
+ "subdomain",
+ "projects",
+ "activities",
+ "schedules",
+ "timedActivity",
+ "lastProjectId",
+ "lastTaskId",
+ "fromDate",
+ "toDate",
+ "errorType",
+ "errorMessage",
+ ])(props)
- const styles = getStyles(this.props.errorType)
-
- return (
-
-
-
-
+ return (
+
+ )
+}
+
+Popup.propTypes = {
+ service: PropTypes.object,
+ errorType: PropTypes.string,
+ onRequestClose: PropTypes.func.isRequired,
}
export default Popup