diff --git a/src/cssStyles.tsx b/src/cssStyles.tsx index a96b39391..e0a394d8d 100644 --- a/src/cssStyles.tsx +++ b/src/cssStyles.tsx @@ -1,7 +1,7 @@ /** * This file contains general css stylings */ -import { css, Global, keyframes } from "@emotion/react"; +import { css, Global } from "@emotion/react"; import React from "react"; import emotionNormalize from "emotion-normalize"; import { createTheme } from "@mui/material/styles"; @@ -399,13 +399,6 @@ export const subtitleSelectStyle = (theme: Theme) => createTheme({ }, }); -export const spinningStyle = css({ - animation: `2s linear infinite none ${keyframes({ - "0%": { transform: "rotate(0)" }, - "100%": { transform: "rotate(360deg)" }, - })}`, -}); - export const customIconStyle = css(({ maxWidth: "16px", height: "auto", diff --git a/src/main/Save.tsx b/src/main/Save.tsx index cc78e929b..e068614a7 100644 --- a/src/main/Save.tsx +++ b/src/main/Save.tsx @@ -3,10 +3,10 @@ import React, { useEffect, useState } from "react"; import { css } from "@emotion/react"; import { basicButtonStyle, backOrContinueStyle, ariaLive, errorBoxStyle, - navigationButtonStyle, spinningStyle, + navigationButtonStyle, } from "../cssStyles"; -import { LuLoader, LuCheckCircle, LuAlertCircle, LuChevronLeft, LuSave, LuCheck } from "react-icons/lu"; +import { LuCheckCircle, LuAlertCircle, LuChevronLeft, LuSave, LuCheck } from "react-icons/lu"; import { useAppDispatch, useAppSelector } from "../redux/store"; import { selectFinishState } from "../redux/finishSlice"; @@ -32,6 +32,7 @@ import { import { serializeSubtitle } from "../util/utilityFunctions"; import { useTheme } from "../themes"; import { ThemedTooltip } from "./Tooltip"; +import { Spinner } from "@opencast/appkit"; /** * Shown if the user wishes to save. @@ -124,22 +125,20 @@ export const SaveButton: React.FC = () => { const [metadataSaveStarted, setMetadataSaveStarted] = useState(false); // Update based on current fetching status - let Icon = LuSave; - let spin = false; let tooltip = null; - if (workflowStatus === "failed" || metadataStatus === "failed") { - Icon = LuAlertCircle; - spin = false; - tooltip = t("save.confirmButton-failed-tooltip"); - } else if (workflowStatus === "success" && metadataStatus === "success") { - Icon = LuCheck; - spin = false; - tooltip = t("save.confirmButton-success-tooltip"); - } else if (workflowStatus === "loading" || metadataStatus === "loading") { - Icon = LuLoader; - spin = true; - tooltip = t("save.confirmButton-attempting-tooltip"); - } + const Icon = () => { + if (workflowStatus === "failed" || metadataStatus === "failed") { + tooltip = t("save.confirmButton-failed-tooltip"); + return ; + } else if (workflowStatus === "success" && metadataStatus === "success") { + tooltip = t("save.confirmButton-success-tooltip"); + return ; + } else if (workflowStatus === "loading" || metadataStatus === "loading") { + tooltip = t("save.confirmButton-attempting-tooltip"); + return ; + } + ; + }; const ariaSaveUpdate = () => { if (workflowStatus === "success") { @@ -201,7 +200,7 @@ export const SaveButton: React.FC = () => { save(); } }}> - + {Icon()} {t("save.confirm-button")}
{ariaSaveUpdate()}
diff --git a/src/main/Timeline.tsx b/src/main/Timeline.tsx index 5061e2925..bd4a19177 100644 --- a/src/main/Timeline.tsx +++ b/src/main/Timeline.tsx @@ -18,7 +18,7 @@ import { moveCut, } from "../redux/videoSlice"; -import { LuMenu, LuLoader } from "react-icons/lu"; +import { LuMenu } from "react-icons/lu"; import useResizeObserver from "use-resize-observer"; @@ -34,7 +34,7 @@ import { ThemedTooltip } from "./Tooltip"; import ScrollContainer from "react-indiana-drag-scroll"; import CuttingActionsContextMenu from "./CuttingActionsContextMenu"; import { useHotkeys } from "react-hotkeys-hook"; -import { spinningStyle } from "../cssStyles"; +import { Spinner } from "@opencast/appkit"; /** * A container for visualizing the cutting of the video, as well as for controlling @@ -664,7 +664,7 @@ export const Waveforms: React.FC<{ timelineHeight: number; }> = ({ timelineHeigh } else { return ( <> - +
{t("timeline.generateWaveform-text")}
); diff --git a/src/main/WorkflowConfiguration.tsx b/src/main/WorkflowConfiguration.tsx index fabdbd4bd..23dbaa728 100644 --- a/src/main/WorkflowConfiguration.tsx +++ b/src/main/WorkflowConfiguration.tsx @@ -5,10 +5,9 @@ import { basicButtonStyle, backOrContinueStyle, errorBoxStyle, - spinningStyle, } from "../cssStyles"; -import { LuLoader, LuCheck, LuAlertCircle, LuChevronLeft, LuDatabase, LuMoreHorizontal } from "react-icons/lu"; +import { LuCheck, LuAlertCircle, LuChevronLeft, LuDatabase, LuMoreHorizontal } from "react-icons/lu"; import { useAppDispatch, useAppSelector } from "../redux/store"; import { @@ -35,6 +34,7 @@ import { } from "../redux/subtitleSlice"; import { serializeSubtitle } from "../util/utilityFunctions"; import { useTheme } from "../themes"; +import { Spinner } from "@opencast/appkit"; /** * Will eventually display settings based on the selected workflow index @@ -147,19 +147,16 @@ export const SaveAndProcessButton: React.FC<{ text: string; }> = ({ text }) => { }, [metadataStatus]); // Update based on current fetching status - let Icon = LuDatabase; - let spin = false; - if (workflowStatus === "failed" || metadataStatus === "failed") { - Icon = LuAlertCircle; - spin = false; - } else if (workflowStatus === "success" && metadataStatus === "success") { - Icon = LuCheck; - spin = false; - } else if (workflowStatus === "loading" || metadataStatus === "loading") { - Icon = LuLoader; - spin = true; - - } + const Icon = () => { + if (workflowStatus === "failed" || metadataStatus === "failed") { + return ; + } else if (workflowStatus === "success" && metadataStatus === "success") { + return ; + } else if (workflowStatus === "loading" || metadataStatus === "loading") { + return ; + } + return ; + }; const saveButtonStyle = css({ padding: "16px", @@ -176,7 +173,7 @@ export const SaveAndProcessButton: React.FC<{ text: string; }> = ({ text }) => { saveAndProcess(); } }}> - + {Icon()} {text} );