An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Retire related_q_style_v2 A/B; render follow-ups as inline link (#897)
Yoshiki Miura05c0547cd3d5
diff --git a/lib/render/components/button.tsx b/lib/render/components/button.tsxindex c218547c..1e28d55a 100644--- a/lib/render/components/button.tsx+++ b/lib/render/components/button.tsx@@ -1,21 +1,13 @@'use client'-import { useSyncExternalStore } from 'react'-import type { ComponentFn } from '@json-render/react'-import {- isFeatureEnabled,- subscribeFeatureFlags-} from '@/lib/analytics/posthog-client'import { cn } from '@/lib/utils'import { Button as UIButton } from '@/components/ui/button'import { type CatalogType, iconMap } from './shared'-const STYLE_FLAG = 'related_q_style_v2'-/*** Generic button spec component. Renders the project's shadcn Button and* emits a `press` action on click. Use variant="link" with an arrow icon@@ -26,33 +18,18 @@ export const Button: ComponentFn<CatalogType, 'Button'> = ({ props, on }) => {const Icon = icon ? iconMap[icon] : nullconst handle = on('press')- // Follow-up suggestions render as link buttons. A/B their style via the- // `related_q_style_v2` flag: control = inline muted link, test = pill/chip.- // useSyncExternalStore keeps SSR on the control path (no hydration mismatch)- // and re-renders once flags load.- const isFollowup = variant === 'link'- const flagOn = useSyncExternalStore(- subscribeFeatureFlags,- () => isFeatureEnabled(STYLE_FLAG),- () => false- )- const chip = isFollowup && flagOn-- // Control link: muted color, left-aligned, wrappable text, zero padding.+ // Follow-up suggestions render as inline muted links: left-aligned,+ // wrappable text, zero padding.const linkOverride =- isFollowup && !chip+ variant === 'link'? 'h-auto w-fit justify-start whitespace-normal text-left px-0 py-0.5 font-semibold text-accent-foreground/50 hover:text-accent-foreground/70': ''- // Test chip: bordered pill with higher contrast for a stronger tap affordance.- const chipOverride = chip- ? 'h-auto w-fit whitespace-normal rounded-full border px-3 py-1.5 text-left text-sm font-medium text-accent-foreground/80 hover:bg-muted hover:text-accent-foreground'- : ''return (<UIButton- variant={chip ? 'outline' : variant}+ variant={variant}onClick={handle.emit}- className={cn('gap-2', linkOverride, chipOverride)}+ className={cn('gap-2', linkOverride)}>{Icon && <Icon className="size-4 shrink-0" />}{text}