diff --git a/src/components/PointerIcon.jsx b/src/components/PointerIcon.jsx deleted file mode 100644 index 1e0a566..0000000 --- a/src/components/PointerIcon.jsx +++ /dev/null @@ -1,60 +0,0 @@ -import PropTypes from 'prop-types' - -export const PointerIcon = ({color, size, online, onlineColor}) => ( - - {online && ( // Волны от антенны - - - - - - )} - {/* Арматурная сетка */} - - {/* Шляпы */} - - - - {/* Столб и границы почвы */} - - - - - -) - -PointerIcon.propTypes = { - color: PropTypes.string, - size: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number, - PropTypes.shape({ - width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]) - }) - ]), - online: PropTypes.bool, - onlineColor: PropTypes.string -} - -PointerIcon.defaultProps = { - color: 'currentColor', - size: {width: '48', height: '59'}, - online: false, - onlineColor: 'red' -} - -export default PointerIcon diff --git a/src/components/icons/PointerIcon.tsx b/src/components/icons/PointerIcon.tsx new file mode 100644 index 0000000..474133f --- /dev/null +++ b/src/components/icons/PointerIcon.tsx @@ -0,0 +1,83 @@ +import React from 'react' + +type PointerIconColors = { + online?: string + active?: string + inactive?: string + unknown?: string +} + +interface PointerIconProps { + width?: string | number + height?: string | number + online?: boolean + state?: 'active' | 'inactive' | 'unknown' + colors?: PointerIconColors +} + +const defaultColors: PointerIconColors = { + online: 'red', + active: 'black', + inactive: 'gray', + unknown: 'gray', +} + +const defaultProps: PointerIconProps = { + width: 48, + height: 59, + state: 'unknown', +} + +// Рекомендованное соотношение сторон 1:1.19 +export const PointerIcon = React.memo(({ width, height, online, state, colors, ...other } : PointerIconProps = defaultProps) => { + colors = { ...defaultColors, ...colors } + + return ( + + {/* Арматурная сетка */} + + + + {/* Шляпы */} + + + + + + {/* Столб и границы почвы */} + + + + + + {/* Волны от антенны */} + {online && ( + + + + + + )} + + ) +}) + +export default PointerIcon diff --git a/src/pages/Cluster/ClusterWells.jsx b/src/pages/Cluster/ClusterWells.jsx index 4674a9f..57457b3 100644 --- a/src/pages/Cluster/ClusterWells.jsx +++ b/src/pages/Cluster/ClusterWells.jsx @@ -15,7 +15,7 @@ import { Tvd } from '../WellOperations/Tvd' import WellOperationsTable from './WellOperationsTable' import { getOperations } from './functions' import LoaderPortal from '../../components/LoaderPortal' -import PointerIcon from '../../components/PointerIcon' +import PointerIcon from '../../components/icons/PointerIcon' const filtersMinMax = [ { text: 'min', value: 'min' }, @@ -23,8 +23,8 @@ const filtersMinMax = [ ] const filtersWellsType = [] -const DAY_IN_MS = 1000 * 60 * 60 * 24 -const ONLINE_DEADTIME = 600 +const DAY_IN_MS = 86_400_000 +const ONLINE_DEADTIME = 600_000 export default function ClusterWells({statsWells}) { @@ -54,7 +54,7 @@ export default function ClusterWells({statsWells}) { let data = statsWells?.map((well) => { if (!filtersWellsType.some((el) => el.text === well.wellType)) filtersWellsType.push({ text: well.wellType, value: well.wellType,}) - + return { key: well.caption, id: well.id, @@ -75,7 +75,7 @@ export default function ClusterWells({statsWells}) { idState: well.idState } }) - + calcAndUpdateStatsBySections(data ?? [], [ 'factStart', 'factEnd', @@ -91,17 +91,17 @@ export default function ClusterWells({statsWells}) { setTableData(data) }, [statsWells]) - const getDate = (str) => Number.isNaN(new Date(str).getTime()) ? '-' : new Date(str).toLocaleString() + const getDate = (str) => Number.isNaN(+new Date(str)) ? '-' : new Date(str).toLocaleString() const columns = [ - makeTextColumn('скв №', 'caption', null, null, + makeTextColumn('скв №', 'caption', null, null, (_, item) => ( {item.caption ?? '-'} @@ -121,7 +121,7 @@ export default function ClusterWells({statsWells}) { key: 'tvd', render: (value) => , align: 'center' }, @@ -130,7 +130,7 @@ export default function ClusterWells({statsWells}) { key: 'operations', render: (value) => , align: 'center' }, diff --git a/src/pages/Deposit.jsx b/src/pages/Deposit.jsx index 629c832..40fb0ef 100644 --- a/src/pages/Deposit.jsx +++ b/src/pages/Deposit.jsx @@ -1,5 +1,5 @@ import { Map, Overlay } from "pigeon-maps" -import { PointerIcon } from '../components/PointerIcon' +import { PointerIcon } from '../components/icons/PointerIcon' import { Link } from "react-router-dom"; import LoaderPortal from '../components/LoaderPortal' import { useState, useEffect } from "react"; @@ -58,7 +58,7 @@ export default function Deposit() { anchor={[cluster.latitude, cluster.longitude]} key={`${cluster.latitude} ${cluster.longitude}`}> - + {cluster.caption}