'use client' import { usePopupController } from '@/store/popupController' import { useSuitable } from '@/hooks/useSuitable' import { useSuitableStore } from '@/store/useSuitableStore' export default function SuitableButton() { const popupController = usePopupController() const { getSuitableIds, clearSuitableStore, downloadSuitablePdf, suitableErrorAlert } = useSuitable() const { selectedItems, addAllSelectedItem } = useSuitableStore() /* 데이터 전체 선택 */ const handleSelectAll = async () => { try { addAllSelectedItem(await getSuitableIds()) } catch (error) { suitableErrorAlert() } } /* 상세 팝업 열기 */ const handleOpenPopup = () => { if (selectedItems.size === 0) { alert('屋根材を選択してください。') return } popupController.setSuitableDetailPopup(true) } /* pdf 다운로드 */ const handleRedirectPdfDownload = () => { if (selectedItems.size === 0) { alert('屋根材を選択してください。') return } downloadSuitablePdf() } return (
{selectedItems.size === 0 ? ( ) : ( )}
) }