import './ChangelogModal.styles.scss'; import { CheckOutlined, CloseOutlined } from '@ant-design/icons'; import { Button, Modal } from 'antd'; import cx from 'classnames'; import dayjs from 'dayjs'; import { ChevronsDown, ScrollText } from 'lucide-react'; import { useAppContext } from 'providers/App/App'; import { useCallback, useEffect, useRef, useState } from 'react'; import ChangelogRenderer from './components/ChangelogRenderer'; interface Props { onClose: () => void; } function ChangelogModal({ onClose }: Props): JSX.Element { const [hasScroll, setHasScroll] = useState(false); const changelogContentSectionRef = useRef(null); const { changelog } = useAppContext(); const formattedReleaseDate = dayjs(changelog?.release_date).format( 'MMMM D, YYYY', ); const checkScroll = useCallback((): void => { if (changelogContentSectionRef.current) { const { scrollHeight, clientHeight, scrollTop, } = changelogContentSectionRef.current; const isAtBottom = scrollHeight - clientHeight - scrollTop <= 8; setHasScroll(scrollHeight > clientHeight + 24 && !isAtBottom); // 24px - buffer height to show show more } }, []); useEffect(() => { checkScroll(); const changelogContentSection = changelogContentSectionRef.current; if (changelogContentSection) { changelogContentSection.addEventListener('scroll', checkScroll); } return (): void => { if (changelogContentSection) { changelogContentSection.removeEventListener('scroll', checkScroll); } }; }, [checkScroll]); const onClickUpdateWorkspace = (): void => { window.open( 'https://github.com/SigNoz/signoz/releases', '_blank', 'noopener,noreferrer', ); }; const onClickScrollForMore = (): void => { if (changelogContentSectionRef.current) { changelogContentSectionRef.current.scrollTo({ top: changelogContentSectionRef.current.scrollTop + 600, // Scroll 600px from the current position behavior: 'smooth', }); } }; return ( What’s New ⎯ Changelog : {formattedReleaseDate} } width={820} open onCancel={onClose} footer={
{changelog?.features && changelog.features.length > 0 && ( {changelog.features.length} new  {changelog.features.length > 1 ? 'features' : 'feature'} )}
{changelog && (
)}
} >
{changelog && }
); } export default ChangelogModal;