Added scoreboard initial design BOD-91
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import moment from "moment";
|
||||
import ScoreboardDayStat from "../scoreboard-day-stats/scoreboard-day-stats.component";
|
||||
import { Row, Col } from "antd";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
export function ScoreboardLastDays({ bodyshop, sbEntriesByDate }) {
|
||||
const { lastNumberWorkingDays } = bodyshop.scoreboard_target;
|
||||
|
||||
const ArrayOfDate = [];
|
||||
for (var i = lastNumberWorkingDays - 1; i >= 0; i--) {
|
||||
ArrayOfDate.push(
|
||||
moment().businessSubtract(i, "day").toISOString().substr(0, 10)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Row>
|
||||
{ArrayOfDate.map((a) => (
|
||||
<Col span={2} key={a}>
|
||||
{!!sbEntriesByDate ? (
|
||||
<ScoreboardDayStat date={a} entries={sbEntriesByDate[a] || []} />
|
||||
) : (
|
||||
<LoadingSkeleton />
|
||||
)}
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ScoreboardLastDays);
|
||||
Reference in New Issue
Block a user