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

import type { JSX } from 'react';

import { I18n } from '../I18n.dom.tsx';
import type { LocalizerType } from '../../types/Util.std.ts';

export type PropsType = {
  conversationId: string;
  i18n: LocalizerType;
  showGV2MigrationDialog: (id: string) => unknown;
};

export function GroupV1DisabledActions({
  conversationId,
  i18n,
  showGV2MigrationDialog,
}: PropsType): JSX.Element {
  return (
    <div className="module-group-v1-disabled-actions">
      <p className="module-group-v1-disabled-actions__message">
        <I18n
          i18n={i18n}
          id="icu:GroupV1--Migration--disabled--link"
          components={{
            learnMoreLink: parts => {
              return (
                <a
                  href="https://support.signal.org/hc/articles/360007319331"
                  target="_blank"
                  rel="noreferrer"
                  className="module-group-v1-disabled-actions__message__learn-more"
                >
                  {parts}
                </a>
              );
            },
          }}
        />
      </p>
      <div className="module-group-v1-disabled-actions__buttons">
        <button
          type="button"
          onClick={() => showGV2MigrationDialog(conversationId)}
          tabIndex={0}
          className="module-group-v1-disabled-actions__buttons__button"
        >
          {i18n('icu:MessageRequests--continue')}
        </button>
      </div>
    </div>
  );
}
