diff --git a/src/fireedge/src/client/components/NumberEasing/index.js b/src/fireedge/src/client/components/NumberEasing/index.js index d53f244a0f..38972bfc67 100644 --- a/src/fireedge/src/client/components/NumberEasing/index.js +++ b/src/fireedge/src/client/components/NumberEasing/index.js @@ -27,7 +27,7 @@ const TOTAL_PROGRESS = 1 * @param {number} [props.duration] - Duration of animation effect in ms * @returns {string} Returns a count number */ -const NumberEasing = ({ value = 0, start = 0, duration = 2000 }) => { +const NumberEasing = ({ value = 0, start = 0, duration = 1500 }) => { const [count, setCount] = useState(start) useEffect(() => { @@ -51,7 +51,7 @@ const NumberEasing = ({ value = 0, start = 0, duration = 2000 }) => { animation = window.requestAnimationFrame(step) return () => window.cancelAnimationFrame(animation) - }, []) + }, [value]) return count } diff --git a/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js b/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js index 3bfb57c5af..c2378e26e9 100644 --- a/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js +++ b/src/fireedge/src/client/containers/Dashboard/Sunstone/index.js @@ -99,13 +99,13 @@ function SunstoneDashboard() { } const ResourceWidget = memo(({ query, ...props }) => { - const { data = [], isLoading } = query() + const { data = [], isFetching } = query() return ( ) : ( diff --git a/src/fireedge/src/client/containers/Login/index.js b/src/fireedge/src/client/containers/Login/index.js index 3ef09e6795..89b173aad6 100644 --- a/src/fireedge/src/client/containers/Login/index.js +++ b/src/fireedge/src/client/containers/Login/index.js @@ -14,8 +14,7 @@ * limitations under the License. * * ------------------------------------------------------------------------- */ -import { ReactElement, useState, memo } from 'react' -import PropTypes from 'prop-types' +import { ReactElement, useState, useMemo } from 'react' import { Box, Container, @@ -27,7 +26,7 @@ import { import { useLoginMutation, useChangeAuthGroupMutation, -} from 'client/features/AuthApi' +} from 'client/features/OneApi/auth' import { useAuth, useAuthApi } from 'client/features/Auth' import { useGeneral } from 'client/features/General' @@ -55,8 +54,6 @@ function Login() { const { logout } = useAuthApi() const { error: authError, isLoginInProgress: needGroupToContinue } = useAuth() - const { appTitle } = useGeneral() - const [changeAuthGroup, changeAuthGroupState] = useChangeAuthGroupMutation() const [login, loginState] = useLoginMutation() const isLoading = loginState.isLoading || changeAuthGroupState.isLoading @@ -173,22 +170,29 @@ function Login() { )} - {APPS?.filter((app) => app !== `${appTitle}`.toLowerCase())?.map( - (app) => ( - - ) - )} + {useMemo(() => STEPS.USER_FORM === step && , [step])} ) } -const AppLink = memo(({ app }) => { - const name = APPS_WITH_ONE_PREFIX.includes(app) - ? `One${sentenceCase(app)}` - : sentenceCase(app) +const AppLinks = () => { + const { appTitle } = useGeneral() - return ( + const isNotCurrentApp = (app) => app !== `${appTitle}`.toLowerCase() + + const transformAppTitle = (app) => + APPS_WITH_ONE_PREFIX.includes(app) + ? `One${sentenceCase(app)}` + : sentenceCase(app) + + const otherApps = APPS.filter(isNotCurrentApp).map(transformAppTitle) + + if (otherApps?.length === 0) { + return null + } + + return otherApps.map((app) => ( { > - ) -}) - -AppLink.displayName = 'AppLink' -AppLink.propTypes = { app: PropTypes.string.isRequired } + )) +} export default Login