Skip to content

Commit

Permalink
feat: remove archive tooltip conditionally (#8702)
Browse files Browse the repository at this point in the history
The archived functionality has been moved into the feature list, and we
are showing a tooltip. However, it doesn’t make sense to display it to
new customers, as they wouldn’t be familiar with the previous behavior.

I've introduced a "new/old user" classification, where I’m setting
08.11.2024 as the dividing line. All customers created after 08.11.2024
will be considered new, and we won’t display the tooltip for them.
Everyone else will be treated as old customers.

This approach means there will be a brief period from 08.11.2024 until
the release date where any customers created during this time will be
categorized as new, even if they still have access to the old archive.
For simplicity, I’m willing to accept this risk, as it's likely that in
95% of cases, for those few customers (0–10), they won’t need the
archive functionality immediately, so it’s acceptable not to display the
tooltip for them.

This setup is temporary in our code base and will be removed with a
feature flag.
  • Loading branch information
sjaanus authored Nov 8, 2024
1 parent 9615015 commit da805f2
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 da805f2

Please sign in to comment.