Skip to content

Commit

Permalink
Merge pull request #157 from JNU-econovation/FE
Browse files Browse the repository at this point in the history
feat: 일정 생성 시 filterId 값 전달
  • Loading branch information
mlnwns authored Jul 24, 2024
2 parents 7bf16d1 + c143f1e commit 664d10a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 21 deletions.
54 changes: 34 additions & 20 deletions FE/error/src/components/scheduleCreate/CreateModal.jsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -66,7 +66,7 @@ const CreateModal = ({
};

const isFilterSelected = () => {
return selectedFilter && selectedFilter.category && selectedFilter.filter;
return selectedFilter && selectedFilter.category && selectedFilter.filterId;
};

const handleTitleChange = (event) => {
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -227,12 +225,22 @@ const CreateModal = ({
{category === "public" && (
<>
<DropdownItem
onClick={() => handleFilterSelect(category, "공식행사")}
onClick={() =>
handleFilterSelect(category, {
filterId: "public1",
filterName: "공식행사",
})
}
>
공식행사
</DropdownItem>
<DropdownItem
onClick={() => handleFilterSelect(category, "주간발표")}
onClick={() =>
handleFilterSelect(category, {
filterId: "public2",
filterName: "주간발표",
})
}
>
주간발표
</DropdownItem>
Expand All @@ -242,13 +250,21 @@ const CreateModal = ({
<>
<DropdownItem
onClick={() =>
handleFilterSelect(category, "28기 신입모집 TF")
handleFilterSelect(category, {
filterId: "group1",
filterName: "28기 신입모집 TF",
})
}
>
28기 신입모집 TF
</DropdownItem>
<DropdownItem
onClick={() => handleFilterSelect(category, "행사부")}
onClick={() =>
handleFilterSelect(category, {
filterId: "group2",
filterName: "행사부",
})
}
>
행사부
</DropdownItem>
Expand All @@ -258,9 +274,7 @@ const CreateModal = ({
privateFilters.map((filter) => (
<DropdownItem
key={filter.filterId}
onClick={() =>
handleFilterSelect(category, filter.filterName)
}
onClick={() => handleFilterSelect(category, filter)}
>
{filter.filterName}
</DropdownItem>
Expand Down
2 changes: 1 addition & 1 deletion FE/error/src/pages/MainPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 664d10a

Please sign in to comment.