import renderFormRows from '../lib/render-rows';
import * as config from './config';
import Background from '@/Components/Layout/Background';
import { useStore } from '@/stores/hooks';
import { min } from '@/styles/mq';
import { memo } from 'react';
import styled from 'styled-components';

const Wrapper = styled(Background)`
  padding: 4px 10px;

  ${min('tablet')} {
    min-height: 790px;
  }

  ${min('laptop')} {
    padding: 4px 18px 10px;
  }
`;

export const Settings = memo(() => {
  const { $process } = useStore();

  const mainRows = $process.has('Unlimited')
    ? renderFormRows(config.unlimitedMainRows)
    : renderFormRows(config.mainRows);
  const paramsRows = $process.has('Unlimited')
    ? renderFormRows(config.unlimitedParamsRows)
    : renderFormRows(config.paramsRows);

  return (
    <Wrapper>
      {mainRows}
      {paramsRows}
    </Wrapper>
  );
});
