import { t } from '../../../i18n'; import styled from '@emotion/styled'; import { Add16Regular } from '@fluentui/react-icons'; import { useBuilder } from '@tempi/core-editor'; import { Button, Col, Row, Spin, Typography } from 'antd'; import React, { useEffect, useState } from 'react'; import InfiniteScroll from 'react-infinite-scroll-component'; import { Website } from 'modules/website'; import { useInfiniteSmartPopup } from '../hooks'; import { PopupItem } from './PopupItem'; import { SmartPopupDetailModal } from './SmartPopupDetailModal'; const { Text } = Typography; interface SmartPopupSidebarProps { onCloseDrawer?: () => any; website: Website; } export const SmartPopupSidebar: React.FC = ({ onCloseDrawer, website, }) => { const [showModalSmartPopupSetting, setShowModalSmartPopupSetting] = useState(false); const { smartPopupId, setSmartPopupId } = useBuilder<{ smartPopupId?: number; setSmartPopupId?: React.Dispatch>; }>(); const { popups: popupList, hasMore, page, setPage, loading, mutatePopups, } = useInfiniteSmartPopup({ clientAppId: website?.extraInfo?.smartActivationClientAppId, }); useEffect(() => { mutatePopups(); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( 1 &&
{t('Tải thêm...')}
} next={() => setPage(page + 1)} height={'100%'} > {t('Quản lý tất cả popup của bạn tại đây')} {popupList?.map?.((item) => ( ))}
{showModalSmartPopupSetting && ( setShowModalSmartPopupSetting(false)} onCloseDrawer={onCloseDrawer} mutatePopupList={mutatePopups} /> )}
); }; const Wrapper = styled.div` width: 100%; height: 100%; display: flex; & > div { width: 100%; } `;