0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 21:49:51 +01:00

fix: Make error contact point to support modal (#24048)

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: MarconLP <13001502+MarconLP@users.noreply.github.com>
Co-authored-by: Thomas Obermüller <thomas.obermueller@gmail.com>
This commit is contained in:
Joe Martin 2024-07-31 10:31:11 +01:00 committed by GitHub
parent 5e9739c4ec
commit 5e837f4385
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,12 +1,13 @@
import './ErrorBoundary.scss'
import { IconChevronDown } from '@posthog/icons'
import { ErrorBoundary as SentryErrorBoundary, getCurrentHub } from '@sentry/react'
import { HelpButton } from 'lib/components/HelpButton/HelpButton'
import { useActions } from 'kea'
import { supportLogic } from 'lib/components/Support/supportLogic'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
export function ErrorBoundary({ children }: { children?: React.ReactNode }): JSX.Element {
const isSentryInitialized = !!getCurrentHub().getClient()
const { openSupportForm } = useActions(supportLogic)
return (
<SentryErrorBoundary
@ -28,15 +29,16 @@ export function ErrorBoundary({ children }: { children?: React.ReactNode }): JSX
{isSentryInitialized && eventId?.match(/[^0]/)
? `We've registered this event for analysis (ID ${eventId}), but feel free to contact us directly too.`
: 'Please help us resolve the issue by sending a screenshot of this message.'}
<HelpButton
customComponent={
<LemonButton type="primary" sideIcon={<IconChevronDown />}>
Contact PostHog
</LemonButton>
}
customKey="error-boundary"
contactOnly
/>
<LemonButton
type="primary"
fullWidth
center
onClick={() => openSupportForm({ kind: 'bug', isEmailFormOpen: true })}
targetBlank
className="mt-2"
>
Email an engineer
</LemonButton>
</>
</div>
)}