Skip to content

Commit

Permalink
Merge pull request #104 from space-401/feat/layout
Browse files Browse the repository at this point in the history
[FE] ๋ชจ๋‹ฌ, ๋ ˆ์ด์•„์›ƒ ์ถ”๊ฐ€
  • Loading branch information
ooherin authored Oct 5, 2023
2 parents 0f8bcdc + 079eb0e commit d72fb64
Show file tree
Hide file tree
Showing 33 changed files with 383 additions and 335 deletions.
1 change: 1 addition & 0 deletions client/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ BASE_URL="๋ฐฑ์—”๋“œ์—์„œ ์ง€์ •ํ•œ URL"
VITE_KAKAO_KEY="์นด์นด์˜ค ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ณ ์œ ํ‚ค"
VITE_KAKAO_REST_API="์นด์นด์˜ค ๋กœ๊ทธ์ธ REST API ํ‚ค"
VITE_NAVER_CLIENT_ID="๋„ค์ด๋ฒ„ ๋กœ๊ทธ์ธ REST API ํ‚ค"
VITE_NAVER_CLIENT_KEY="๋„ค์ด๋ฒ„ ๋กœ๊ทธ์ธ ๊ณ ์œ ํ‚ค"
VITE_GOOGLE_CLIENT_ID="๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ REST API ํ‚ค"
1 change: 0 additions & 1 deletion client/src/apis/post/getPostDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ export const getPostDetail = async (postId: number) => {
const { data } = await axiosInstance.get<PostDetailType>(
END_POINTS.POST + `/${postId}`
);
console.log('postDetail ํ˜ธ์ถœ');
return data;
};
25 changes: 8 additions & 17 deletions client/src/components/Create/CreateSelectBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import S from './style';
import { MenuToggle } from './components/Toggle';
import MenuList from './components/MenuList';
import SelectList from './components/component/SelectList';
import AlertModal from '@/modal/Alert/AlertModal';
import { useAlertModalStore } from '@/store/modal';

