|
@@ -1,16 +1,19 @@
|
|
|
+import {Fragment} from 'react';
|
|
|
import styled from '@emotion/styled';
|
|
|
|
|
|
import emptyStateImg from 'sentry-images/spot/replays-empty-state.svg';
|
|
|
|
|
|
+import Feature from 'sentry/components/acl/feature';
|
|
|
+import {Button} from 'sentry/components/button';
|
|
|
import ButtonBar from 'sentry/components/buttonBar';
|
|
|
+import HookOrDefault from 'sentry/components/hookOrDefault';
|
|
|
import OnboardingPanel from 'sentry/components/onboardingPanel';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import PreferencesStore from 'sentry/stores/preferencesStore';
|
|
|
import {useLegacyStore} from 'sentry/stores/useLegacyStore';
|
|
|
+import {useReplayOnboardingSidebarPanel} from 'sentry/utils/replays/hooks/useReplayOnboarding';
|
|
|
+import useOrganization from 'sentry/utils/useOrganization';
|
|
|
|
|
|
-interface Props {
|
|
|
- children?: React.ReactNode;
|
|
|
-}
|
|
|
type Breakpoints = {
|
|
|
large: string;
|
|
|
medium: string;
|
|
@@ -18,7 +21,12 @@ type Breakpoints = {
|
|
|
xlarge: string;
|
|
|
};
|
|
|
|
|
|
-export default function ReplayOnboardingPanel(props: Props) {
|
|
|
+const OnboardingCTAHook = HookOrDefault({
|
|
|
+ hookName: 'component:replay-onboarding-cta',
|
|
|
+ defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
|
|
|
+});
|
|
|
+
|
|
|
+export default function ReplayOnboardingPanel() {
|
|
|
const preferences = useLegacyStore(PreferencesStore);
|
|
|
|
|
|
const breakpoints = preferences.collapsed
|
|
@@ -35,16 +43,46 @@ export default function ReplayOnboardingPanel(props: Props) {
|
|
|
xlarge: '1450px',
|
|
|
};
|
|
|
|
|
|
+ const organization = useOrganization();
|
|
|
+
|
|
|
return (
|
|
|
<OnboardingPanel image={<HeroImage src={emptyStateImg} breakpoints={breakpoints} />}>
|
|
|
+ <Feature
|
|
|
+ features={['session-replay-ga']}
|
|
|
+ organization={organization}
|
|
|
+ renderDisabled={() => <SetupReplaysCTA />}
|
|
|
+ >
|
|
|
+ <OnboardingCTAHook organization={organization}>
|
|
|
+ <SetupReplaysCTA />
|
|
|
+ </OnboardingCTAHook>
|
|
|
+ </Feature>
|
|
|
+ </OnboardingPanel>
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+function SetupReplaysCTA() {
|
|
|
+ const {activateSidebar} = useReplayOnboardingSidebarPanel();
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Fragment>
|
|
|
<h3>{t('Get to the root cause faster')}</h3>
|
|
|
<p>
|
|
|
{t(
|
|
|
'See a video-like reproduction of your user sessions so you can see what happened before, during, and after an error or latency issue occurred.'
|
|
|
)}
|
|
|
</p>
|
|
|
- <ButtonList gap={1}>{props.children}</ButtonList>
|
|
|
- </OnboardingPanel>
|
|
|
+ <ButtonList gap={1}>
|
|
|
+ <Button onClick={activateSidebar} priority="primary">
|
|
|
+ {t('Set Up Replays')}
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ href="https://docs.sentry.io/platforms/javascript/session-replay/"
|
|
|
+ external
|
|
|
+ >
|
|
|
+ {t('Read Docs')}
|
|
|
+ </Button>
|
|
|
+ </ButtonList>
|
|
|
+ </Fragment>
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -79,6 +117,7 @@ const HeroImage = styled('img')<{breakpoints: Breakpoints}>`
|
|
|
min-width: 420px;
|
|
|
}
|
|
|
`;
|
|
|
+
|
|
|
const ButtonList = styled(ButtonBar)`
|
|
|
grid-template-columns: repeat(auto-fit, minmax(130px, max-content));
|
|
|
`;
|