Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(issues): Move replay CTA into link, fix back button #82850

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions static/app/components/events/eventReplay/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {lazy, useEffect} from 'react';
import {lazy} from 'react';

import ErrorBoundary from 'sentry/components/errorBoundary';
import {ReplayClipSection} from 'sentry/components/events/eventReplay/replayClipSection';
Expand All @@ -8,7 +8,6 @@ import type {Group} from 'sentry/types/group';
import useEventCanShowReplayUpsell from 'sentry/utils/event/useEventCanShowReplayUpsell';
import {getReplayIdFromEvent} from 'sentry/utils/replays/getReplayIdFromEvent';
import {useHaveSelectedProjectsSentAnyReplayEvents} from 'sentry/utils/replays/hooks/useReplayOnboarding';
import useUrlParams from 'sentry/utils/useUrlParams';
import {useIsSampleEvent} from 'sentry/views/issueDetails/utils';

interface Props {
Expand All @@ -29,14 +28,6 @@ export default function EventReplay({event, group, projectSlug}: Props) {
});
const isSampleError = useIsSampleEvent();

const {setParamValue: setProjectId} = useUrlParams('project');

useEffect(() => {
if (canShowUpsell) {
setProjectId(upsellProjectId);
}
}, [upsellProjectId, setProjectId, canShowUpsell]);

if (replayId) {
return <ReplayClipSection event={event} replayId={replayId} group={group} />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ export default function ReplayInlineOnboardingPanel({
</BannerDescription>
<ActionButton>
<Button
type="button"
analyticsEventName="Clicked Replay Onboarding CTA Set Up Button in Issue Details"
analyticsEventKey="issue_details.replay-onboarding-cta-set-up-button-clicked"
analyticsParams={{platform}}
onClick={activateSidebar}
onClick={() => activateSidebar(projectId)}
>
{t('Set Up Now')}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ export default function ReplayInlineCTAPanel() {
button={
<ButtonBar gap={1}>
<Button
type="button"
priority="primary"
analyticsEventName="Clicked Replay Onboarding CTA Button in User Feedback"
analyticsEventKey="feedback.replay-onboarding-cta-button-clicked"
onClick={activateSidebar}
onClick={() => activateSidebar()}
>
{t('Set Up Now')}
</Button>
Expand Down
23 changes: 18 additions & 5 deletions static/app/utils/replays/hooks/useReplayOnboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import SidebarPanelStore from 'sentry/stores/sidebarPanelStore';
import {trackAnalytics} from 'sentry/utils/analytics';
import useSelectedProjectsHaveField from 'sentry/utils/project/useSelectedProjectsHaveField';
import {useLocation} from 'sentry/utils/useLocation';
import {useNavigate} from 'sentry/utils/useNavigate';
import useOrganization from 'sentry/utils/useOrganization';

export function useHaveSelectedProjectsSentAnyReplayEvents() {
Expand All @@ -14,6 +15,7 @@ export function useHaveSelectedProjectsSentAnyReplayEvents() {
}

export function useReplayOnboardingSidebarPanel() {
const navigate = useNavigate();
const location = useLocation();
const organization = useOrganization();

Expand All @@ -26,11 +28,22 @@ export function useReplayOnboardingSidebarPanel() {
}
}, [location.hash, organization]);

const activateSidebar = useCallback((event: {preventDefault: () => void}) => {
event.preventDefault();
window.location.hash = 'replay-sidequest';
SidebarPanelStore.activatePanel(SidebarPanelKey.REPLAYS_ONBOARDING);
}, []);
const activateSidebar = useCallback(
(projectId?: string) => {
navigate({
...location,
hash: 'replay-sidequest',
query: projectId
? {
...location.query,
project: projectId,
}
: location.query,
});
SidebarPanelStore.activatePanel(SidebarPanelKey.REPLAYS_ONBOARDING);
},
[location, navigate]
);

return {activateSidebar};
}
3 changes: 2 additions & 1 deletion static/app/views/replays/list/replayOnboardingPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ export function SetupReplaysCTA({
>
<Button
data-test-id="setup-replays-btn"
onClick={activateSidebar}
type="button"
onClick={() => activateSidebar()}
priority="primary"
disabled={disabled}
>
Expand Down
Loading