updated link for submitted reps viewall
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { setCurrentView } from "../../store/currentView/action";
|
||||
import TopThree from "./topthree";
|
||||
|
||||
const MySubmittedReps = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const { setCurrentView } = props;
|
||||
|
||||
let recordCountVar = props.mySubmittedReps.mySubmittedReps;
|
||||
|
||||
return (
|
||||
<div className="card" id="my-watched-cases-card">
|
||||
<div className="card-body">
|
||||
<h3 className="heading-small card-heading">
|
||||
{t("myportal:submitted-reps-card-title")}
|
||||
</h3>
|
||||
<div className="cardModuleContainer">
|
||||
<TopThree
|
||||
showTopThree={props.mySubmittedReps.mySubmittedReps}
|
||||
showDetails={
|
||||
props.mySubmittedReps.mySubmittedRepsDetails
|
||||
}
|
||||
topThreeType={"watchedCases"}
|
||||
showLoginCheck={props.showLoginCheck}
|
||||
currentView={props.currentView}
|
||||
myReps={props.myReps}
|
||||
props={props}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{(props.myReps
|
||||
? recordCountVar.length > 3
|
||||
: recordCountVar["@odata.count"] > 3) && (
|
||||
<div className="cardVieAll">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
setCurrentView({
|
||||
"viewName": "Submitted Representations",
|
||||
"viewKey": "mySubmittedReps",
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("myportal:viewall-link-count", {
|
||||
count: props.mySubmittedReps.mySubmittedReps
|
||||
.length,
|
||||
})}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentView: (currentView) => {
|
||||
dispatch(setCurrentView(currentView));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(MySubmittedReps);
|
||||
Reference in New Issue
Block a user