// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

import type { ReactNode, JSX } from 'react';

import { offsetDistanceModifier } from '../../util/popperUtil.std.ts';
import { Tooltip, TooltipPlacement } from '../Tooltip.dom.tsx';

import type { LocalizerType } from '../../types/I18N.std.ts';

type Props = {
  i18n: LocalizerType;
  children: ReactNode;
};

export function getTooltipContent(i18n: LocalizerType): string {
  return i18n('icu:calling__in-another-call-tooltip');
}

export function InAnotherCallTooltip({ i18n, children }: Props): JSX.Element {
  return (
    <Tooltip
      className="InAnotherCallTooltip"
      content={getTooltipContent(i18n)}
      direction={TooltipPlacement.Top}
      popperModifiers={[offsetDistanceModifier(5)]}
    >
      {children}
    </Tooltip>
  );
}
