Files
pedwfrontend/components/myportal/myrepresentationsfromblob.js
T
2023-11-08 13:20:43 +00:00

70 lines
2.4 KiB
JavaScript

import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import TopThree from "./topthree_reps";
import { connect } from "react-redux";
import { setCurrentView } from "../../store/currentView/action";
const MyRepresentations = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
const { setCurrentView } = props;
return (
<div className="card" id="casescomment-card">
<div className="card-body">
<h3 className="heading-small card-heading">
{t("myportal:myrepresentations-card-title")}dd
</h3>
<div className="cardModuleContainer">
<TopThree
showTopThree={props.myRepresentations.myRepresentations}
showDetails={
props.myRepresentations.myRepresentationsDetails
}
topThreeType={"myRepresentations"}
/>
</div>
{props.myRepresentations.myRepresentations["@odata.count"] >
3 && (
<div className="cardVieAll">
<Link
href={
router.locale != "en"
? "/" +
router.locale +
"/fymhorth/gweldpopeth"
: "/myportal/viewall"
}
shallow
className="govuk-link--no-underline"
onClick={() => {
setCurrentView({
"viewName": "My Representations",
"viewKey": "myRepresentations",
});
}}>
{t("myportal:viewall-link")}
</Link>
</div>
)}
</div>
</div>
);
};
const mapDispatchToProps = (dispatch) => {
return {
setCurrentView: (currentView) => {
dispatch(setCurrentView(currentView));
},
};
};
export default connect(null, mapDispatchToProps)(MyRepresentations);