Skip to content

Commit

Permalink
feat(feedback): Change "Report a problem" link to open feedback modal (
Browse files Browse the repository at this point in the history
…#7878)

Changes the "Report a problem" link to open feedback modal (when Sentry SDK is loaded). Otherwise will preserve previous behavior of opening link to GH issue.
  • Loading branch information
billyvg committed Sep 20, 2023
1 parent c44485b commit c7fd4c6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
28 changes: 24 additions & 4 deletions src/components/githubCta.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import React, {Fragment} from 'react';

import {FeedbackModal} from './feedback/feedbackModal';
import {SmartLink} from './smartLink';

type GitHubCTAProps = {
Expand Down Expand Up @@ -27,9 +28,28 @@ export function GitHubCTA({sourceInstanceName, relativePath}: GitHubCTAProps) {
Contribute to Docs
</SmartLink>{' '}
&nbsp;&nbsp;|&nbsp;&nbsp;
<SmartLink to="https://github.com/getsentry/sentry-docs/issues/new/choose">
Report a problem
</SmartLink>{' '}
<FeedbackModal title="Report a Problem">
{({showModal}) => (
<Fragment>
<SmartLink
to="https://github.com/getsentry/sentry-docs/issues/new/choose"
onClick={e => {
if (!window.Sentry?.getCurrentHub?.()) {
return true;
}

// Only Stop event propagation if Sentry SDK is loaded
// (i.e. feedback is supported), otherwise will send you to github
e.preventDefault();
showModal();
return false;
}}
>
Report a problem
</SmartLink>{' '}
</Fragment>
)}
</FeedbackModal>
</div>
</small>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/components/smartLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import {marketingUrlParams} from 'sentry-docs/utils';

import {ExternalLink} from './externalLink';

type Props = {
interface Props {
activeClassName?: string;
children?: React.ReactNode;
className?: string;
href?: string;
isActive?: boolean;
onClick?: (e: React.MouseEvent) => void;
remote?: boolean;
target?: string;
title?: string;
to?: string;
};
}

export function SmartLink({
to,
Expand Down

1 comment on commit c7fd4c6

@vercel
Copy link

@vercel vercel bot commented on c7fd4c6 Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev

Please sign in to comment.