removed logging and redundant imports

This commit is contained in:
2022-06-23 13:40:30 +01:00
parent d55aedfa65
commit 047fcb8142
4 changed files with 90 additions and 84 deletions
+81 -24
View File
@@ -599,7 +599,6 @@ const RenderYesNo = ({
: delete docListObj[ : delete docListObj[
"documentCheckList_" + id "documentCheckList_" + id
]; ];
console.log(docListObj);
custom.setDocumentsList(docListObj); custom.setDocumentsList(docListObj);
} }
}} }}
@@ -623,27 +622,70 @@ export function YesNofield(props) {
const router = useRouter(); const router = useRouter();
let { t } = useTranslation(); let { t } = useTranslation();
const { name, label, inline, validation } = props; const {
name,
label,
inline,
form,
formProps,
validation,
parentFieldShowOnValue,
parentField,
} = props;
const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"]; const yesNo = router.locale == "cy" ? ["Ydw", "Na"] : ["Yes", "No"];
const required = (value) => (value ? undefined : "Required"); const required = (value) => (value ? undefined : "Required");
var showIfHasParentShowValue =
parentField != false &&
!_.isEmpty(formProps[form]) &&
_.has(formProps[form].values, parentField) &&
parentFieldShowOnValue.indexOf(
formProps[form].values[parentField].toString()
) > -1;
(showIfHasParentShowValue == parentField) != false &&
showIfHasParentShowValue;
return ( return (
<Field <>
name={props.name} {parentField != false ? (
datafieldname={props.name} showIfHasParentShowValue && (
label={props.label} <Field
options={yesNo} name={props.name}
id={props.name} datafieldname={props.name}
className={"govuk-radios__input"} label={props.label}
validate={eval(validation)} options={yesNo}
errorMsg={t("newappeal:select-an-option-label")} id={props.name}
component={RenderYesNo} className={"govuk-radios__input"}
inline={_.has(props, "inline") ? props.inline : "true"} validate={eval(validation)}
requiredDocumentLabel={props.requiredDocumentLabel} errorMsg={t("newappeal:select-an-option-label")}
requiredDocumentValue={props.requiredDocumentValue} component={RenderYesNo}
setDocumentsList={props.setDocumentsList} inline={_.has(props, "inline") ? props.inline : "true"}
documentList={props.documentList} requiredDocumentLabel={props.requiredDocumentLabel}
/> requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
documentList={props.documentList}
/>
)
) : (
<Field
name={props.name}
datafieldname={props.name}
label={props.label}
options={yesNo}
id={props.name}
className={"govuk-radios__input"}
validate={eval(validation)}
errorMsg={t("newappeal:select-an-option-label")}
component={RenderYesNo}
inline={_.has(props, "inline") ? props.inline : "true"}
requiredDocumentLabel={props.requiredDocumentLabel}
requiredDocumentValue={props.requiredDocumentValue}
setDocumentsList={props.setDocumentsList}
documentList={props.documentList}
/>
)}
</>
); );
} }
@@ -792,12 +834,6 @@ export function Radiofield(props) {
(showIfHasParentShowValue == parentField) != false && (showIfHasParentShowValue == parentField) != false &&
showIfHasParentShowValue; showIfHasParentShowValue;
// console.log(
// datafieldname,
// showIfHasParentShowValue,
// formProps[form].values[parentField]
// );
return ( return (
<> <>
{parentField != false ? ( {parentField != false ? (
@@ -1209,6 +1245,7 @@ export function FileUploadField(props) {
errorMsg="Is required" errorMsg="Is required"
ticketnumber={props.ticketnumber} ticketnumber={props.ticketnumber}
documentTypeCode={props.documentTypeCode} documentTypeCode={props.documentTypeCode}
hint={props.hint}
/> />
</> </>
); );
@@ -1340,6 +1377,7 @@ const rejectStyle = {
const RenderFileUpload = (field) => { const RenderFileUpload = (field) => {
const files = field.input.value; const files = field.input.value;
let { t } = useTranslation();
const style = useMemo( const style = useMemo(
() => ({ () => ({
...baseStyle, ...baseStyle,
@@ -1435,6 +1473,22 @@ const RenderFileUpload = (field) => {
case "000010": case "000010":
return "000010"; return "000010";
break; break;
case "000011":
return "000011";
break;
case "000012":
return "000012";
break;
case "000013":
return "000013";
break;
case "000014":
return "000014";
break;
case "000015":
return "000015";
break;
default: default:
return "000000"; return "000000";
} }
@@ -1465,6 +1519,9 @@ const RenderFileUpload = (field) => {
> >
{({ getRootProps, getInputProps }) => ( {({ getRootProps, getInputProps }) => (
<> <>
{field.hint != false && (
<div className="govuk-hint">{t(field.hint)}</div>
)}
<div className="govuk-form-group"></div> <div className="govuk-form-group"></div>
<section className="container"> <section className="container">
<div {...getRootProps({ style })}> <div {...getRootProps({ style })}>
+8 -54
View File
@@ -1,25 +1,17 @@
import { signOut } from "next-auth/react";
import useTranslation from "next-translate/useTranslation";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useContext } from "react"; import { destroyCookie } from "nookies";
import useTranslation from "next-translate/useTranslation"; import TimeOut from "../components/timeout";
import AwaitingSubmission from "./myportal/awaitingsubmission";
import Dns from "./myportal/dns";
import MakeNewAppeal from "./myportal/makenewappeal"; import MakeNewAppeal from "./myportal/makenewappeal";
import MyCases from "./myportal/mycases"; import MyCases from "./myportal/mycases";
import SearchCases from "./myportal/searchcases";
import AwaitingSubmission from "./myportal/awaitingsubmission";
import MyRepresentations from "./myportal/myrepresentations"; import MyRepresentations from "./myportal/myrepresentations";
import WatchedCases from "./myportal/watchedcases"; import SearchCases from "./myportal/searchcases";
import YourAccount from "./myportal/youraccount";
import { parseCookies, setCookie, destroyCookie } from "nookies";
import Dns from "./myportal/dns";
import IdleTimer from "react-idle-timer";
import TimeoutModal from "./timeout/timeoutmodal";
import { useState } from "react";
import TimeOut from "../components/timeout";
import UploadFile from "./myportal/uploadFile"; import UploadFile from "./myportal/uploadFile";
import WatchedCases from "./myportal/watchedcases";
import { useSession, signIn, signOut } from "next-auth/react";
const MyPortal = (props) => { const MyPortal = (props) => {
const { showFileUpload } = props; const { showFileUpload } = props;
@@ -28,33 +20,6 @@ const MyPortal = (props) => {
const router = useRouter(); const router = useRouter();
const { locale } = router; const { locale } = router;
// const [showModal, setShowModal] = useState(false);
// const inactiveTimeOut = 1200; // in seconds
// const reminderTimeout = 60; // in seconds
// let idleTimer = null;
// let logoutTimer = null;
// let onIdle = () => {
// togglePopup();
// logoutTimer = setTimeout(() => {
// handleLogout();
// }, 1000 * reminderTimeout * 1);
// };
// let togglePopup = () => {
// showModal == true ? setShowModal(false) : setShowModal(true);
// };
// let handleStayLoggedIn = () => {
// if (logoutTimer) {
// clearTimeout(logoutTimer);
// logoutTimer = null;
// }
// idleTimer.reset();
// togglePopup();
// };
const handleLogout = () => { const handleLogout = () => {
console.log("////////////", "\n", "logout", "\n", "//////////"); console.log("////////////", "\n", "logout", "\n", "//////////");
destroyCookie({}, "pinsUser"), destroyCookie({}, "pinsUser"),
@@ -63,7 +28,6 @@ const MyPortal = (props) => {
signOut({ callbackUrl: "/logout" }); signOut({ callbackUrl: "/logout" });
}; };
console.log("showFileUpload :", showFileUpload);
return ( return (
<> <>
<main className="" id="main-content" role="main"> <main className="" id="main-content" role="main">
@@ -160,16 +124,6 @@ const MyPortal = (props) => {
</div> </div>
</div> </div>
</main> </main>
{/* <IdleTimer
ref={(ref) => {
idleTimer = ref;
}}
element={document}
stopOnIdle={true}
onActive={console.log(" bbis active", idleTimer)}
onIdle={onIdle}
timeout={1000 * inactiveTimeOut * 1}
/> */}
<TimeOut ggLogout={props.ggLogout} /> <TimeOut ggLogout={props.ggLogout} />
</> </>
); );
+1 -5
View File
@@ -1,4 +1,5 @@
import _ from "lodash"; import _ from "lodash";
import { getSession, useSession } from "next-auth/react";
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
@@ -37,9 +38,6 @@ import {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails,
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { setCookie } from "nookies";
import { getSession, useSession, signIn, signOut } from "next-auth/react";
const Home = (props) => { const Home = (props) => {
const { const {
@@ -61,8 +59,6 @@ const Home = (props) => {
const { data: session } = useSession(); const { data: session } = useSession();
console.log("eeee", process.env.SHOWFILEUPLOAD);
return ( return (
<div> <div>
<Head> <Head>
-1
View File
@@ -65,7 +65,6 @@ export const setFormComplete = (formComplete) => (dispatch) => {
}; };
export const setDocumentsList = (documentList) => (dispatch) => { export const setDocumentsList = (documentList) => (dispatch) => {
console.log("here", documentList);
return dispatch({ return dispatch({
type: appealTypeDataActionTypes.SETDOCUMENTLIST, type: appealTypeDataActionTypes.SETDOCUMENTLIST,
documentList: documentList, documentList: documentList,