All files / libs/amalia-lang/formula/components/src/lib/hooks/use-and-or-options useAndOrOptions.tsx

100% Statements 27/27
100% Branches 2/2
100% Functions 1/1
100% Lines 27/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281x 1x 1x 1x 1x 1x 1x 1x 1x 45x 45x 45x 45x 45x 38x 38x 38x 38x 38x 38x 38x 38x 38x 38x 45x 45x 1x  
import { useMemo } from 'react';
import { FormattedMessage } from 'react-intl';
 
import { type RadioButtonSingleOption } from '@allshares/studio-design-system';
import { FormulaBuilderLogicalOperatorType } from '@amalia/amalia-lang/formula/types';
 
import { andOrMessages, andOrTooltipMessages } from './useAndOrOptions.messages';
 
export const useAndOrOptions = (): [
  RadioButtonSingleOption<FormulaBuilderLogicalOperatorType>,
  RadioButtonSingleOption<FormulaBuilderLogicalOperatorType>,
] =>
  useMemo(
    () => [
      {
        value: FormulaBuilderLogicalOperatorType.AND,
        label: <FormattedMessage {...andOrMessages[FormulaBuilderLogicalOperatorType.AND]} />,
        help: <FormattedMessage {...andOrTooltipMessages[FormulaBuilderLogicalOperatorType.AND]} />,
      },
      {
        value: FormulaBuilderLogicalOperatorType.OR,
        label: <FormattedMessage {...andOrMessages[FormulaBuilderLogicalOperatorType.OR]} />,
        help: <FormattedMessage {...andOrTooltipMessages[FormulaBuilderLogicalOperatorType.OR]} />,
      },
    ],
    [],
  );