@@ -10,6 +10,7 @@ import {CompactSelect} from 'sentry/components/compactSelect';
10
10
import { FeedbackOnboardingLayout } from 'sentry/components/feedback/feedbackOnboarding/feedbackOnboardingLayout' ;
11
11
import { CRASH_REPORT_HASH } from 'sentry/components/feedback/useFeedbackOnboarding' ;
12
12
import RadioGroup from 'sentry/components/forms/controls/radioGroup' ;
13
+ import useDrawer from 'sentry/components/globalDrawer' ;
13
14
import IdBadge from 'sentry/components/idBadge' ;
14
15
import LoadingIndicator from 'sentry/components/loadingIndicator' ;
15
16
import { FeedbackOnboardingWebApiBanner } from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding' ;
@@ -32,6 +33,8 @@ import {
32
33
} from 'sentry/data/platformCategories' ;
33
34
import platforms , { otherPlatform } from 'sentry/data/platforms' ;
34
35
import { t , tct } from 'sentry/locale' ;
36
+ import SidebarPanelStore from 'sentry/stores/sidebarPanelStore' ;
37
+ import { useLegacyStore } from 'sentry/stores/useLegacyStore' ;
35
38
import { space } from 'sentry/styles/space' ;
36
39
import type { SelectValue } from 'sentry/types/core' ;
37
40
import type { PlatformKey , Project } from 'sentry/types/project' ;
@@ -40,20 +43,69 @@ import {useLocation} from 'sentry/utils/useLocation';
40
43
import useOrganization from 'sentry/utils/useOrganization' ;
41
44
import useUrlParams from 'sentry/utils/useUrlParams' ;
42
45
43
- function FeedbackOnboardingSidebar ( props : CommonSidebarProps ) {
46
+ export function useFeedbackOnboardingDrawer ( ) {
47
+ const organization = useOrganization ( ) ;
48
+ const currentPanel = useLegacyStore ( SidebarPanelStore ) ;
49
+ const isActive = currentPanel === SidebarPanelKey . FEEDBACK_ONBOARDING ;
50
+ const hasProjectAccess = organization . access . includes ( 'project:read' ) ;
51
+
52
+ const { openDrawer} = useDrawer ( ) ;
53
+
54
+ useEffect ( ( ) => {
55
+ if ( isActive && hasProjectAccess ) {
56
+ openDrawer ( ( ) => < SidebarContent /> , {
57
+ ariaLabel : t ( 'Getting Started with User Feedback' ) ,
58
+ onClose : ( ) => {
59
+ SidebarPanelStore . hidePanel ( ) ;
60
+ } ,
61
+ } ) ;
62
+ }
63
+ } , [ isActive , hasProjectAccess , openDrawer ] ) ;
64
+ }
65
+
66
+ // Used by legacy navigation
67
+ function LegacyFeedbackOnboardingSidebar ( props : CommonSidebarProps ) {
44
68
const { currentPanel, collapsed, hidePanel, orientation} = props ;
45
69
const organization = useOrganization ( ) ;
46
70
47
71
const isActive = currentPanel === SidebarPanelKey . FEEDBACK_ONBOARDING ;
48
72
const hasProjectAccess = organization . access . includes ( 'project:read' ) ;
49
73
74
+ if ( ! isActive || ! hasProjectAccess ) {
75
+ return null ;
76
+ }
77
+
78
+ return (
79
+ < TaskSidebarPanel
80
+ orientation = { orientation }
81
+ collapsed = { collapsed }
82
+ hidePanel = { hidePanel }
83
+ >
84
+ < SidebarContent />
85
+ </ TaskSidebarPanel >
86
+ ) ;
87
+ }
88
+
89
+ function SidebarContent ( ) {
90
+ const organization = useOrganization ( ) ;
91
+
50
92
const { allProjects, currentProject, setCurrentProject} = useCurrentProjectState ( {
51
- currentPanel,
93
+ currentPanel : SidebarPanelKey . FEEDBACK_ONBOARDING ,
52
94
targetPanel : SidebarPanelKey . FEEDBACK_ONBOARDING ,
53
95
onboardingPlatforms : feedbackOnboardingPlatforms ,
54
96
allPlatforms : feedbackOnboardingPlatforms ,
55
97
} ) ;
56
98
99
+ useEffect ( ( ) => {
100
+ // this tracks clicks from any source: feedback index, issue details feedback tab, banner callout, etc
101
+ if ( currentProject ) {
102
+ trackAnalytics ( 'feedback.list-view-setup-sidebar' , {
103
+ organization,
104
+ platform : currentProject ?. platform ?? 'unknown' ,
105
+ } ) ;
106
+ }
107
+ } , [ currentProject , organization , setCurrentProject ] ) ;
108
+
57
109
const projectSelectOptions = useMemo ( ( ) => {
58
110
const supportedProjectItems : Array < SelectValue < string > > = allProjects
59
111
. sort ( ( aProject , bProject ) => {
@@ -82,26 +134,12 @@ function FeedbackOnboardingSidebar(props: CommonSidebarProps) {
82
134
] ;
83
135
} , [ allProjects ] ) ;
84
136
85
- useEffect ( ( ) => {
86
- if ( isActive && currentProject && hasProjectAccess ) {
87
- // this tracks clicks from any source: feedback index, issue details feedback tab, banner callout, etc
88
- trackAnalytics ( 'feedback.list-view-setup-sidebar' , {
89
- organization,
90
- platform : currentProject ?. platform ?? 'unknown' ,
91
- } ) ;
92
- }
93
- } , [ organization , currentProject , isActive , hasProjectAccess ] ) ;
94
-
95
- if ( ! isActive || ! hasProjectAccess || ! currentProject ) {
137
+ if ( ! currentProject ) {
96
138
return null ;
97
139
}
98
140
99
141
return (
100
- < TaskSidebarPanel
101
- orientation = { orientation }
102
- collapsed = { collapsed }
103
- hidePanel = { hidePanel }
104
- >
142
+ < Fragment >
105
143
< TopRightBackgroundImage src = { HighlightTopRightPattern } />
106
144
< TaskList >
107
145
< Heading > { t ( 'Getting Started with User Feedback' ) } </ Heading >
@@ -140,7 +178,7 @@ function FeedbackOnboardingSidebar(props: CommonSidebarProps) {
140
178
</ HeaderActions >
141
179
< OnboardingContent currentProject = { currentProject } />
142
180
</ TaskList >
143
- </ TaskSidebarPanel >
181
+ </ Fragment >
144
182
) ;
145
183
}
146
184
@@ -417,4 +455,4 @@ const StyledRadioGroup = styled(RadioGroup)`
417
455
padding: ${ space ( 1 ) } 0;
418
456
` ;
419
457
420
- export default FeedbackOnboardingSidebar ;
458
+ export default LegacyFeedbackOnboardingSidebar ;
0 commit comments