Skip to content

Commit

Permalink
test upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Nov 1, 2024
1 parent d7a5858 commit 66091b9
Showing 1 changed file with 48 additions and 56 deletions.
104 changes: 48 additions & 56 deletions modals/pop-up/StudyPreferenceDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import { useStudyPreferenceMutation } from "../../hooks/study/mutations";
import { useStudyVoteQuery } from "../../hooks/study/queries";
import { useUserInfoQuery } from "../../hooks/user/queries";
import { getStudyViewDayjs } from "../../libs/study/date/getStudyDateStatus";
import { getLocationByCoordinates } from "../../libs/study/getLocationByCoordinates";
import { setStudyToThumbnailInfo } from "../../libs/study/setStudyToThumbnailInfo";
import { IModal } from "../../types/components/modalTypes";
import { ActiveLocation } from "../../types/services/locationTypes";
import { dayjsToStr } from "../../utils/dateTimeUtils";
Expand Down Expand Up @@ -78,58 +76,54 @@ function StudyPreferenceDrawer({ setIsModal, handleClick }: StudyPreferenceDrawe
);

useEffect(() => {
if (!studyVoteData || !userInfo) return;

const participations = studyVoteData?.participations;
const sortedData = setStudyToThumbnailInfo(
participations,
preference,
{ lat: userLocationDetail.lat, lon: userLocationDetail.lon },
null,
true,
null,
null,
null,
true,
);

setPlaceArr(sortedData);

if (pickPreferences?.subPlaceArr.length < 2) {
setPickPreferences({
mainPlace: sortedData[0].id,
subPlaceArr: [sortedData[1].id, sortedData[2].id],
});
}

if (
preference?.place &&
!studyVoteData.participations.some((par) => par.place._id === preference.place)
) {
const tempOptions: IAlertModalOptions = {
title: "지역과 즐겨찾기 장소 불일치",
subTitle:
"즐겨찾기 장소가 소속 지역 내에 있지 않습니다. 지역 변경을 원하시면 운영진에게 문의해 주세요.",
text: "즐겨찾기 초기화",
defaultText: "이대로 쓸게요",
func: () => {
setPickPreferences({ mainPlace: null, subPlaceArr: [] });
handleStudyPreference({ place: null, subPlace: [] });
},
};
setAlertOptions(tempOptions);
return;
}
const changeLocation = getLocationByCoordinates(userLocationDetail.lat, userLocationDetail.lon);
if (changeLocation !== session?.user.location || changeLocation !== userInfo?.location) {
const tempOptions: IAlertModalOptions = {
title: "지역과 주 활동 장소 불일치",
subTitle:
"주 활동 장소가 소속 지역 내에 있지 않습니다. 지역 변경을 원하시면 운영진에게 문의해 주세요.",
func: () => {},
};
setAlertSimpleOptions(tempOptions);
}
// if (!studyVoteData || !userInfo) return;
// const participations = studyVoteData?.participations;
// const sortedData = setStudyToThumbnailInfo(
// participations,
// preference,
// { lat: userLocationDetail.lat, lon: userLocationDetail.lon },
// null,
// true,
// null,
// null,
// null,
// true,
// );
// setPlaceArr(sortedData);
// if (pickPreferences?.subPlaceArr.length < 2) {
// setPickPreferences({
// mainPlace: sortedData[0].id,
// subPlaceArr: [sortedData[1].id, sortedData[2].id],
// });
// }
// if (
// preference?.place &&
// !studyVoteData.participations.some((par) => par.place._id === preference.place)
// ) {
// const tempOptions: IAlertModalOptions = {
// title: "지역과 즐겨찾기 장소 불일치",
// subTitle:
// "즐겨찾기 장소가 소속 지역 내에 있지 않습니다. 지역 변경을 원하시면 운영진에게 문의해 주세요.",
// text: "즐겨찾기 초기화",
// defaultText: "이대로 쓸게요",
// func: () => {
// setPickPreferences({ mainPlace: null, subPlaceArr: [] });
// handleStudyPreference({ place: null, subPlace: [] });
// },
// };
// setAlertOptions(tempOptions);
// return;
// }
// const changeLocation = getLocationByCoordinates(userLocationDetail.lat, userLocationDetail.lon);
// if (changeLocation !== session?.user.location || changeLocation !== userInfo?.location) {
// const tempOptions: IAlertModalOptions = {
// title: "지역과 주 활동 장소 불일치",
// subTitle:
// "주 활동 장소가 소속 지역 내에 있지 않습니다. 지역 변경을 원하시면 운영진에게 문의해 주세요.",
// func: () => {},
// };
// setAlertSimpleOptions(tempOptions);
// }
}, [studyVoteData, userInfo, session]);

const drawerOptions2: BottomFlexDrawerOptions = {
Expand Down Expand Up @@ -168,8 +162,6 @@ function StudyPreferenceDrawer({ setIsModal, handleClick }: StudyPreferenceDrawe
}
};

useEffect(() => {}, []);

return (
<>
<BottomFlexDrawer
Expand Down

0 comments on commit 66091b9

Please sign in to comment.