mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: insights feedback (#6345)
This commit is contained in:
		
							parent
							
								
									20a9e1d725
								
							
						
					
					
						commit
						6cefe71534
					
				| @ -0,0 +1,52 @@ | |||||||
|  | import { VFC } from 'react'; | ||||||
|  | import { useUiFlag } from 'hooks/useUiFlag'; | ||||||
|  | import { useFeedback } from 'component/feedbackNew/useFeedback'; | ||||||
|  | import { ReviewsOutlined } from '@mui/icons-material'; | ||||||
|  | import { Badge, Button, Typography } from '@mui/material'; | ||||||
|  | import { PageHeader } from 'component/common/PageHeader/PageHeader'; | ||||||
|  | 
 | ||||||
|  | export const DashboardHeader: VFC = () => { | ||||||
|  |     const showInactiveUsers = useUiFlag('showInactiveUsers'); | ||||||
|  | 
 | ||||||
|  |     const { openFeedback } = useFeedback( | ||||||
|  |         'insights', | ||||||
|  |         'automatic', | ||||||
|  |         showInactiveUsers ? 'withInactiveUsers' : 'withoutInactiveUsers', | ||||||
|  |     ); | ||||||
|  | 
 | ||||||
|  |     const createFeedbackContext = () => { | ||||||
|  |         openFeedback({ | ||||||
|  |             title: 'How easy was it to use insights?', | ||||||
|  |             positiveLabel: 'What do you like most about insights?', | ||||||
|  |             areasForImprovementsLabel: 'What should be improved in insights?', | ||||||
|  |         }); | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     return ( | ||||||
|  |         <PageHeader | ||||||
|  |             titleElement={ | ||||||
|  |                 <Typography | ||||||
|  |                     variant='h1' | ||||||
|  |                     component='div' | ||||||
|  |                     sx={(theme) => ({ | ||||||
|  |                         display: 'flex', | ||||||
|  |                         alignItems: 'center', | ||||||
|  |                         gap: theme.spacing(1), | ||||||
|  |                     })} | ||||||
|  |                 > | ||||||
|  |                     <span>Insights</span> <Badge color='warning'>Beta</Badge> | ||||||
|  |                 </Typography> | ||||||
|  |             } | ||||||
|  |             actions={ | ||||||
|  |                 <Button | ||||||
|  |                     startIcon={<ReviewsOutlined />} | ||||||
|  |                     variant='outlined' | ||||||
|  |                     onClick={createFeedbackContext} | ||||||
|  |                     size='small' | ||||||
|  |                 > | ||||||
|  |                     Provide feedback | ||||||
|  |                 </Button> | ||||||
|  |             } | ||||||
|  |         /> | ||||||
|  |     ); | ||||||
|  | }; | ||||||
| @ -25,6 +25,7 @@ import { | |||||||
| } from 'openapi'; | } from 'openapi'; | ||||||
| import { HealthStats } from './HealthStats/HealthStats'; | import { HealthStats } from './HealthStats/HealthStats'; | ||||||
| import { Badge } from 'component/common/Badge/Badge'; | import { Badge } from 'component/common/Badge/Badge'; | ||||||
|  | import { DashboardHeader } from './DashboardHeader/DashboardHeader'; | ||||||
| 
 | 
 | ||||||
| const StyledGrid = styled(Box)(({ theme }) => ({ | const StyledGrid = styled(Box)(({ theme }) => ({ | ||||||
|     display: 'grid', |     display: 'grid', | ||||||
| @ -127,22 +128,7 @@ export const ExecutiveDashboard: VFC = () => { | |||||||
|     return ( |     return ( | ||||||
|         <> |         <> | ||||||
|             <Box sx={(theme) => ({ paddingBottom: theme.spacing(4) })}> |             <Box sx={(theme) => ({ paddingBottom: theme.spacing(4) })}> | ||||||
|                 <PageHeader |                 <DashboardHeader /> | ||||||
|                     titleElement={ |  | ||||||
|                         <Typography |  | ||||||
|                             variant='h1' |  | ||||||
|                             component='div' |  | ||||||
|                             sx={(theme) => ({ |  | ||||||
|                                 display: 'flex', |  | ||||||
|                                 alignItems: 'center', |  | ||||||
|                                 gap: theme.spacing(1), |  | ||||||
|                             })} |  | ||||||
|                         > |  | ||||||
|                             <span>Insights</span>{' '} |  | ||||||
|                             <Badge color='warning'>Beta</Badge> |  | ||||||
|                         </Typography> |  | ||||||
|                     } |  | ||||||
|                 /> |  | ||||||
|             </Box> |             </Box> | ||||||
|             <StyledGrid sx={{ gridTemplateColumns }}> |             <StyledGrid sx={{ gridTemplateColumns }}> | ||||||
|                 <Widget title='Total users' order={1}> |                 <Widget title='Total users' order={1}> | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| import { createLocalStorage } from '../utils/createLocalStorage'; | import { createLocalStorage } from '../utils/createLocalStorage'; | ||||||
| 
 | 
 | ||||||
| export type IFeedbackCategory = 'search' | 'newStrategyForm'; | export type IFeedbackCategory = 'search' | 'newStrategyForm' | 'insights'; | ||||||
| 
 | 
 | ||||||
| export const useUserSubmittedFeedback = (category: IFeedbackCategory) => { | export const useUserSubmittedFeedback = (category: IFeedbackCategory) => { | ||||||
|     const key = `unleash-userSubmittedFeedback:${category}`; |     const key = `unleash-userSubmittedFeedback:${category}`; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user