/* eslint-disable */
// @ts-nocheck
import React, {memo} from 'react';
import {View, Text, Platform} from 'react-native';
import {colors} from '../utils/colors';
import styles from './styles';

export type Props = {
  index?: number;
  item?: object;
  numberPrefix?: string;
  internationalNumberSystem?: boolean;
  timelineFontSize?: number;
  scaleData: object;
  scaleColor: string;
};

const Scale: React.FC<Props> = ({
  index = 0,
  item,
  numberPrefix,
  internationalNumberSystem,
  timelineFontSize,
  scaleData,
  scaleColor = colors?.black,
}) => {
  return (
    <View style={styles?.mainContainer}>
      {/* Divider Line code begins */}
      <View
        style={{
          height: index % 2 ? 10 : 15,
          width: index % 2 ? 0.5 : 1,
          backgroundColor: scaleColor,
        }}
      />
      {/*  Divider Line code ends */}

      {/* Divider Line Number code begins */}
      <View style={styles?.numberContainer}>
        <Text
          style={[
            styles?.textStyle,
            {
              fontSize: timelineFontSize ?? 12,
              color: scaleColor,
              // left: index === scaleData?.length - 1 ? -30 : 0,
              left:
                Platform?.OS == 'macos' || Platform?.OS === 'windows'
                  ? index === 0
                    ? '50%'
                    : null
                  : null,
              right:
                Platform?.OS == 'macos' || Platform?.OS === 'windows'
                  ? index === scaleData?.length - 1
                    ? '50%'
                    : 0
                  : null,
            },
          ]}
          numberOfLines={1}>
          {index % 2
            ? ''
            : `${numberPrefix ?? ''}${
                internationalNumberSystem === true
                  ? item?.value
                      .toString()
                      .replace(/\B(?=(?:(\d\d)+(\d)(?!\d))+(?!\d))/g, ',')
                  : item?.value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
              }`}
        </Text>
      </View>
      {/* Divider Line Number code ends */}
    </View>
  );
};

// function arePropsEqual(prevProps, nextProps) {
//   return (
//     nextProps?.item === prevProps?.item ||
//     nextProps?.internationalNumberSystem ===
//       prevProps?.internationalNumberSystem ||
//     nextProps?.numberPrefix === prevProps?.numberPrefix ||
//     nextProps?.timelineFontSize === prevProps?.timelineFontSize ||
//     nextProps?.scaleData === prevProps?.scaleData
//   );
// }
// export default memo(Scale, arePropsEqual);
export default Scale;