const CreateSelectBox = (props: SelectBoxProps) => {
Expand Down Expand Up @@ -38,12 +37,6 @@ const CreateSelectBox = (props: SelectBoxProps) => {
const [isOpen, setIsOpen] = useState<boolean>(false);
const [searchValue, setSearchValue] = useState('');

const {
isOpen: isAlertModalOpen,
ModalClose: AlertModalClose,
ModalOpen: AlertModalOpen,
} = useAlertModalStore();

useEffect(() => {
setState(select);
}, [select]);
Expand All @@ -55,7 +48,12 @@ const CreateSelectBox = (props: SelectBoxProps) => {

const EnterCheck = (e: KeyboardEvent<HTMLInputElement>) => {
if (e.code === 'Enter') {
if (searchValue.trim().length === 0) return AlertModalOpen();
if (searchValue.trim().length === 0)
return ModalOpen({
width: 300,
alertMessage: 'ํ™•์ธ',
alertTitle: '์•„๋ฌด๊ฒƒ๋„ ์ž…๋ ฅํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.',
});

if (
select.filter((prevState) => prevState.title === searchValue).length !==
Expand All @@ -75,19 +73,12 @@ const CreateSelectBox = (props: SelectBoxProps) => {
? 'ํ•จ๊ป˜ํ•œ ์นœ๊ตฌ๋“ค์„ ์ถ”๊ฐ€ํ•ด ์ฃผ์„ธ์š”'
: 'ํƒœ๊ทธ๋ฅผ ์ง€์ •ํ•ด ์ฃผ์„ธ์š”';

const { ModalOpen } = useAlertModalStore((state) => state);

const containerRef = useRef(null);
const { height } = useDimensions(containerRef);
return (
<S.Wrapper isOpen={isOpen} minWidth={Math.max(150, BoxWidth)}>
{isAlertModalOpen && (
<AlertModal
ModalClose={AlertModalClose}
isOpen={isAlertModalOpen}
width={300}
alertMessage="ํ™•์ธ"
alertTitle="์•„๋ฌด๊ฒƒ๋„ ์ž…๋ ฅํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค."
/>
)}
<S.LabelTitle>
{!isOpen ? (
select.map((prev) => prev.title).join(', ') || (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ const MapBox = (props: MapBoxProps) => {
});
}, [map, keyword, setData, setPagination]);

console.log(center);

return (
<Map
isPanto={center.isPanto}
Expand Down
2 changes: 0 additions & 2 deletions client/src/components/Main/Comments/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ const DetailComments = (props: DetailCommentType) => {
setIsReply({ open: true, refId: refId, id: id });
};

console.log(commentList);

return (
<>
<S.Wrapper isOpen={isOpen}>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Main/PostMap/components/LeftSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const LeftSection = (props: LeftSectionPropType) => {
usersList,
postUpdatedAt,
placeTag,
mainImgUrl,
imgUrl,
} = item;
return (
<OnePostMapCard
Expand All @@ -47,7 +47,7 @@ const LeftSection = (props: LeftSectionPropType) => {
postDescription={getFormatUser(usersList)}
postPlace={placeTitle}
postTags={placeTag}
imgUrl={mainImgUrl}
imgUrl={imgUrl[0]}
createAt={postUpdatedAt}
onClick={() => {
setIsSelect(postId);
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Main/PostMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Index = (props: SpacePostListProps) => {
isPanto: false,
});

const { DetailModalOpen } = useDetailModalOpen();
const DetailModalOpen = useDetailModalOpen();

return (
<S.Wrapper>
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Main/Setting/SettingComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Box, Modal } from '@mui/material';
import S from '@components/Main/Setting/style';
import { ReactComponent as DeleteIcon } from '@assets/svg/deleteIcon.svg';
import UserList from '@components/Main/Setting/components/UserList';
import ConfirmModal from '@modal/Confirm/ConfirmModal';
import SelfErrorModal from '@modal/Alert/AlertModal';
import Index from '@modal/Confirm';
import SelfErrorModal from '@modal/Alert';
import { ReactComponent as LogoutSvg } from '@assets/svg/mainSetting/logout.svg';
import { theme } from '@styles/theme/theme';
import { toastColorMessage } from '@utils/toastMessage';
Expand Down Expand Up @@ -103,7 +103,7 @@ const SettingComponent = React.forwardRef(
open={state.isSelfOutModal}
onClose={() => ChangeSelfOutModal(false)}
>
<ConfirmModal
<Index
isPositiveModal={false}
titleMessage={
"'" + spaceTitle + "'" + '์ŠคํŽ˜์ด์Šค์—์„œ ๋‚˜๊ฐ€์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?'
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Main/Setting/components/UserList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useState } from 'react';
import { Modal } from '@mui/material';
import ProfileAndUserNameChangeModal from '@components/Main/Setting/components/ProfileAndUserNameChangeModal';
import toast from 'react-hot-toast';
import ConfirmModal from '@modal/Confirm/ConfirmModal';
import Index from '@modal/Confirm';

type UserListPropsType = {
userInfo: UserType;
Expand Down Expand Up @@ -71,7 +71,7 @@ const UserList = (props: UserListPropsType) => {
open={state.isMemberOutModal}
onClose={() => ChangeMemberModal(false)}
>
<ConfirmModal
<Index
isPositiveModal={false}
titleMessage={userName + '๋‹˜์„ ์ŠคํŽ˜์ด์Šค์—์„œ ๋‚ด๋ณด๋‚ด์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?'}
descriptionMessage={'์ž‘์„ฑ๋œ ๊ฒŒ์‹œ๊ธ€๊ณผ ๋Œ“๊ธ€๋“ค์ด ๋ชจ๋‘ ์‚ญ์ œ๋ฉ๋‹ˆ๋‹ค.'}
Expand All @@ -86,7 +86,7 @@ const UserList = (props: UserListPropsType) => {
open={state.isChangeAdminModal}
onClose={() => ChangeAdminModal(false)}
>
<ConfirmModal
<Index
isPositiveModal={true}
titleMessage={userName + ' ๋‹˜์—๊ฒŒ ๋ฐฉ์žฅ ๊ถŒํ•œ์„ ์ฃผ์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?'}
descriptionMessage={`๋ฐฉ์žฅ ๊ถŒํ•œ์„ ์ฃผ๋ฉด ${myInfo.userName}๋‹˜์€ \n์ŠคํŽ˜์ด์Šค ๊ด€๋ฆฌ ๋ฐ ์ธ์› ๊ด€๋ฆฌ๋ฅผ ํ•  ์ˆ˜ ์—†๊ฒŒ๋ฉ๋‹ˆ๋‹ค.`}
Expand Down
10 changes: 4 additions & 6 deletions client/src/components/common/Calender/Calender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const Calender = ({
);

useEffect(() => {
console.log('dateInfoaaaa', dateInfo);
dateInfo?.startDate && setStartDate(new Date(dateInfo.startDate));
dateInfo?.endDate && setEndDate(new Date(dateInfo.endDate));
console.log();
Expand All @@ -60,18 +59,17 @@ const Calender = ({

//๋‚ ์งœ ํ˜•์‹ ๋ณ€ํ™˜ํ•ด์„œ ๋ณด๋‚ด์คŒ
useEffect(() => {
console.log('dateInfo', startDate);
if (startDate) {
let newDateStr: DateInfoType;
if (endDate) {
newDateStr = {
startDate: postTimeChangeHelper(startDate) || '',
endDate: postTimeChangeHelper(endDate) || '',
startDate: postTimeChangeHelper(startDate) ?? '',
endDate: postTimeChangeHelper(endDate) ?? '',
};
} else {
newDateStr = {
startDate: postTimeChangeHelper(startDate) || '',
endDate: postTimeChangeHelper(startDate) || '',
startDate: postTimeChangeHelper(startDate) ?? '',
endDate: postTimeChangeHelper(startDate) ?? '',
};
}
setDateInfo(newDateStr);
Expand Down
Empty file.
18 changes: 18 additions & 0 deletions client/src/hooks/common/useAlertModalOpen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useAlertModalStore } from '@store/modal';
import { AlertPropType } from '@type/modal.type';

export const useAlertModalOpen = () => {
const { ModalOpen, setAlertInfo } = useAlertModalStore((state) => state);

const alertModalOpen = (props: AlertPropType) => {
const { alertMessage, alertTitle, width } = props;
setAlertInfo({
alertMessage,
alertTitle,
width,
});
ModalOpen();
};

return alertModalOpen;
};
28 changes: 28 additions & 0 deletions client/src/hooks/common/useConfirmModalOpen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useConfirmModalStore } from '@store/modal';
import { ConfirmPropType } from '@type/modal.type';

export const useConfirmModalOpen = () => {
const { ModalOpen, setConfirmInfo } = useConfirmModalStore((state) => state);

const confirmModalOpen = (props: ConfirmPropType) => {
const {
isPositiveModal,
closeMessage,
ApproveMessage,
descriptionMessage,
titleMessage,
AsyncAction,
} = props;
setConfirmInfo({
isPositiveModal,
closeMessage,
ApproveMessage,
descriptionMessage,
titleMessage,
AsyncAction,
});
ModalOpen();
};

return confirmModalOpen;
};
4 changes: 2 additions & 2 deletions client/src/hooks/common/useDetailModalOpen.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useDetailModalStore } from '@store/modal';

export const useDetailModalOpen = () => {
const { setPostId, ModalOpen } = useDetailModalStore((state) => state);
const { ModalOpen, setPostId } = useDetailModalStore((state) => state);

const DetailModalOpen = (postId: number) => {
setPostId(postId);
ModalOpen();
};

return { DetailModalOpen };
return DetailModalOpen;
};
59 changes: 48 additions & 11 deletions client/src/layout/HeaderLayout/HeaderLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,66 @@
import Header from './Header';
import S from './style';
import { Outlet } from 'react-router-dom';
import { Modal as DetailModal } from '@mui/material';
import { useDetailModalStore } from '@store/modal';
import {
Modal as DetailModal,
Modal as AlertModal,
Modal as ConfirmModal,
} from '@mui/material';
import {
useAlertModalStore,
useConfirmModalStore,
useDetailModalStore,
} from '@store/modal';
import DetailInner from '@modal/Detail';
import ConfirmInner from '@modal/Confirm';
import AlertInner from '@modal/Alert';
import { Suspense } from 'react';
import { Toaster } from 'react-hot-toast';

const HeaderLayout = () => {
const { ModalClose, isOpen } = useDetailModalStore((state) => state);
const { ModalClose: DetailModalClose, isOpen: DetailIsOpen } =
useDetailModalStore((state) => state);
const { ModalClose: ConfirmModalClose, isOpen: ConfirmIsOpen } =
useConfirmModalStore((state) => state);
const { ModalClose: AlertModalClose, isOpen: AlertIsOpen } =
useAlertModalStore((state) => state);

return (
<>
<Toaster position={'top-center'} />
<S.Wrapper>
<DetailModal disableScrollLock open={isOpen} onClose={ModalClose}>
<AlertModal
sx={{ zIndex: 1000 }}
onClose={AlertModalClose}
open={AlertIsOpen}
>
<AlertInner />
</AlertModal>
<ConfirmModal
sx={{ zIndex: 1000 }}
onClose={ConfirmModalClose}
open={ConfirmIsOpen}
>
<ConfirmInner />
</ConfirmModal>
<DetailModal
sx={{ zIndex: 999 }}
disableScrollLock
open={DetailIsOpen}
onClose={DetailModalClose}
>
<Suspense fallback={<></>}>
<DetailInner onClose={ModalClose} />
<DetailInner />
</Suspense>
</DetailModal>
<Suspense fallback={<></>}>
<Header />
</Suspense>
<S.ContentWrapper>
<Outlet />
</S.ContentWrapper>
<S.ContentLayOut>
<Suspense fallback={<></>}>
<Header />
</Suspense>
<S.ContentWrapper>
<Outlet />
</S.ContentWrapper>
</S.ContentLayOut>
</S.Wrapper>
</>
);
Expand Down
9 changes: 8 additions & 1 deletion client/src/layout/HeaderLayout/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { flexCenter } from '@/styles/common';

const Wrapper = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
background-color: ${({ theme }) => theme.COLOR['gray-7']};
min-height: 100vh;
`;
Expand Down Expand Up @@ -70,6 +70,12 @@ const SpaceIcon = styled.div<{ img_url: string; isCurrentSpace: boolean }>`
isCurrentSpace && ' 0px 0px 10px 2px #c2c2c2'};
`;

const ContentLayOut = styled.div`
width: 1200px;
display: flex;
flex-direction: column;
`;

const S = {
SpaceIcon,
SpaceIconBox,
Expand All @@ -79,6 +85,7 @@ const S = {
SpaceBox,
ContentWrapper,
Container,
ContentLayOut,
};

export default S;
4 changes: 2 additions & 2 deletions client/src/mocks/data/post.mock.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { PostDetailType } from '@type/post.type';
import { tagList, userList } from '@mocks/data/common';
import { PostResponseType } from '@type/post.type';
import { PostResponseType, PostDetailType } from '@type/post.type';
import { SpacePostType } from '@/types/space.type';

/**
Expand Down Expand Up @@ -316,6 +315,7 @@ export const postList: SpacePostType[] = [
* ํฌ์ŠคํŠธ ๊ฒŒ์‹œ๋ฌผ์˜ ์ƒ์„ธ ๋ชฉ ๋ฐ์ดํ„ฐ
*/
export const postDetail: PostDetailType = {
tagList: tagList,
isMine: true,
postId: 1,
position: {
Expand Down
Loading

0 comments on commit d72fb64

Please sign in to comment.