Skip to content

Commit

Permalink
[FE] 편집페이지에 메모모달을 추가한다. (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
skiende74 authored Aug 22, 2024
1 parent 12ec7e5 commit 57f3e84
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/src/pages/EditChecklistPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Button from '@/components/_common/Button/Button';
import Header from '@/components/_common/Header/Header';
import { TabProvider } from '@/components/_common/Tabs/TabContext';
import Tabs from '@/components/_common/Tabs/Tabs';
import MemoButton from '@/components/NewChecklist/MemoModal/MemoButton';
import MemoModal from '@/components/NewChecklist/MemoModal/MemoModal';
import NewChecklistContent from '@/components/NewChecklist/NewChecklistContent';
import SummaryModal from '@/components/NewChecklist/SummaryModal/SummaryModal';
import { ROUTE_PATH } from '@/constants/routePath';
Expand All @@ -31,6 +33,7 @@ const EditChecklistPage = () => {
const { tabs } = useNewChecklistTabs();

const { isModalOpen, modalOpen, modalClose } = useModalOpen();
const { isModalOpen: isMemoModalOpen, modalOpen: memoModalOpen, modalClose: memoModalClose } = useModalOpen(); // 메모 모달

const { checklistId } = useParams() as RouteParams;
const { data: checklist, isSuccess } = useGetChecklistDetailQuery(checklistId);
Expand All @@ -50,7 +53,6 @@ const EditChecklistPage = () => {
useEffect(() => {
const fetchChecklistAndSetToStore = async () => {
if (!isSuccess) return;

actions.setAll({ rawValue: objectOmit(checklist.room, new Set('includedMaintenances')), value: checklist.room });
IncludedMaintenancesActions.set(checklist.room.includedMaintenances ?? []);
setSelectedOptions(checklist.options.flatMap(option => option.optionId));
Expand Down Expand Up @@ -114,6 +116,12 @@ const EditChecklistPage = () => {
<NewChecklistContent />
</TabProvider>

{/* 메모 모달 */}
{isMemoModalOpen ? (
<MemoModal isModalOpen={isMemoModalOpen} modalClose={memoModalClose} />
) : (
<MemoButton onClick={memoModalOpen} />
)}
{/* 한줄평 모달*/}
{isModalOpen && (
<SummaryModal isModalOpen={isModalOpen} modalClose={modalClose} submitChecklist={handleSubmitChecklist} />
Expand Down

0 comments on commit 57f3e84

Please sign in to comment.