import { ChevronRight } from 'lucide-react' import { useMemo, useState } from 'react' import type { UseFormReturn } from 'react-hook-form' import { Collapsible, CollapsibleContent, CollapsibleTrigger, FormField, Switch } from 'ui' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { DASHBOARD_LOG_CATEGORIES } from './dashboard-logs' import type { SupportFormValues } from './SupportForm.schema' interface DashboardLogsToggleProps { form: UseFormReturn sanitizedLog: unknown[] align?: 'left' | 'right' className?: string } export function DashboardLogsToggle({ form, sanitizedLog, align = 'left', className, }: DashboardLogsToggleProps) { const sanitizedLogJson = useMemo(() => JSON.stringify(sanitizedLog, null, 2), [sanitizedLog]) const [isPreviewOpen, setIsPreviewOpen] = useState(false) if (!DASHBOARD_LOG_CATEGORIES.includes(form.getValues('category'))) return return ( ( Include dashboard activity log } description={
Share sanitized logs of recent dashboard actions to help reproduce the issue. Preview log
                    {sanitizedLogJson}
                  
} >
)} /> ) }