From 4f7f8e7a83bc9971b727a66056d6f173fa9faedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 17 May 2026 14:26:57 +0200 Subject: [PATCH] fix(targets): gate TargetCard coach CTA on global Coach flag Read useFeatureFlags() inside TargetCard and pair the existing aiEnabled guard with flags.coach so the per-card Coach CTA hides entirely when the operator disables the Coach feature globally. Pre-fix the CTA mounted whenever the user-level provider chain was configured, even when the operator-level kill-switch was off; the disable cascade is supposed to make every Coach surface disappear, not just the hero-strip button. Sister sites (hero-strip, suggested-prompts, /targets CoachDrawer) belong to W5. --- src/components/targets/target-card.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/targets/target-card.tsx b/src/components/targets/target-card.tsx index 0fc95d97f..64f3a4cc0 100644 --- a/src/components/targets/target-card.tsx +++ b/src/components/targets/target-card.tsx @@ -28,6 +28,7 @@ import { } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; import { useTranslations } from "@/lib/i18n/context"; +import { useFeatureFlags } from "@/hooks/use-feature-flags"; import { moodStabilityLabel } from "@/lib/targets/mood-stability-label"; import { ConsistencyStrip } from "./consistency-strip"; import { RangeBar } from "./range-bar"; @@ -343,6 +344,13 @@ export function TargetCard({ sourceLink, }: TargetCardProps) { const { t, locale } = useTranslations(); + // v1.4.37 W4a item 9 — when the operator disables the Coach + // feature flag globally, every per-card "Ask the coach" CTA must + // disappear (not greyed-out, not a placeholder). The card's + // existing `aiEnabled` gate guards on the user-level provider + // chain; this flag guards on the operator-level feature switch. + // Both must be ON for the CTA to mount. + const flags = useFeatureFlags(); // v1.4.25 W3f — per-card edit affordance. Cog top-right of every // card opens the edit dialog; the dialog handles the read-only path @@ -668,7 +676,7 @@ export function TargetCard({ source link right. `mt-auto` pins to card bottom so grid cells align. */}
- {aiEnabled && ( + {aiEnabled && flags.coach && (