Skip to content
Open
Show file tree
Hide file tree
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
16 changes: 15 additions & 1 deletion packages/shared/src/components/cards/common/ClickbaitShield.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useViewSize,
ViewSize,
useClickbaitTries,
useConditionalFeature,
} from '../../../hooks';
import { useLazyModal } from '../../../hooks/useLazyModal';
import { LazyModal } from '../../modals/common/types';
Expand All @@ -17,8 +18,13 @@ import { FeedSettingsMenu } from '../../feeds/FeedSettings/types';
import { useAuthContext } from '../../../contexts/AuthContext';
import { webappUrl } from '../../../lib/constants';
import { Tooltip } from '../../tooltip/Tooltip';
import { featureFeedClickbaitShieldWarning } from '../../../lib/featureManagement';

export const ClickbaitShield = ({ post }: { post: Post }): ReactElement => {
export const ClickbaitShield = ({
post,
}: {
post: Post;
}): ReactElement | null => {
const { openModal } = useLazyModal();
const { isPlus } = usePlusSubscription();
const { fetchSmartTitle, fetchedSmartTitle, shieldActive } =
Expand All @@ -27,8 +33,16 @@ export const ClickbaitShield = ({ post }: { post: Post }): ReactElement => {
const router = useRouter();
const { user } = useAuthContext();
const { hasUsedFreeTrial, triesLeft } = useClickbaitTries();
const { value: showWarningShield } = useConditionalFeature({
feature: featureFeedClickbaitShieldWarning,
shouldEvaluate: !isPlus,
});

if (!isPlus) {
if (!fetchedSmartTitle && !showWarningShield) {
return null;
}

return (
<Tooltip
className="max-w-70 text-center !typo-subhead"
Expand Down
5 changes: 5 additions & 0 deletions packages/shared/src/lib/featureManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ export const featureReadingReminderHeroCopy = new Feature(

export const clickbaitTriesMax = new Feature('clickbait_tries_max', 5);

export const featureFeedClickbaitShieldWarning = new Feature(
'feed_clickbait_shield_warning',
true,
);

export { feature };

export const featureCores = new Feature('cores', isDevelopment);
Expand Down
Loading