From 38e24671c18264caf16c2ffd523250698f026c6e Mon Sep 17 00:00:00 2001 From: HangLe Date: Fri, 17 Dec 2021 09:09:49 +0200 Subject: [PATCH] Fix for rebasing on develop branch --- src/App.tsx | 4 +-- src/components/ErrorPageContainer.tsx | 12 ++++--- src/components/{Nav.js => Nav.tsx} | 25 ++++++--------- .../WizardForms/WizardJSONSchemaParser.tsx | 2 +- src/theme.ts | 6 +++- src/types/font.d.ts | 1 + src/types/theme.d.ts | 32 +++++++++++++------ src/views/{Login.js => Login.tsx} | 3 +- 8 files changed, 48 insertions(+), 37 deletions(-) rename src/components/{Nav.js => Nav.tsx} (91%) create mode 100644 src/types/font.d.ts rename src/views/{Login.js => Login.tsx} (98%) diff --git a/src/App.tsx b/src/App.tsx index 995480ba..2bdbeb08 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import React, { useEffect } from "react" -import Container from "@mui/material/Container" +import Container, { ContainerProps } from "@mui/material/Container" import CssBaseline from "@mui/material/CssBaseline" import { styled } from "@mui/material/styles" import { makeStyles } from "@mui/styles" @@ -44,7 +44,7 @@ const useStyles = makeStyles(theme => ({ }, })) -const LoginContent = styled(Container)(() => ({ +const LoginContent: React.FC = styled(Container)(() => ({ padding: 0, margin: 0, width: "100%", diff --git a/src/components/ErrorPageContainer.tsx b/src/components/ErrorPageContainer.tsx index c885515f..59303bf8 100644 --- a/src/components/ErrorPageContainer.tsx +++ b/src/components/ErrorPageContainer.tsx @@ -36,14 +36,16 @@ const useStyles = makeStyles((theme: any) => ({ margin: "1vh auto", }, errorTitle: { - backgroundColor: (props: ErrorTypeProps) => - props.errorType === "warning" ? theme.errors.yellowErrorBackground : theme.errors.redErrorBackground, - color: (props: ErrorTypeProps) => - props.errorType === "warning" ? theme.errors.yellowErrorText : theme.errors.redErrorText, + color: theme.palette.common.black, + backgroundColor: theme.palette.common.white, + border: (props: ErrorTypeProps) => + props.errorType === "warning" + ? `1px solid ${theme.palette.warning.main}` + : `1px solid ${theme.palette.error.main}`, }, errorIcon: { color: (props: ErrorTypeProps) => - props.errorType === "warning" ? theme.errors.yellowErrorText : theme.errors.redErrorText, + props.errorType === "warning" ? theme.palette.warning.main : theme.palette.error.main, }, })) diff --git a/src/components/Nav.js b/src/components/Nav.tsx similarity index 91% rename from src/components/Nav.js rename to src/components/Nav.tsx index dc75cd6c..4c2383bc 100644 --- a/src/components/Nav.js +++ b/src/components/Nav.tsx @@ -1,4 +1,3 @@ -//@flow import React, { useState } from "react" import HomeIcon from "@mui/icons-material/Home" @@ -12,8 +11,7 @@ import { styled } from "@mui/material/styles" import Toolbar from "@mui/material/Toolbar" import Typography from "@mui/material/Typography" import { makeStyles } from "@mui/styles" -import i18n from "i18next" -import { useDispatch, useSelector } from "react-redux" +import * as i18n from "i18next" import { Link as RouterLink, useLocation, useNavigate } from "react-router-dom" import logo from "../images/csc_logo.svg" @@ -23,6 +21,7 @@ import { setLocale } from "features/localeSlice" import { resetUser } from "features/userSlice" import { resetObjectType } from "features/wizardObjectTypeSlice" import { resetFolder } from "features/wizardSubmissionFolderSlice" +import { useAppSelector, useAppDispatch } from "hooks" import { pathWithLocale } from "utils" const useStyles = makeStyles(theme => ({ @@ -56,14 +55,13 @@ const ServiceTitle = styled(Typography)(({ theme }) => ({ })) type MenuItemProps = { - currentLocale: string, + currentLocale: string } const NavigationLinks = (props: MenuItemProps) => { const { currentLocale } = props - const classes = useStyles() - const dispatch = useDispatch() + const dispatch = useAppDispatch() const resetWizard = () => { dispatch(resetObjectType()) @@ -75,7 +73,6 @@ const NavigationLinks = (props: MenuItemProps) => { { const [anchorEl, setAnchorEl] = useState(null) const open = Boolean(anchorEl) - - const dispatch = useDispatch() + const dispatch = useAppDispatch() const navigate = useNavigate() @@ -176,21 +172,18 @@ const LanguageSelector = (props: MenuItemProps) => { } const NavigationMenu = () => { - const classes = useStyles() - - let location = useLocation() - - const currentLocale = useSelector(state => state.locale) || Locale.defaultLocale + const location = useLocation() + const currentLocale = useAppSelector(state => state.locale) || Locale.defaultLocale return ( -