Skip to content
Snippets Groups Projects
Commit 80a299cb authored by Yoan VALLET's avatar Yoan VALLET
Browse files

feat: display only mondays for duel > 2 weeks

parent b0abf6ac
Branches
Tags
1 merge request!309feat: display only mondays for duel > 2 weeks
...@@ -15,7 +15,7 @@ interface TextTypeProps { ...@@ -15,7 +15,7 @@ interface TextTypeProps {
timeStep: TimeStep timeStep: TimeStep
width: number width: number
selectedDate: DateTime selectedDate: DateTime
isDuel?: boolean displayAllDays?: boolean
} }
function TextAxis({ function TextAxis({
...@@ -24,7 +24,7 @@ function TextAxis({ ...@@ -24,7 +24,7 @@ function TextAxis({
timeStep, timeStep,
width, width,
selectedDate, selectedDate,
isDuel, displayAllDays,
}: TextTypeProps) { }: TextTypeProps) {
const dateChartService = new DateChartService() const dateChartService = new DateChartService()
const isSelectedDate = dateChartService.compareStepDate( const isSelectedDate = dateChartService.compareStepDate(
...@@ -56,7 +56,7 @@ function TextAxis({ ...@@ -56,7 +56,7 @@ function TextAxis({
case TimeStep.DAY: case TimeStep.DAY:
return ( return (
<text y="10" dy="0.71em" transform={`translate(${width})`}> <text y="10" dy="0.71em" transform={`translate(${width})`}>
{isDuel ? ( {displayAllDays ? (
<> <>
<tspan className={style} x="0" textAnchor="middle"> <tspan className={style} x="0" textAnchor="middle">
{dataload.date.toLocaleString({ weekday: 'narrow' })} {dataload.date.toLocaleString({ weekday: 'narrow' })}
...@@ -128,11 +128,12 @@ const AxisBottom: React.FC<AxisBottomProps> = ({ ...@@ -128,11 +128,12 @@ const AxisBottom: React.FC<AxisBottomProps> = ({
height, height,
marginLeft, marginLeft,
marginBottom, marginBottom,
isDuel, isDuel = false,
}: AxisBottomProps) => { }: AxisBottomProps) => {
const { selectedDate } = useSelector((state: AppStore) => state.ecolyo.chart) const { selectedDate } = useSelector((state: AppStore) => state.ecolyo.chart)
const dashArray = `${height / 30} ${height / 30}` const dashArray = `${height / 30} ${height / 30}`
const dateChartService = new DateChartService() const dateChartService = new DateChartService()
const displayAllDays: boolean = isDuel && data.length <= 15
return ( return (
<g <g
className="axis x" className="axis x"
...@@ -153,7 +154,7 @@ const AxisBottom: React.FC<AxisBottomProps> = ({ ...@@ -153,7 +154,7 @@ const AxisBottom: React.FC<AxisBottomProps> = ({
timeStep={timeStep} timeStep={timeStep}
width={xScale.bandwidth() / 2} width={xScale.bandwidth() / 2}
selectedDate={selectedDate} selectedDate={selectedDate}
isDuel={isDuel} displayAllDays={displayAllDays}
/> />
{dateChartService.compareStepDate( {dateChartService.compareStepDate(
timeStep, timeStep,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment