import React from 'react';
import {observer, inject} from "mobx-react";
import {Device} from "../../../../../common/mobile/utils/device";
import { Swiper, SwiperSlide } from 'swiper/react';
const AddChart = props => {
const types = props.storeChartSettings.types;
const countSlides = Math.floor(types.length / 3);
const arraySlides = !Device.phone ? Array(countSlides).fill(countSlides) : [types.slice(0, 6), types.slice(6)];
return (
{types && types.length ? (
{Device.phone ?
arraySlides.map((typesSlide, indexSlide) => {
return (
{typesSlide.map((row, indexRow) => {
return (
{row.map((type, index) => {
return (
- {
props.onInsertChart(type.type)
}}>
)
})}
)
})}
)
})
:
arraySlides.map((_, indexSlide) => {
let typesSlide = types.slice(indexSlide * 3, (indexSlide * 3) + 3);
return (
{typesSlide.map((row, indexRow) => {
return (
{row.map((type, index) => {
return (
- {
props.onInsertChart(type.type)
}}>
)
})}
)
})}
)
})}
) : null}
)
};
export default inject("storeChartSettings")(observer(AddChart));