Skip to content

Commit

Permalink
feat: change time based feedback to button (#6837)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus authored Apr 15, 2024
1 parent e10ad72 commit 9aee1a7
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type ReactNode, type VFC, useState } from 'react';
import {
Box,
Button,
IconButton,
Tooltip,
useMediaQuery,
Expand All @@ -22,6 +23,8 @@ import { CREATE_FEATURE } from 'component/providers/AccessProvider/permissions';
import { ExportDialog } from 'component/feature/FeatureToggleList/ExportDialog';
import type { FeatureSchema } from 'openapi';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import ReviewsOutlined from '@mui/icons-material/ReviewsOutlined';
import { useFeedback } from '../../../../feedbackNew/useFeedback';

interface IProjectFeatureTogglesHeaderProps {
isLoading?: boolean;
Expand Down Expand Up @@ -56,6 +59,10 @@ export const ProjectFeatureTogglesHeader: VFC<
const [showExportDialog, setShowExportDialog] = useState(false);
const navigate = useNavigate();
const { trackEvent } = usePlausibleTracker();
const projectOverviewRefactorFeedback = useUiFlag(
'projectOverviewRefactorFeedback',
);
const { openFeedback } = useFeedback('newProjectOverview', 'automatic');
const handleSearch = (query: string) => {
onChangeSearchQuery?.(query);
trackEvent('search-bar', {
Expand All @@ -66,6 +73,16 @@ export const ProjectFeatureTogglesHeader: VFC<
});
};

const createFeedbackContext = () => {
openFeedback({
title: 'How easy was it to work with the project overview in Unleash?',
positiveLabel:
'What do you like most about the updated project overview?',
areasForImprovementsLabel:
'What improvements are needed in the project overview?',
});
};

return (
<Box
ref={headerLoadingRef}
Expand Down Expand Up @@ -145,6 +162,22 @@ export const ProjectFeatureTogglesHeader: VFC<
</>
}
/>
<ConditionallyRender
condition={
projectOverviewRefactorFeedback &&
!isSmallScreen
}
show={
<Button
startIcon={<ReviewsOutlined />}
onClick={createFeedbackContext}
variant='outlined'
data-loading
>
Provide feedback
</Button>
}
/>
<StyledResponsiveButton
onClick={() =>
navigate(getCreateTogglePath(projectId))
Expand Down

0 comments on commit 9aee1a7

Please sign in to comment.