import { type IconButton, Scan } from '@liam-hq/ui' import { type ComponentProps, type FC, type ReactNode, useCallback, } from 'react' import { useVersionOrThrow } from '../../../../../../providers' import { useUserEditingOrThrow } from '../../../../../../stores' import { toolbarActionLogEvent } from '../../../../../gtm/utils' import { useCustomReactflow } from '../../../../../reactflow/hooks' import { ToolbarIconButton } from '../ToolbarIconButton' type FitviewButtonProps = { children?: ReactNode size?: ComponentProps['size'] } export const FitviewButton: FC = ({ children = '', size = 'md', }) => { const { fitView } = useCustomReactflow() const { showMode } = useUserEditingOrThrow() const { version } = useVersionOrThrow() const handleClick = useCallback(() => { toolbarActionLogEvent({ element: 'fitview', showMode, platform: version.displayedOn, gitHash: version.gitHash, ver: version.version, appEnv: version.envName, }) fitView() }, [fitView, showMode, version]) return ( } > {children} ) }