diff --git a/src/cssStyles.tsx b/src/cssStyles.tsx index 1392b59cf..ee1b4a01b 100644 --- a/src/cssStyles.tsx +++ b/src/cssStyles.tsx @@ -166,21 +166,6 @@ export const ariaLive = css({ overflow: "hidden", }); -/** - * CSS for displaying of errors - */ -export const errorBoxStyle = (errorStatus: boolean, theme: Theme) => { - return ( - css({ - ...(!errorStatus) && { display: "none" }, - borderColor: `${theme.error}`, - borderStyle: "dashed", - fontWeight: "bold", - padding: "10px", - }) - ); -}; - type MyOptionType = { label: string; value: string; diff --git a/src/main/Metadata.tsx b/src/main/Metadata.tsx index d9811ab6a..d824875dc 100644 --- a/src/main/Metadata.tsx +++ b/src/main/Metadata.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from "react"; import { css } from "@emotion/react"; -import { BREAKPOINTS, calendarStyle, errorBoxStyle, selectFieldStyle, titleStyle, titleStyleBold } from "../cssStyles"; +import { BREAKPOINTS, calendarStyle, selectFieldStyle, titleStyle, titleStyleBold } from "../cssStyles"; import { useAppDispatch, useAppSelector } from "../redux/store"; import { @@ -27,6 +27,7 @@ import { useTheme } from "../themes"; import { ThemeProvider } from "@mui/material/styles"; import { cloneDeep } from "lodash"; import { ParseKeys } from "i18next"; +import { ErrorBox } from "@opencast/appkit"; import { screenWidthAtMost } from "@opencast/appkit"; /** @@ -710,10 +711,16 @@ const Metadata: React.FC = () => { form.reset(); }} css={metadataStyle}> -
- A problem occurred during communication with Opencast.
- {getError ? "Details: " + getError : "No error details are available."}
-
+ {getStatus === "failed" && + + + {"A problem occurred during communication with Opencast. \n"} + {getError ? + t("various.error-details-text", { errorMessage: getError }) : undefined + } + + + } {catalogs.map((catalog, i) => { if (settings.metadata.configureFields) { diff --git a/src/main/Save.tsx b/src/main/Save.tsx index 49582b51e..c8dd4a4b0 100644 --- a/src/main/Save.tsx +++ b/src/main/Save.tsx @@ -2,7 +2,7 @@ import React, { useEffect } from "react"; import { css } from "@emotion/react"; import { - basicButtonStyle, backOrContinueStyle, ariaLive, errorBoxStyle, + basicButtonStyle, backOrContinueStyle, ariaLive, navigationButtonStyle, } from "../cssStyles"; @@ -32,6 +32,7 @@ import { import { serializeSubtitle } from "../util/utilityFunctions"; import { useTheme } from "../themes"; import { ThemedTooltip } from "./Tooltip"; +import { ErrorBox } from "@opencast/appkit"; import { Spinner } from "@opencast/appkit"; import { ProtoButton } from "@opencast/appkit"; import { setEnd } from "../redux/endSlice"; @@ -46,7 +47,6 @@ const Save: React.FC = () => { const postWorkflowStatus = useAppSelector(selectStatus); const postError = useAppSelector(selectError); - const theme = useTheme(); const metadataHasChanges = useAppSelector(metadataSelectHasChanges); const hasChanges = useAppSelector(selectHasChanges); const subtitleHasChanges = useAppSelector(selectSubtitleHasChanges); @@ -90,10 +90,16 @@ const Save: React.FC = () => {

{t("save.headline-text")}

{render()} -
- {t("various.error-text")}
- {postError ? t("various.error-details-text", { errorMessage: postError }) : t("various.error-text")}
-
+ {postWorkflowStatus === "failed" && + + + {t("various.error-text") + "\n"} + {postError ? + t("various.error-details-text", { errorMessage: postError }) : undefined + } + + + }
); }; diff --git a/src/main/VideoPlayers.tsx b/src/main/VideoPlayers.tsx index ebc5c3d68..d16f03ca6 100644 --- a/src/main/VideoPlayers.tsx +++ b/src/main/VideoPlayers.tsx @@ -40,6 +40,7 @@ import { useTheme } from "../themes"; import { backgroundBoxStyle } from "../cssStyles"; import { BaseReactPlayerProps } from "react-player/base"; import { AsyncThunkConfig } from "@reduxjs/toolkit/dist/createAsyncThunk"; +import { ErrorBox } from "@opencast/appkit"; const VideoPlayers: React.FC<{ refs?: React.MutableRefObject<(VideoPlayerForwardRef | null)[]>, @@ -384,14 +385,6 @@ export const VideoPlayer = React.forwardRef - {t("video.loadError-text")} - + + {t("video.loadError-text")} + ); } }; diff --git a/src/main/WorkflowConfiguration.tsx b/src/main/WorkflowConfiguration.tsx index ae8ef7f63..de756c39c 100644 --- a/src/main/WorkflowConfiguration.tsx +++ b/src/main/WorkflowConfiguration.tsx @@ -3,7 +3,6 @@ import React from "react"; import { css } from "@emotion/react"; import { backOrContinueStyle, - errorBoxStyle, } from "../cssStyles"; import { LuChevronLeft, LuMoreHorizontal } from "react-icons/lu"; @@ -13,7 +12,7 @@ import { useAppSelector } from "../redux/store"; import { PageButton } from "./Finish"; import { useTranslation } from "react-i18next"; -import { useTheme } from "../themes"; +import { ErrorBox } from "@opencast/appkit"; import { selectError, selectStatus } from "../redux/workflowPostSlice"; import { SaveButton } from "./Save"; @@ -26,7 +25,6 @@ const WorkflowConfiguration: React.FC = () => { const postAndProcessWorkflowStatus = useAppSelector(selectStatus); const postAndProcessError = useAppSelector(selectError); - const theme = useTheme(); const workflowConfigurationStyle = css({ display: "flex", @@ -49,12 +47,16 @@ const WorkflowConfiguration: React.FC = () => { text={t("workflowConfig.confirm-button")} /> -
- {t("various.error-text")}
- {postAndProcessError ? t("various.error-details-text", - { errorMessage: postAndProcessError }) : - t("various.error-text")}
-
+ {postAndProcessWorkflowStatus === "failed" && + + + {t("various.error-text") + "\n"} + {postAndProcessError ? + t("various.error-details-text", { errorMessage: postAndProcessError }) : undefined + } + + + } ); }; diff --git a/src/main/WorkflowSelection.tsx b/src/main/WorkflowSelection.tsx index 48fb01a92..14d5922ad 100644 --- a/src/main/WorkflowSelection.tsx +++ b/src/main/WorkflowSelection.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from "react"; import { css } from "@emotion/react"; -import { backOrContinueStyle, errorBoxStyle } from "../cssStyles"; +import { backOrContinueStyle } from "../cssStyles"; import { useAppDispatch, useAppSelector } from "../redux/store"; import { selectWorkflows, setSelectedWorkflowIndex } from "../redux/videoSlice"; @@ -17,6 +17,7 @@ import { useTranslation } from "react-i18next"; import { Trans } from "react-i18next"; import { FormControlLabel, Radio, RadioGroup } from "@mui/material"; import { useTheme } from "../themes"; +import { ErrorBox } from "@opencast/appkit"; /** * Allows the user to select a workflow @@ -34,8 +35,6 @@ const WorkflowSelection: React.FC = () => { return (b.displayOrder - a.displayOrder); }); - const theme = useTheme(); - const saveStatus = useAppSelector(saveSelectStatus); const saveError = useAppSelector(saveSelectError); @@ -97,12 +96,14 @@ const WorkflowSelection: React.FC = () => { {/* */} {nextButton} -
- {t("various.error-text")}
- {errorMessage ? - t("various.error-details-text", { errorMessage: saveError }) : - t("various.error-text")}
-
+ {errorStatus === "failed" && + + {t("various.error-text")}
+ {errorMessage ? + t("various.error-details-text", { errorMessage: saveError }) : + t("various.error-text")}
+
+ } ); };