mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
fix(coach): gate SuggestedPrompts chips on the global Coach flag
Every chip in <SuggestedPrompts> is a Coach affordance — clicking one seeds the Coach drawer's composer with the localised prompt and opens the drawer. The strip rendered unconditionally until now, so a deployment with the operator's global Coach flag off still painted five inert chips below the hero band. Read flags.coach inside the component and short-circuit when the flag is off. The HeroStrip caller already wraps the mount in the same guard (W5 commit prior); this is defence-in-depth so a future caller that mounts <SuggestedPrompts> outside the hero band can never leak a Coach surface.
This commit is contained in:
1 parent
4f7f8e7a83
commit
f88780a06c
1 file changed
+10
@@ -2,6 +2,7 @@
|
||||
|
||||
import { Quote } from "lucide-react";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import { useFeatureFlags } from "@/hooks/use-feature-flags";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/**
|
||||
@@ -47,6 +48,15 @@ export function SuggestedPrompts({
|
||||
className,
|
||||
}: SuggestedPromptsProps) {
|
||||
const { t } = useTranslations();
|
||||
// v1.4.37 W5 — every chip is a Coach affordance: clicking one seeds
|
||||
// the Coach drawer's composer and opens it. When the operator turns
|
||||
// the global Coach flag off the strip must vanish along with the
|
||||
// hero action button and the drawer mount. The HeroStrip caller
|
||||
// already guards on `flags.coach`; the in-component gate is
|
||||
// defence-in-depth so a future caller that mounts <SuggestedPrompts>
|
||||
// outside the hero band can never leak a Coach surface.
|
||||
const flags = useFeatureFlags();
|
||||
if (!flags.coach) return null;
|
||||
const items =
|
||||
prompts ??
|
||||
DEFAULT_PROMPT_KEYS.map((key) => t(`insights.suggestedPrompts.${key}`));
|
||||
|
||||
Reference in new issue
Block a user