| 47 | } |
| 48 | |
| 49 | export default class ErrorBoundary extends React.PureComponent { |
| 50 | constructor (props) { |
| 51 | super(props) |
| 52 | this.state = { |
| 53 | hasError: false, |
| 54 | error: {} |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | componentDidCatch (error) { |
| 59 | console.error(error) |
| 60 | this.setState({ |
| 61 | hasError: true, |
| 62 | error |
| 63 | }) |
| 64 | } |
| 65 | |
| 66 | handleReload = () => { |
| 67 | window.location.reload() |
| 68 | } |
| 69 | |
| 70 | renderIconCopy = (cmd) => { |
| 71 | return ( |
| 72 | <CopyOutlined |
| 73 | className='mg2l pointer' |
| 74 | onClick={() => copy(cmd)} |
| 75 | /> |
| 76 | ) |
| 77 | } |
| 78 | |
| 79 | renderTroubleShoot = () => { |
| 80 | if (window.et.isWebApp) { |
| 81 | return this.renderContacts() |
| 82 | } |
| 83 | return ( |
| 84 | <div className='pd1y wordbreak'> |
| 85 | <h2>{e('troubleShoot')}</h2> |
| 86 | <p>Electerm Version: {packInfo.version}, OS: {os}</p> |
| 87 | { |
| 88 | Object.keys(troubleshootContent).map((k, i) => { |
| 89 | const v = troubleshootContent[k] |
| 90 | const cmd = v[os] |
| 91 | return ( |
| 92 | <div className='pd1b' key={k}> |
| 93 | <h3>{e(k)} {this.renderIconCopy(cmd)}</h3> |
| 94 | <p><code>{cmd}</code></p> |
| 95 | </div> |
| 96 | ) |
| 97 | }) |
| 98 | } |
| 99 | {this.renderContacts()} |
| 100 | </div> |
| 101 | ) |
| 102 | } |
| 103 | |
| 104 | renderContacts () { |
| 105 | const { |
| 106 | bugs: { |
nothing calls this directly
no test coverage detected