Added scoreboard initial design BOD-91
This commit is contained in:
10
client/src/pages/scoreboard/scoreboard.page.component.jsx
Normal file
10
client/src/pages/scoreboard/scoreboard.page.component.jsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import ScoreboardDisplay from "../../components/scoreboard-display/scoreboard-display.component";
|
||||
|
||||
export default function ProductionBoardComponent({ scoreboardSubscription }) {
|
||||
return (
|
||||
<div>
|
||||
<ScoreboardDisplay scoreboardSubscription={scoreboardSubscription} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
47
client/src/pages/scoreboard/scoreboard.page.container.jsx
Normal file
47
client/src/pages/scoreboard/scoreboard.page.container.jsx
Normal file
@@ -0,0 +1,47 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { setBreadcrumbs } from "../../redux/application/application.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import ScoreboardPageComponent from "./scoreboard.page.component";
|
||||
import { useSubscription } from "@apollo/react-hooks";
|
||||
import { SUBSCRIPTION_SCOREBOARD } from "../../graphql/scoreboard.queries";
|
||||
import moment from "moment";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
});
|
||||
|
||||
export function ScoreboardContainer({ setBreadcrumbs }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const scoreboardSubscription = useSubscription(SUBSCRIPTION_SCOREBOARD, {
|
||||
variables: {
|
||||
start: moment().startOf("month"),
|
||||
end: moment().endOf("month"),
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.scoreboard");
|
||||
setBreadcrumbs([
|
||||
{
|
||||
link: "/manage/scoreboard",
|
||||
label: t("titles.bc.scoreboard"),
|
||||
},
|
||||
]);
|
||||
}, [t, setBreadcrumbs]);
|
||||
|
||||
return (
|
||||
<ScoreboardPageComponent scoreboardSubscription={scoreboardSubscription} />
|
||||
);
|
||||
}
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ScoreboardContainer);
|
||||
Reference in New Issue
Block a user