Skip to content

Commit

Permalink
Merge branch 'main' into feat/auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Zero-1016 authored Dec 29, 2023
2 parents 5b87d7a + 18714ba commit a5ecf61
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 22 deletions.
7 changes: 0 additions & 7 deletions src/apis/space/patchSpaceUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ import { axiosInstance } from '@/apis';
import { END_POINTS } from '@/constants';
import type { ApiResponseType } from '@/types';

// export type SpaceUserPropsType = {
// spaceId: number;
// userId?: number; //ํ•ด๋‹น ์œ ์ €๊ฐ€ ๋ฐฉ์žฅ์ด ๋˜๋Š” ๊ฒฝ์šฐ์—๋งŒ ์ถ”๊ฐ€ํ•จ.
// isAdmin?: boolean;
// image?: File | null;
// userNickName?: string;
// };
export const patchSpaceUser = async (patchInfo: FormData) => {
const { data } = await axiosInstance.patch<ApiResponseType>(
END_POINTS.SPACE_USER,
Expand Down
7 changes: 2 additions & 5 deletions src/components/Create/CreateSelectBox/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useDimensions, useSpaceInfoQuery, useTagMutation } from '@/hooks';
import { useDimensions, useTagMutation } from '@/hooks';
import type { SelectBoxProps, selectType } from '@/types';
import { toastColorMessage } from '@/utils';
import { motion } from 'framer-motion';
Expand All @@ -24,11 +24,8 @@ export const CreateSelectBox = (props: SelectBoxProps) => {
const [searchValue, setSearchValue] = useState<string>('');
const { spaceId } = useParams();

const { refetch } = useSpaceInfoQuery(spaceId!);

useEffect(() => {
setState(select);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [select]);

const toggleOpen = () => {
Expand All @@ -45,8 +42,8 @@ export const CreateSelectBox = (props: SelectBoxProps) => {
return toastColorMessage('๊ฐ’์ด ๋น„์–ด์žˆ์Šต๋‹ˆ๋‹ค.');
if (select.findIndex((prevState) => prevState.title === searchValue) !== -1)
return toastColorMessage('์ด๋ฏธ ์žˆ๋Š” ํƒœ๊ทธ์ž…๋‹ˆ๋‹ค.');

postTagAction({ spaceId: Number(spaceId)!, tagName: searchValue });
refetch();
setSearchValue('');
};

Expand Down
1 change: 1 addition & 0 deletions src/components/Main/Comments/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const DetailComments = (props: DetailCommentType) => {
}
setIsReply({ open: true, refId: refId, id: id });
};

return (
<>
<S.Wrapper isOpen={isOpen}>
Expand Down
3 changes: 0 additions & 3 deletions src/components/Main/MainBody/MainBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,9 @@ export const MainBody = (props: PostListPropType) => {

const { postList, total, page: curPage, itemLength } = spacePostList!;

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

useEffect(() => {
setSearchParams(objectHelperWithNotUndefined(query));
refetch();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [refetch, query]);

const detailModalOpen = useDetailModalOpen();
Expand Down
7 changes: 5 additions & 2 deletions src/components/Main/Setting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,15 @@ export const SettingComponent = React.forwardRef(
const changeAdminAction = (userId: number) => {
onClose();
const formData = new FormData();
const spaceUserDTO = {
const DTO = {
spaceId: spaceId,
userId,
isAdmin: true,
};
formData.append('spaceUserDTO', JSON.stringify(spaceUserDTO));
const spaceUserDTO = new Blob([JSON.stringify(DTO)], {
type: 'application/json',
});
formData.append('spaceUserDTO', spaceUserDTO);
userUpdateAction(formData);
};

Expand Down
29 changes: 27 additions & 2 deletions src/components/common/Calender/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { ko } from 'date-fns/esm/locale';
import getYear from 'date-fns/getYear';
import { useEffect, useState } from 'react';
import 'react-datepicker/dist/react-datepicker.css';
import { useSearchParams } from 'react-router-dom';
import { ReactComponent as CalenderIcon } from '@/assets/svg/calenderIcon.svg';
import { ReactComponent as DownIcon } from '@/assets/svg/chevron/chevron_down.svg';
import { ReactComponent as UpIcon } from '@/assets/svg/chevron/chevron_up.svg';
import { ReactComponent as MainCalenderIcon } from '@/assets/svg/mainCalender.svg';
import { BasicButton } from '..';
import './calender.css';
import { S } from './style';
import { MONTHS, YEARS } from './util';
Expand All @@ -32,6 +34,7 @@ export const Calender = ({
dateInfo,
fontSize,
}: CalenderPropsType) => {
const [searchParams, setSearchParams] = useSearchParams();
const [startDate, setStartDate] = useState<Date | null>(
dateInfo?.startDate ? new Date(dateInfo.startDate!) : null
);
Expand All @@ -42,7 +45,6 @@ export const Calender = ({
useEffect(() => {
dateInfo?.startDate && setStartDate(new Date(dateInfo.startDate));
dateInfo?.endDate && setEndDate(new Date(dateInfo.endDate));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const [isDropdownOpen, setIsDropdownOpen] = useState([false, false]);
Expand Down Expand Up @@ -80,9 +82,24 @@ export const Calender = ({
}
setDateInfo(newDateStr);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [startDate, endDate]);

//๋‚ ์งœ ๋ฆฌ์…‹
const onResetDate = () => {
setStartDate(null);
setEndDate(null);
removeQueryParam('startDate');
removeQueryParam('endDate');
location.reload();
};

const removeQueryParam = (keyToRemove: string) => {
if (searchParams.has(keyToRemove)) {
searchParams.delete(keyToRemove); // ๊ธฐ์กด์˜ searchParams๋ฅผ ์ง์ ‘ ์ˆ˜์ •
setSearchParams(new URLSearchParams(searchParams)); // ์ƒˆ๋กœ์šด ์ธ์Šคํ„ด์Šค๋กœ ์—…๋ฐ์ดํŠธ
}
};

return (
<div
className="custom-react-datepicker__wrapper"
Expand Down Expand Up @@ -200,6 +217,14 @@ export const Calender = ({
))}
</select>
)}
<BasicButton
width={40}
color={'white'}
height={10}
onClick={onResetDate}
>
reset
</BasicButton>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/modal/Detail/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const BackClickBlock = styled.div<{ isOpen: boolean }>`
`;

const MenuGroup = styled.div<{ isOpen: boolean; width?: number; top?: number }>`
right: -140px;
right: -100px;
top: ${({ top }) => (top ? top : 20)}px;
position: absolute;
width: ${({ width }) => (width ? width : 102)}px;
Expand Down
3 changes: 1 addition & 2 deletions src/pages/CreatePost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const CreatePost = () => {
navigate(PATH.SPACE);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [postId]);

const { createPostAction, postCreateSuccess } = usePostCreateMutation();
Expand Down Expand Up @@ -214,7 +213,7 @@ const CreatePost = () => {
postId,
};

if (imageArr.convertedImages) {
if (imageArr.convertedImages.length) {
imageArr.convertedImages.forEach((image) => {
const blobImg = new Blob([image], {
type: 'image/jpeg',
Expand Down

0 comments on commit a5ecf61

Please sign in to comment.