1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @flow
    
  8.  */
    
  9. 
    
  10. import * as React from 'react';
    
  11. import Button from '../Button';
    
  12. import ButtonIcon from '../ButtonIcon';
    
  13. import styles from './shared.css';
    
  14. 
    
  15. type Props = {
    
  16.   callStack: string | null,
    
  17.   children: React$Node,
    
  18.   componentStack: string | null,
    
  19.   dismissError: Function,
    
  20.   errorMessage: string | null,
    
  21. };
    
  22. 
    
  23. export default function TimeoutView({
    
  24.   callStack,
    
  25.   children,
    
  26.   componentStack,
    
  27.   dismissError = null,
    
  28.   errorMessage,
    
  29. }: Props): React.Node {
    
  30.   return (
    
  31.     <div className={styles.ErrorBoundary}>
    
  32.       {children}
    
  33.       <div className={styles.ErrorInfo}>
    
  34.         <div className={styles.HeaderRow}>
    
  35.           <div className={styles.TimeoutHeader}>
    
  36.             {errorMessage || 'Timed out waiting'}
    
  37.           </div>
    
  38.           <Button className={styles.CloseButton} onClick={dismissError}>
    
  39.             Retry
    
  40.             <ButtonIcon className={styles.CloseButtonIcon} type="close" />
    
  41.           </Button>
    
  42.         </div>
    
  43.         {!!componentStack && (
    
  44.           <div className={styles.TimeoutStack}>
    
  45.             The timeout occurred {componentStack.trim()}
    
  46.           </div>
    
  47.         )}
    
  48.       </div>
    
  49.     </div>
    
  50.   );
    
  51. }