74 lines
2.7 KiB
JavaScript
74 lines
2.7 KiB
JavaScript
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_reps";
|
|
|
|
const MyRepresentations = (props) => {
|
|
let { t } = useTranslation();
|
|
|
|
const router = useRouter();
|
|
const { locale } = router;
|
|
const { setCurrentView } = props;
|
|
|
|
return (
|
|
<div className="card" id="my-representations-card">
|
|
<div className="card-body">
|
|
<h3 className="heading-small card-heading">
|
|
{t("myportal:myrepresentations-card-title")}
|
|
</h3>
|
|
<div className="cardModuleContainer">
|
|
<TopThree
|
|
showTopThree={props.myRepresentations.myRepresentations}
|
|
showDetails={
|
|
props.myRepresentations.myRepresentationsDetails
|
|
}
|
|
topThreeType={"myRepresentations"}
|
|
props={props}
|
|
/>
|
|
</div>
|
|
|
|
{props.myRepresentations.myRepresentations["@odata.count"] >
|
|
3 && (
|
|
<div className="cardVieAll">
|
|
<Link
|
|
href={
|
|
(router.locale != "en"
|
|
? "/" +
|
|
router.locale +
|
|
"/fymhorth/gweldpopeth"
|
|
: "/myportal/viewall") +
|
|
"?viewKey=myRepresentations"
|
|
}
|
|
className="govuk-link--no-underline"
|
|
onClick={() => {
|
|
setCurrentView({
|
|
"viewName": "My Representations",
|
|
"viewKey": "myRepresentations",
|
|
});
|
|
}}
|
|
>
|
|
{t("myportal:viewall-link")}{" "}
|
|
{props.isLPA &&
|
|
props.myRepresentations.myRepresentations[
|
|
"@odata.count"
|
|
] + " representations"}
|
|
</Link>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
return {
|
|
setCurrentView: (currentView) => {
|
|
dispatch(setCurrentView(currentView));
|
|
},
|
|
};
|
|
};
|
|
|
|
export default connect(null, mapDispatchToProps)(MyRepresentations);
|