'use client'; import { Button } from '@/components/ui/button'; import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from '@/components/ui/card'; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'; import { cn } from '@/lib/utils'; import { ChevronsUpDownIcon } from 'lucide-react'; import type { ComponentProps } from 'react'; import { createContext, useContext } from 'react'; import { Shimmer } from './shimmer'; type PlanContextValue = { isStreaming: boolean; }; const PlanContext = createContext(null); const usePlan = () => { const context = useContext(PlanContext); if (!context) { throw new Error('Plan components must be used within Plan'); } return context; }; export type PlanProps = ComponentProps & { isStreaming?: boolean; }; export const Plan = ({ className, isStreaming = false, children, ...props }: PlanProps) => ( {children} ); export type PlanHeaderProps = ComponentProps; export const PlanHeader = ({ className, ...props }: PlanHeaderProps) => ( ); export type PlanTitleProps = Omit, 'children'> & { children: string; }; export const PlanTitle = ({ children, ...props }: PlanTitleProps) => { const { isStreaming } = usePlan(); return ( {isStreaming ? {children} : children} ); }; export type PlanDescriptionProps = Omit, 'children'> & { children: string; }; export const PlanDescription = ({ className, children, ...props }: PlanDescriptionProps) => { const { isStreaming } = usePlan(); return ( {isStreaming ? {children} : children} ); }; export type PlanActionProps = ComponentProps; export const PlanAction = (props: PlanActionProps) => ( ); export type PlanContentProps = ComponentProps; export const PlanContent = (props: PlanContentProps) => ( ); export type PlanFooterProps = ComponentProps<'div'>; export const PlanFooter = (props: PlanFooterProps) => ( ); export type PlanTriggerProps = ComponentProps; export const PlanTrigger = ({ className, ...props }: PlanTriggerProps) => ( );