From e7339ca0859799648b544e6e4756f7d5b5c85927 Mon Sep 17 00:00:00 2001 From: mlnwns Date: Thu, 25 Jul 2024 03:46:37 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9D=BC=EC=A0=95=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=20=EC=8B=9C=20filterId=20=EA=B0=92=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/scheduleCreate/CreateModal.jsx | 54 ++++++++++++------- FE/error/src/pages/MainPage.jsx | 2 +- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/FE/error/src/components/scheduleCreate/CreateModal.jsx b/FE/error/src/components/scheduleCreate/CreateModal.jsx index cfa4085..7c15f6c 100644 --- a/FE/error/src/components/scheduleCreate/CreateModal.jsx +++ b/FE/error/src/components/scheduleCreate/CreateModal.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from "react"; -import { format, addDays, compareAsc, parseISO } from "date-fns"; +import { format, addDays } from "date-fns"; import axios from "axios"; import Modal from "react-modal"; import styled from "styled-components"; @@ -66,7 +66,7 @@ const CreateModal = ({ }; const isFilterSelected = () => { - return selectedFilter && selectedFilter.category && selectedFilter.filter; + return selectedFilter && selectedFilter.category && selectedFilter.filterId; }; const handleTitleChange = (event) => { @@ -128,13 +128,13 @@ const CreateModal = ({ }; const handleFilterSelect = (category, filter) => { - setSelectedFilter({ category, filter }); + setSelectedFilter({ category, ...filter }); setActiveDropdown(null); }; const getButtonContent = (category) => { if (selectedFilter && selectedFilter.category === category) { - return selectedFilter.filter; + return selectedFilter.filterName; } switch (category) { case "public": @@ -170,18 +170,16 @@ const CreateModal = ({ eventEndDate: eventEndDate, eventPlace: eventPlace, eventInfo: eventMemo, - scheduleType: selectedFilter.category, - filterName: selectedFilter.filter, + scheduleType: selectedFilter.category.toUpperCase(), + filter: { + filterId: selectedFilter.filterId, + }, }; axios - .post( - "/api/calendar", - { - headers: { Authorization: `Bearer ${storedToken}` }, - }, - data - ) + .post("/api/calendar", data, { + headers: { Authorization: `Bearer ${storedToken}` }, + }) .then((res) => { createDate( eventName, @@ -227,12 +225,22 @@ const CreateModal = ({ {category === "public" && ( <> handleFilterSelect(category, "공식행사")} + onClick={() => + handleFilterSelect(category, { + filterId: "public1", + filterName: "공식행사", + }) + } > 공식행사 handleFilterSelect(category, "주간발표")} + onClick={() => + handleFilterSelect(category, { + filterId: "public2", + filterName: "주간발표", + }) + } > 주간발표 @@ -242,13 +250,21 @@ const CreateModal = ({ <> - handleFilterSelect(category, "28기 신입모집 TF") + handleFilterSelect(category, { + filterId: "group1", + filterName: "28기 신입모집 TF", + }) } > 28기 신입모집 TF handleFilterSelect(category, "행사부")} + onClick={() => + handleFilterSelect(category, { + filterId: "group2", + filterName: "행사부", + }) + } > 행사부 @@ -258,9 +274,7 @@ const CreateModal = ({ privateFilters.map((filter) => ( - handleFilterSelect(category, filter.filterName) - } + onClick={() => handleFilterSelect(category, filter)} > {filter.filterName} diff --git a/FE/error/src/pages/MainPage.jsx b/FE/error/src/pages/MainPage.jsx index 5fa8b0d..69da177 100644 --- a/FE/error/src/pages/MainPage.jsx +++ b/FE/error/src/pages/MainPage.jsx @@ -97,7 +97,7 @@ const CalendarPage = styled.div` const LineBox = styled.div` width: 100%; - height: 1.5rem; + height: 1.25rem; border: 1px solid #ddd; border-right: none; margin-top: 0.65rem;