Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove archive tooltip conditionally #8702

Merged
merged 4 commits into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading