Skip to content

Commit

Permalink
feat: remove archive tooltip conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Nov 8, 2024
1 parent ddc8bc6 commit 7cee449
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion frontend/src/component/filter/AddFilterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
import useSplashApi from 'hooks/api/actions/useSplashApi/useSplashApi';
import { useAuthSplash } from 'hooks/api/getters/useAuth/useAuthSplash';
import { useOptionalPathParam } from 'hooks/useOptionalPathParam';
import { useAuthUser } from '../../hooks/api/getters/useAuth/useAuthUser';

const StyledButton = styled(Button)(({ theme }) => ({
padding: theme.spacing(0, 1.25, 0, 1.25),
Expand Down Expand Up @@ -49,6 +50,7 @@ export const AddFilterButton = ({
}: IAddFilterButtonProps) => {
const projectId = useOptionalPathParam('projectId');
const simplifyProjectOverview = useUiFlag('simplifyProjectOverview');
const { user } = useAuthUser();
const { setSplashSeen } = useSplashApi();
const { splash } = useAuthSplash();

Expand All @@ -73,6 +75,15 @@ export const AddFilterButton = ({
handleClose();
};

const isOldCustomer = (createdAt: string | undefined) => {
if (!createdAt) return false;
const cutoffDate = new Date('2024-11-08T00:00:00.000Z');
return new Date(createdAt) < cutoffDate;
};

const showArchiveTooltip =
simplifyProjectOverview && projectId && isOldCustomer(user?.createdAt);

const ArchiveTooltip = () => {
return (
<Box>
Expand All @@ -97,7 +108,7 @@ export const AddFilterButton = ({
};
return (
<div>
{simplifyProjectOverview && projectId ? (
{showArchiveTooltip ? (
<HtmlTooltip
placement='right'
arrow
Expand Down

0 comments on commit 7cee449

Please sign in to comment.