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

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

export type PropsType = {
  readonly i18n: LocalizerType;
  readonly description?: string;
};

// TODO: This should use <Modal>. See DESKTOP-1038.
export const ProgressDialog = memo(function ProgressDialogInner({
  description,
  i18n,
}: PropsType) {
  return (
    <div className="module-progress-dialog">
      <div className="module-progress-dialog__spinner">
        <Spinner svgSize="normal" size="39px" direction="on-progress-dialog" />
      </div>
      <div className="module-progress-dialog__text">
        {description ?? i18n('icu:updating')}
      </div>
    </div>
  );
});
