GladysProject/Gladys

View on GitHub
front/src/routes/integration/all/netatmo/setup-page/StateConnection.jsx

Summary

Maintainability
A
1 hr
Test Coverage
import { Text, MarkupText } from 'preact-i18n';
import { STATUS } from '../../../../../../../server/services/netatmo/lib/utils/netatmo.constants';

const StateConnection = props => (
  <div>
    {props.accessDenied && (
      <p class="text-center alert alert-warning">
        <MarkupText id={`integration.netatmo.status.errorConnecting.${props.messageAlert}`} />
      </p>
    )}
    {!props.accessDenied &&
      ((props.connectNetatmoStatus === STATUS.CONNECTING && (
        <p class="text-center alert alert-info">
          <Text id="integration.netatmo.status.connecting" />
        </p>
      )) ||
        (props.connectNetatmoStatus === STATUS.PROCESSING_TOKEN && (
          <p class="text-center alert alert-warning">
            <Text id="integration.netatmo.status.processingToken" />
          </p>
        )) ||
        (props.connected && (
          <p class="text-center alert alert-success">
            <Text id="integration.netatmo.status.connect" />
          </p>
        )) ||
        (props.connectNetatmoStatus === STATUS.DISCONNECTED && (
          <p class="text-center alert alert-danger">
            <Text id="integration.netatmo.status.disconnect" />
          </p>
        )) ||
        (props.connectNetatmoStatus === STATUS.NOT_INITIALIZED && (
          <p class="text-center alert alert-warning">
            <Text id="integration.netatmo.status.notConfigured" />
          </p>
        )))}
  </div>
);

export default StateConnection;