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 {useContext} from 'react';
    
  12. import {SettingsContext} from './SettingsContext';
    
  13. 
    
  14. import styles from './SettingsShared.css';
    
  15. 
    
  16. export default function DebuggingSettings(_: {}): React.Node {
    
  17.   const {
    
  18.     appendComponentStack,
    
  19.     breakOnConsoleErrors,
    
  20.     hideConsoleLogsInStrictMode,
    
  21.     setAppendComponentStack,
    
  22.     setBreakOnConsoleErrors,
    
  23.     setShowInlineWarningsAndErrors,
    
  24.     showInlineWarningsAndErrors,
    
  25.     setHideConsoleLogsInStrictMode,
    
  26.   } = useContext(SettingsContext);
    
  27. 
    
  28.   return (
    
  29.     <div className={styles.Settings}>
    
  30.       <div className={styles.Setting}>
    
  31.         <label>
    
  32.           <input
    
  33.             type="checkbox"
    
  34.             checked={appendComponentStack}
    
  35.             onChange={({currentTarget}) =>
    
  36.               setAppendComponentStack(currentTarget.checked)
    
  37.             }
    
  38.           />{' '}
    
  39.           Append component stacks to console warnings and errors.
    
  40.         </label>
    
  41.       </div>
    
  42. 
    
  43.       <div className={styles.Setting}>
    
  44.         <label>
    
  45.           <input
    
  46.             type="checkbox"
    
  47.             checked={showInlineWarningsAndErrors}
    
  48.             onChange={({currentTarget}) =>
    
  49.               setShowInlineWarningsAndErrors(currentTarget.checked)
    
  50.             }
    
  51.           />{' '}
    
  52.           Show inline warnings and errors.
    
  53.         </label>
    
  54.       </div>
    
  55. 
    
  56.       <div className={styles.Setting}>
    
  57.         <label>
    
  58.           <input
    
  59.             type="checkbox"
    
  60.             checked={breakOnConsoleErrors}
    
  61.             onChange={({currentTarget}) =>
    
  62.               setBreakOnConsoleErrors(currentTarget.checked)
    
  63.             }
    
  64.           />{' '}
    
  65.           Break on warnings
    
  66.         </label>
    
  67.       </div>
    
  68. 
    
  69.       <div className={styles.Setting}>
    
  70.         <label>
    
  71.           <input
    
  72.             type="checkbox"
    
  73.             checked={hideConsoleLogsInStrictMode}
    
  74.             onChange={({currentTarget}) =>
    
  75.               setHideConsoleLogsInStrictMode(currentTarget.checked)
    
  76.             }
    
  77.           />{' '}
    
  78.           Hide logs during second render in Strict Mode
    
  79.         </label>
    
  80.       </div>
    
  81.     </div>
    
  82.   );
    
  83. }