mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
feat: application overview feedback (#6416)

This commit is contained in:
parent
0c9838b26a
commit
493f8e8a5b
@ -1,6 +1,6 @@
|
|||||||
import { usePageTitle } from 'hooks/usePageTitle';
|
import { usePageTitle } from 'hooks/usePageTitle';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import { Alert, Box, Divider, styled } from '@mui/material';
|
import { Alert, Box, Button, Divider, styled } from '@mui/material';
|
||||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||||
import { useApplicationOverview } from 'hooks/api/getters/useApplicationOverview/useApplicationOverview';
|
import { useApplicationOverview } from 'hooks/api/getters/useApplicationOverview/useApplicationOverview';
|
||||||
import { ApplicationIssues } from './ApplicationIssues/ApplicationIssues';
|
import { ApplicationIssues } from './ApplicationIssues/ApplicationIssues';
|
||||||
@ -10,6 +10,8 @@ import { Badge } from '../common/Badge/Badge';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
import { useFeedback } from '../feedbackNew/useFeedback';
|
||||||
|
import { ReviewsOutlined } from '@mui/icons-material';
|
||||||
|
|
||||||
const StyledDivider = styled(Divider)(({ theme }) => ({
|
const StyledDivider = styled(Divider)(({ theme }) => ({
|
||||||
marginTop: theme.spacing(2),
|
marginTop: theme.spacing(2),
|
||||||
@ -33,6 +35,12 @@ const ProjectContainer = styled(Box)(({ theme }) => ({
|
|||||||
alignSelf: 'stretch',
|
alignSelf: 'stretch',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const ApplicationHeader = styled('div')(({ theme }) => ({
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignSelf: 'stretch',
|
||||||
|
}));
|
||||||
|
|
||||||
const useTracking = () => {
|
const useTracking = () => {
|
||||||
const { trackEvent } = usePlausibleTracker();
|
const { trackEvent } = usePlausibleTracker();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -51,12 +59,25 @@ const ApplicationOverview = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { data, loading } = useApplicationOverview(applicationName);
|
const { data, loading } = useApplicationOverview(applicationName);
|
||||||
|
|
||||||
|
const { openFeedback } = useFeedback('applicationOverview', 'automatic');
|
||||||
|
|
||||||
|
const createFeedbackContext = () => {
|
||||||
|
openFeedback({
|
||||||
|
title: 'How easy was it to use the application overview page?',
|
||||||
|
positiveLabel:
|
||||||
|
'What do you like most about the new application overview page?',
|
||||||
|
areasForImprovementsLabel:
|
||||||
|
'What should be improved on the application overview page?',
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={!loading && data.environments.length === 0}
|
condition={!loading && data.environments.length === 0}
|
||||||
show={<Alert severity='warning'>No data available.</Alert>}
|
show={<Alert severity='warning'>No data available.</Alert>}
|
||||||
elseShow={
|
elseShow={
|
||||||
<ApplicationContainer>
|
<ApplicationContainer>
|
||||||
|
<ApplicationHeader>
|
||||||
<ProjectContainer>
|
<ProjectContainer>
|
||||||
Projects using this application
|
Projects using this application
|
||||||
{data.projects.map((project) => (
|
{data.projects.map((project) => (
|
||||||
@ -74,6 +95,16 @@ const ApplicationOverview = () => {
|
|||||||
</Badge>
|
</Badge>
|
||||||
))}
|
))}
|
||||||
</ProjectContainer>
|
</ProjectContainer>
|
||||||
|
<Button
|
||||||
|
startIcon={<ReviewsOutlined />}
|
||||||
|
variant='outlined'
|
||||||
|
onClick={createFeedbackContext}
|
||||||
|
size='small'
|
||||||
|
>
|
||||||
|
Provide feedback
|
||||||
|
</Button>
|
||||||
|
</ApplicationHeader>
|
||||||
|
|
||||||
<StyledDivider />
|
<StyledDivider />
|
||||||
<ApplicationIssues application={data} />
|
<ApplicationIssues application={data} />
|
||||||
<ApplicationChart data={data} />
|
<ApplicationChart data={data} />
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
import { createLocalStorage } from '../utils/createLocalStorage';
|
import { createLocalStorage } from '../utils/createLocalStorage';
|
||||||
|
|
||||||
export type IFeedbackCategory = 'search' | 'newStrategyForm' | 'insights';
|
export type IFeedbackCategory =
|
||||||
|
| 'search'
|
||||||
|
| 'newStrategyForm'
|
||||||
|
| 'insights'
|
||||||
|
| 'applicationOverview';
|
||||||
|
|
||||||
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