1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

feat: insights feedback (#6345)

This commit is contained in:
Tymoteusz Czech 2024-02-27 13:12:18 +01:00 committed by GitHub
parent 20a9e1d725
commit 6cefe71534
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 55 additions and 17 deletions

View File

@ -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>
}
/>
);
};

View File

@ -25,6 +25,7 @@ import {
} from 'openapi';
import { HealthStats } from './HealthStats/HealthStats';
import { Badge } from 'component/common/Badge/Badge';
import { DashboardHeader } from './DashboardHeader/DashboardHeader';
const StyledGrid = styled(Box)(({ theme }) => ({
display: 'grid',
@ -127,22 +128,7 @@ export const ExecutiveDashboard: VFC = () => {
return (
<>
<Box sx={(theme) => ({ paddingBottom: theme.spacing(4) })}>
<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>
}
/>
<DashboardHeader />
</Box>
<StyledGrid sx={{ gridTemplateColumns }}>
<Widget title='Total users' order={1}>

View File

@ -1,6 +1,6 @@
import { createLocalStorage } from '../utils/createLocalStorage';
export type IFeedbackCategory = 'search' | 'newStrategyForm';
export type IFeedbackCategory = 'search' | 'newStrategyForm' | 'insights';
export const useUserSubmittedFeedback = (category: IFeedbackCategory) => {
const key = `unleash-userSubmittedFeedback:${category}`;