diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b60446a..a3ea8ffd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,15 +13,18 @@ jobs: - name: Check Node v run: node -v - - name: .env setting + - name: create env file + working-directory: ./ run: | + pwd touch .env - echo "VITE_NODE_ENV=${{ secrets.VITE_NODE_ENV }}" > .env - echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" > .env - echo "VITE_GOOGLE_MAP_API=${{ secrets.VITE_GOOGLE_MAP_API }}" > .env - echo "VITE_GOOGLE_AUTH_CLIENT_ID=${{ secrets.VITE_GOOGLE_AUTH_CLIENT_ID }}" > .env - echo "VITE_KAKAO_REST_API_KEAY=${{ secrets.VITE_KAKAO_REST_API_KEAY }}" > .env - echo "VITE_REDIRECT_URI=${{ secrets.VITE_REDIRECT_URI }}" > .env + echo "VITE_NODE_ENV=${{ secrets.VITE_NODE_ENV }}" >> .env + echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" >> .env + echo "VITE_GOOGLE_MAP_API=${{ secrets.VITE_GOOGLE_MAP_API }}" >> .env + echo "VITE_GOOGLE_AUTH_CLIENT_ID=${{ secrets.VITE_GOOGLE_AUTH_CLIENT_ID }}" >> .env + echo "VITE_KAKAO_REST_API_KEAY=${{ secrets.VITE_KAKAO_REST_API_KEAY }}" >> .env + echo "VITE_REDIRECT_URI=${{ secrets.VITE_REDIRECT_URI }}" >> .env + cat .env - name: Install dependencies run: yarn @@ -36,7 +39,7 @@ jobs: - name: Generate build run: yarn run build - - name: Deploy + - name: Deploy to S3 env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -47,4 +50,7 @@ jobs: VITE_KAKAO_REST_API_KEAY: ${{ secrets.VITE_KAKAO_REST_API_KEAY }} VITE_REDIRECT_URI: ${{ secrets.VITE_REDIRECT_URI }} AWS_REGION: ${{ secrets.AWS_REGION }} - run: aws s3 cp --recursive --region ap-northeast-2 dist s3://here---you + run: aws s3 cp --recursive --region ap-northeast-2 dist s3://${{ secrets.AWS_BUCKET_NAME }} + + - name: Invaildate CloudFront Cache + run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*" diff --git a/src/components/bottomSheet/BottomDetailScrollPage.jsx b/src/components/bottomSheet/BottomDetailScrollPage.jsx index 6f2f5074..007a7c8b 100644 --- a/src/components/bottomSheet/BottomDetailScrollPage.jsx +++ b/src/components/bottomSheet/BottomDetailScrollPage.jsx @@ -27,7 +27,7 @@ const BottomDetailScrollPage = ({ startDate, endDate }) => { if (!lastPage?.data?.data?.data?.meta?.hasNextData) { return null; } else { - return lastPage?.data?.data?.data?.meta?.cursor + 1; + return lastPage?.data?.data?.data?.meta?.cursor; } }, staleTime: 60 * 1000, diff --git a/src/components/bottomSheet/BottomDetailScrollPage.style.js b/src/components/bottomSheet/BottomDetailScrollPage.style.js index 8ab9c829..c80a38d3 100644 --- a/src/components/bottomSheet/BottomDetailScrollPage.style.js +++ b/src/components/bottomSheet/BottomDetailScrollPage.style.js @@ -97,7 +97,7 @@ const Button = styled.button` ${theme.ALIGN.ROW_CENTER}; background-color: ${theme.COLOR.MAIN.GREEN}; border: none; - width: 400px; + width: 90%; height: 60px; color: ${theme.COLOR.MAIN.WHITE}; border-radius: 30px; diff --git a/src/components/bottomSheet/BottomScrollPage.style.js b/src/components/bottomSheet/BottomScrollPage.style.js index 655c869c..14bb4db1 100644 --- a/src/components/bottomSheet/BottomScrollPage.style.js +++ b/src/components/bottomSheet/BottomScrollPage.style.js @@ -11,7 +11,7 @@ const Button = styled.button` ${theme.ALIGN.ROW_CENTER}; background-color: ${theme.COLOR.MAIN.GREEN}; border: none; - width: 400px; + width: 90%; height: 60px; color: ${theme.COLOR.MAIN.WHITE}; border-radius: 30px; diff --git a/src/components/calendar/TravelCalendar.jsx b/src/components/calendar/TravelCalendar.jsx index a972b4f3..8b60fa67 100644 --- a/src/components/calendar/TravelCalendar.jsx +++ b/src/components/calendar/TravelCalendar.jsx @@ -8,6 +8,7 @@ import * as S from './TravelCalendar.style'; import CalendarSkeleton from './skeleton/CalendarSkeleton'; import EditLight from '/icons/EditLight.svg'; import { useMonthlyJourney } from '@/hooks/home/useMonthlyJourney'; +import useAuth from '@/store/useAuth'; moment.locale('en'); @@ -17,6 +18,7 @@ const TravelCalendar = ({ setJourneyInfo, setMonthlyInfo, }) => { + const { isLogin } = useAuth(); const storedStartDate = localStorage.getItem('startDate'); const storedEndDate = localStorage.getItem('endDate'); @@ -99,6 +101,9 @@ const TravelCalendar = ({ setJourneyInfo(null); setJourneyTitle(''); } + } else { + setJourneyInfo(null); + setJourneyTitle(''); } } }; @@ -188,39 +193,43 @@ const TravelCalendar = ({ nextLabel={{'>'}} /> - - {storedStartDate && storedEndDate ? ( - <> - - {journeyTitle ? ( -

๐Ÿ–๏ธ ์„ ํƒ๋œ ์—ฌ์ • : {journeyTitle}

- ) : ( -

์ƒˆ๋กœ์šด ์—ฌ์ •์„ ์ถ”๊ฐ€ํ•˜๊ณ  ์—ฌํ–‰ ์ผ์ •์„ ์ƒ์„ฑํ•˜์„ธ์š”!

- )} - -

- {moment(value).format('YYYY/MM/DD')} ~{' '} - {moment(endDate).format('YYYY/MM/DD')} -

-
- -

- Tip.{'\t'} - - ์ผ์ง€ ์ž‘์„ฑ - - ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์ผ์ง€๋ฅผ ์ž‘์„ฑํ•˜๋ฉด ์ง€๋„์—์„œ -
- ์ด๋ฏธ์ง€๋กœ ํ‘œ์‹œ๋œ ์œ„์น˜๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. -

-
- - ) : ( -

- ๋‹ฌ๋ ฅ์—์„œ ๊ธฐ๊ฐ„์„ ์„ ํƒํ•˜๋ฉด ์ €์žฅ๋œ ์ผ์ •์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. -

- )} -
+ {isLogin && ( + + {storedStartDate && storedEndDate ? ( + <> + + {journeyTitle ? ( +

๐Ÿ–๏ธ ์„ ํƒ๋œ ์—ฌ์ • : {journeyTitle}

+ ) : ( +

์ƒˆ๋กœ์šด ์—ฌ์ •์„ ์ถ”๊ฐ€ํ•˜๊ณ  ์—ฌํ–‰ ์ผ์ •์„ ์ƒ์„ฑํ•˜์„ธ์š”!

+ )} + +

+ {moment(value).format('YYYY/MM/DD')} ~{' '} + {moment(endDate).format('YYYY/MM/DD')} +

+
+ +

+ Tip.{'\t'} + + ์ผ์ง€ ์ž‘์„ฑ + + ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์ผ์ง€๋ฅผ ์ž‘์„ฑํ•˜๋ฉด ์ง€๋„์—์„œ +
+ ์ด๋ฏธ์ง€๋กœ ํ‘œ์‹œ๋œ ์œ„์น˜๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +

+
+ + ) : !isLogin ? ( + <> + ) : ( +

+ ๋‹ฌ๋ ฅ์—์„œ ๊ธฐ๊ฐ„์„ ์„ ํƒํ•˜๋ฉด ์ €์žฅ๋œ ์ผ์ •์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. +

+ )} +
+ )} { return ( - + { {writer?.name} {/* ๋ณธ์ธ ๋Œ“๊ธ€์ด๊ฑฐ๋‚˜ ๊ฒŒ์‹œ๊ธ€ ์ฃผ์ธ์ธ ๊ฒฝ์šฐ์—๋งŒ ๋‹ต๊ธ€ ๋ฒ„ํŠผ ํ‘œ์‹œ */} - setIsReplying(prev => !prev)}> - {isReplying === true ? : } - + {isParentComment && ( + setIsReplying(prev => !prev)}> + {isReplying === true ? : } + + )} {/* ๋ณธ์ธ ๋Œ“๊ธ€์ธ ๊ฒฝ์šฐ์—๋งŒ ์ˆ˜์ • ๋ฐ ์‚ญ์ œ ๋ฒ„ํŠผ ํ‘œ์‹œ */} {writer?.is_writer && !editMode && ( <> @@ -123,6 +125,23 @@ const SignatureComment = ({ data }) => { setEditMode(true); }} /> + {!can_delete && ( // can_delete๊ฐ€ false์ผ ๋•Œ๋งŒ ์“ฐ๋ ˆ๊ธฐํ†ต ์•„์ด์ฝ˜ ํ‘œ์‹œ + { + try { + await deleteReComment({ signatureId, commentId: _id }); + } catch (e) { + console.error(e); + } + }} + /> + )} + + )} + {/* ๋ชจ๋‘ ์‚ญ์ œํ•˜๋Š” ๊ถŒํ•œ์ด ์žˆ๋Š” ๊ฒฝ์šฐ. */} + {can_delete && + !editMode && ( // writer๊ฐ€ ์•„๋‹ˆ๊ณ , can_delete๊ฐ€ true์ผ ๋•Œ๋งŒ ์“ฐ๋ ˆ๊ธฐํ†ต ์•„์ด์ฝ˜ ํ‘œ์‹œ { @@ -133,8 +152,7 @@ const SignatureComment = ({ data }) => { } }} /> - - )} + )} {editMode && ( <> { const navigate = useNavigate(); @@ -15,6 +17,12 @@ const SignatureSearchSlider = ({ data, type, searchTerm }) => { "{searchTerm}" ์— ๊ด€ํ•œ ์‹œ๊ทธ๋‹ˆ์ฒ˜โญ )} + {data?.length === 0 && ( + + {type === 'hot' && } + {type === 'new' && } + + )} {data === null ? ( ๋กœ๊ทธ์ธ ํ›„ diff --git a/src/components/login/LoginButton.jsx b/src/components/login/LoginButton.jsx index 12efe675..8e446208 100644 --- a/src/components/login/LoginButton.jsx +++ b/src/components/login/LoginButton.jsx @@ -1,5 +1,3 @@ -import styled from 'styled-components'; - import GoogleLoginButton from './GoogleLoginButton'; import KakaoLoginButton from './KakaoLoginButton'; import { GoogleOAuthProvider } from '@react-oauth/google'; diff --git a/src/components/login/SnsLoginButton.style.js b/src/components/login/SnsLoginButton.style.js index 8cc5702e..f5fa0838 100644 --- a/src/components/login/SnsLoginButton.style.js +++ b/src/components/login/SnsLoginButton.style.js @@ -8,7 +8,7 @@ const LoginButton = styled.button` justify-content: center; align-items: center; width: 100%; - height: 35%; + height: 45%; color: black; border: none; padding: 10px 11px; @@ -36,7 +36,7 @@ const KLoginButton = styled.button` justify-content: center; align-items: center; width: 100%; - height: 35%; + height: 45%; color: black; border: none; padding: 10px 11px; diff --git a/src/components/main/Box.jsx b/src/components/main/Box.jsx index ca5e0d76..a8bc38c4 100644 --- a/src/components/main/Box.jsx +++ b/src/components/main/Box.jsx @@ -8,8 +8,8 @@ import signatureIcon from '/images/main/signatureIcon.svg'; export default function Box({ title }) { const navigate = useNavigate(); - const route = title == '์‹œ๊ทธ๋‹ˆ์ฒ˜' ? '/signature ' : '/mate'; - console.log(route); + const route = title == '์‹œ๊ทธ๋‹ˆ์ฒ˜' ? '/signature' : '/mate'; + const des = title == '์‹œ๊ทธ๋‹ˆ์ฒ˜' ? '๋‚˜๋งŒ์˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ž‘์„ฑํ•˜๊ธฐ ' : '๋‚˜์˜ ์—ฌํ–‰ ๋ฉ”์ดํŠธ ์ฐพ๊ธฐ'; const IconUrl = title == '์‹œ๊ทธ๋‹ˆ์ฒ˜' ? signatureIcon : mateIcon; diff --git a/src/components/main/LoginBanner.jsx b/src/components/main/LoginBanner.jsx index 7d2d35c1..7150d3ef 100644 --- a/src/components/main/LoginBanner.jsx +++ b/src/components/main/LoginBanner.jsx @@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import * as S from './LoginBanner.style'; -import LoginSkeleton from './skeleton/LoginSkeleton'; import profileImg from '/images/main/profileImg.svg'; import rightIcon from '/images/main/right.svg'; import { useGetMyProfile } from '@/hooks/profile/queries/useGetMyProfile'; @@ -20,34 +19,30 @@ export default function LoginBanner({ isLogin }) { return ( <> - {pendingState ? ( - - ) : ( - - - {isLogin ? ( - <> - - - {myProfile?.nickname}๋‹˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค๐Ÿช - navigate('/mypage')}> - ๋‚ด ํ”„๋กœํ•„ ๊ฐ€๊ธฐ - - - - - ) : ( - <> - - navigate('/login')}> - 3์ดˆ๋งŒ์— ๋กœ๊ทธ์ธํ•˜๊ธฐ - - - - )} - - - )} + + + {isLogin ? ( + <> + + + {myProfile?.nickname}๋‹˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค๐Ÿช + navigate('/mypage')}> + ๋‚ด ํ”„๋กœํ•„ ๊ฐ€๊ธฐ + + + + + ) : ( + <> + + navigate('/login')}> + 3์ดˆ๋งŒ์— ๋กœ๊ทธ์ธํ•˜๊ธฐ + + + + )} + + ); } diff --git a/src/components/mate/Search.jsx b/src/components/mate/Search.jsx index 3cce94af..99377d76 100644 --- a/src/components/mate/Search.jsx +++ b/src/components/mate/Search.jsx @@ -1,12 +1,19 @@ import * as S from './Search.style'; +import useAuth from '@/store/useAuth'; const Search = ({ setSearchTerm }) => { + const { isLogin } = useAuth(); return ( setSearchTerm(e.target.value)} + disabled={!isLogin} /> diff --git a/src/components/modal/Modal.style.js b/src/components/modal/Modal.style.js index 4b8dc185..ddc5aa69 100644 --- a/src/components/modal/Modal.style.js +++ b/src/components/modal/Modal.style.js @@ -114,7 +114,8 @@ const Button = styled.button` border-bottom-right-radius: 0.5rem; border-bottom-left-radius: 0.5rem; - color: ${props => props.buttonColor}; + color: ${props => + props.buttonColor ? props.buttonColor : `${theme.COLOR.MAIN.BLACK}`}; background-color: transparent; cursor: pointer; diff --git a/src/components/modal/likerFindModal/LikerFindModal.style.js b/src/components/modal/likerFindModal/LikerFindModal.style.js index beee1eef..9265d3e9 100644 --- a/src/components/modal/likerFindModal/LikerFindModal.style.js +++ b/src/components/modal/likerFindModal/LikerFindModal.style.js @@ -51,6 +51,7 @@ const Button = styled.button` background-color: ${(props => props.follow) ? `${theme.COLOR.MAIN.LIGHT_GREEN}` : `${theme.COLOR.MAIN.LIGHT_GRAY}`}; + cursor: pointer; `; const UserImg = styled.img` diff --git a/src/components/modal/mypage/PublicScopeModal.jsx b/src/components/modal/mypage/PublicScopeModal.jsx index c7d406e9..dd37b209 100644 --- a/src/components/modal/mypage/PublicScopeModal.jsx +++ b/src/components/modal/mypage/PublicScopeModal.jsx @@ -75,7 +75,6 @@ const PublicScopeModal = ({ myVisibility }) => { toast.success('๊ณต๊ฐœ๋ฒ”์œ„๊ฐ€ ์„ค์ •๋˜์—ˆ์Šต๋‹ˆ๋‹ค.'); } } catch (error) { - console.log(error); console.error('์„œ๋ฒ„ ๋‚ด๋ถ€ ์˜ค๋ฅ˜.', error); toast.error('์„œ๋ฒ„ ๋‚ด๋ถ€ ์˜ค๋ฅ˜'); } finally { diff --git a/src/components/mypage/Category.jsx b/src/components/mypage/Category.jsx index caa2b52e..f4a5ffc7 100644 --- a/src/components/mypage/Category.jsx +++ b/src/components/mypage/Category.jsx @@ -1,10 +1,14 @@ import SubCateGoryPage from './SubCateGoryPage'; import { ETC, SUPPORT, USER_SETTING } from '@/constants/subcategory'; +import useAuth from '@/store/useAuth'; const Category = () => { + const { isLogin } = useAuth(); return ( <> - + {isLogin && ( + + )} diff --git a/src/components/navbar/Navbar.jsx b/src/components/navbar/Navbar.jsx index eee4c57c..0c978517 100644 --- a/src/components/navbar/Navbar.jsx +++ b/src/components/navbar/Navbar.jsx @@ -1,4 +1,4 @@ -import { useEffect } from 'react'; +import toast from 'react-hot-toast'; import * as S from './Navbar.style'; import Bell from '/images/Bell.svg'; @@ -9,6 +9,7 @@ import useAuth from '@/store/useAuth'; const Navbar = () => { const { data: unReadCount, isPending, isError } = useUnReadNotification(); + const { isLogin } = useAuth(); const unReadCounter = unReadCount?.data?.data?.unreadCount; return ( @@ -19,13 +20,19 @@ const Navbar = () => { - - - + {isLogin ? ( + + + - {!unReadCounter ? null :

{unReadCounter}

} -
-
+ {!unReadCounter ? null :

{unReadCounter}

} +
+
+ ) : ( +
toast('๋กœ๊ทธ์ธ ํ›„ ์•Œ๋ฆผ์„ ํ™•์ธํ•ด์ฃผ์„ธ์š”!')}> + +
+ )} ); }; diff --git a/src/components/notification/NotificationPage.jsx b/src/components/notification/NotificationPage.jsx index 679f670b..b36e1247 100644 --- a/src/components/notification/NotificationPage.jsx +++ b/src/components/notification/NotificationPage.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import { useNavigate } from 'react-router-dom'; import * as S from './NotificationPage.style'; @@ -6,34 +5,55 @@ import Book from '/images/Book_light.svg'; import Comment from '/images/comment_light.svg'; import Heart from '/images/signature/ClickedHeart.svg'; -const NotificationPage = ({ notification }) => { +const NotificationPage = ({ notifications }) => { const navigate = useNavigate(); return ( - {notification?.map(list => ( - - {list.type === 'LIKE' && ( + {notifications?.map(notify => + notify?.content?.type === 'SIGNATURE' ? ( + notify?.content?.action === 'LIKE' ? ( navigate(`/signature/post/${list.itemId}`)}> - - {list.content} + onClick={() => navigate(`/signature/post/${notify?.itemId}`)}> + + +

+ {notify?.content?.actionUserNickname}๋‹˜์ด ํšŒ์›๋‹˜์˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜ + {notify?.itemDesc && `(${notify?.itemDesc})`}์— + ์ข‹์•„์š”๋ฅผ ๋‚จ๊ฒผ์Šต๋‹ˆ๋‹ค. +

+
- )} - {list.type === 'COMMENT' && ( - - - {list.content} + ) : ( + navigate(`/signature/post/${notify?.itemId}`)}> + + +

+ {notify?.content?.actionUserNickname}๋‹˜์ด ํšŒ์›๋‹˜์˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜ + {notify?.itemDesc && `(${notify?.itemDesc})`}์— + ๋Œ“๊ธ€์„ ๋‚จ๊ฒผ์Šต๋‹ˆ๋‹ค. +

+
- )} - {list.type === 'INVITE' && ( - - - {list.content} + ) + ) : ( + notify?.content?.type === 'RULE' && + notify?.content?.action === 'COMMENT' && ( + navigate(`/mate/rule-check/${notify?.itemId}`)}> + + +

+ {notify?.content?.actionUserNickname}๋‹˜์ด ํšŒ์›๋‹˜์˜ ๊ทœ์น™ + {notify?.itemDesc && `(${notify?.itemDesc})`}์— + ๋Œ“๊ธ€์„ ๋‚จ๊ฒผ์Šต๋‹ˆ๋‹ค. +

+
- )} -
- ))} + ) + ), + )}
); }; diff --git a/src/components/notification/NotificationPage.style.js b/src/components/notification/NotificationPage.style.js index f9ad4b24..04f44923 100644 --- a/src/components/notification/NotificationPage.style.js +++ b/src/components/notification/NotificationPage.style.js @@ -15,7 +15,7 @@ const NotificationContainer = styled.div` flex-direction: row; align-items: center; width: 95%; - font-size: ${FONT_SIZE.LG}; + font-size: ${FONT_SIZE.SM}; margin-bottom: 30px; padding: 20px; border-radius: 10px; @@ -29,11 +29,20 @@ const NotificationContainer = styled.div` font-size: ${FONT_SIZE.SM}; } + h3 { + color: ${theme.COLOR.MAIN.GREEN}; + } + span { color: ${theme.COLOR.MAIN.GREEN}; + font-size: ${FONT_SIZE.h3}; } `; +const TextContainer = styled.div` + width: 100%; +`; + const Img = styled.img` width: 8%; margin-right: 20px; @@ -63,4 +72,12 @@ const Text = styled.div` font-size: 23px; `; -export { Container, NotificationContainer, Img, BellContainer, Bell, Text }; +export { + Container, + NotificationContainer, + TextContainer, + Img, + BellContainer, + Bell, + Text, +}; diff --git a/src/components/profile/ProfileBox.style.js b/src/components/profile/ProfileBox.style.js index 4374278f..613c1b1c 100644 --- a/src/components/profile/ProfileBox.style.js +++ b/src/components/profile/ProfileBox.style.js @@ -76,6 +76,7 @@ const Button = styled.button` padding: 5px 11px; border-radius: 20px; margin-left: 10px; + color: ${theme.COLOR.MAIN.BLACK}; cursor: pointer; &:hover { diff --git a/src/components/schedules/Schedules.jsx b/src/components/schedules/Schedules.jsx index 881b1894..36b39886 100644 --- a/src/components/schedules/Schedules.jsx +++ b/src/components/schedules/Schedules.jsx @@ -78,7 +78,7 @@ const Schedules = ({ data, endDate, refetch }) => { } } catch (e) { setError(true); - console.log(e); + toast.error('์ผ์ • ์ดˆ๊ธฐํ™” ์ค‘ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.'); } finally { setLoading(false); diff --git a/src/components/schedules/SchedulesView.jsx b/src/components/schedules/SchedulesView.jsx index 4e11b79c..dbc8c685 100644 --- a/src/components/schedules/SchedulesView.jsx +++ b/src/components/schedules/SchedulesView.jsx @@ -7,10 +7,11 @@ import { Link } from 'react-router-dom'; import * as S from './SchedulesView.style'; import SchedulesViewSkeleton from './skeleton/SchedulesViewSkeleton'; import { getSchedule } from '@/apis/request/home'; +import useAuth from '@/store/useAuth'; import { useInfiniteQuery } from '@tanstack/react-query'; const SchedulesView = ({ startDate, endDate, journeyTitle }) => { - const accessToken = localStorage.getItem('x-access-token'); + const { isLogin } = useAuth(); const pageSize = 5; const date = new Date(startDate); @@ -33,7 +34,7 @@ const SchedulesView = ({ startDate, endDate, journeyTitle }) => { if (!lastPage?.data?.data?.data?.meta?.hasNextData) { return null; } else { - return lastPage?.data?.data?.data?.meta?.cursor + 1; + return lastPage?.data?.data?.data?.meta?.cursor; } }, staleTime: 60 * 1000, @@ -73,7 +74,7 @@ const SchedulesView = ({ startDate, endDate, journeyTitle }) => {
)} - {!isLoading && !accessToken && ( + {!isLogin && ( ๋กœ๊ทธ์ธ ํ›„ ์—ฌ์ •์„ ์ž‘์„ฑํ•ด๋ณด์„ธ์š”! diff --git a/src/constants/path.js b/src/constants/path.js index a2c68531..5bc7b4ce 100644 --- a/src/constants/path.js +++ b/src/constants/path.js @@ -102,6 +102,7 @@ const API_URL = { GET_JOURNEY_MAP: `/api/${VERSION}/${API_BASE.MAP}/get-journey/:journeyId`, GET_DIARIES_MAP: `/api/${VERSION}/${API_BASE.MAP}/get-diaries/:journeyId`, GET_DETAIL_JOURNEY_MAP: `/api/${VERSION}/${API_BASE.MAP}/get-schedules/:journeyId`, + GET_MONTHLY_LIST_SCHEDULE: `/api/${VERSION}/${API_BASE.MAP}/get-monthly-schedule`, // SIGNATURE SEARCH_SIGNATURE: `/api/${VERSION}/${API_BASE.SEARCH}`, // ๊ฒ€์ƒ‰ํƒญ ๋ฉ”์ธํ™”๋ฉด GET_MY_SIGNATURE: `/api/${VERSION}/${API_BASE.SIGNATURE}`, diff --git a/src/index.css b/src/index.css index a472d510..d048ba47 100644 --- a/src/index.css +++ b/src/index.css @@ -102,6 +102,7 @@ max-width: 100%; border: none; line-height: 1.125em; + color: black; @media (min-width: 640px) { width: 500px; @@ -181,6 +182,7 @@ align-items: center; background-color: transparent; border: none; + color: black; } .react-calendar__tile:enabled:hover, diff --git a/src/mocks/handlers/explore.js b/src/mocks/handlers/explore.js index 3a3fd195..de63d0b9 100644 --- a/src/mocks/handlers/explore.js +++ b/src/mocks/handlers/explore.js @@ -6,138 +6,72 @@ import { baseURL } from '@/apis/api'; import { API_URL } from '@/constants/path'; export const ExploreHandlers = [ - // ํƒ์ƒ‰ํƒญ_๋ฉ”์ธ ํ™”๋ฉด - http.get(`${baseURL}${API_URL.SEARCH_SIGNATURE}`, ({ request, params }) => { - const url = new URL(request.url); - const search = url.searchParams.get('search'); - if (search) { + // ํƒ์ƒ‰ํƒญ_ํ•ซ ์‹œ๊ทธ๋‹ˆ์ฒ˜ + http.get( + `${baseURL}${API_URL.SEARCH_SIGNATURE}/hot`, + ({ request, params }) => { return HttpResponse.json({ - status: 200, + timestamp: '2024-02-05T20:12:21.562Z', + code: 'OK', success: true, - message: `ํƒ‘์ƒ‰ํƒญ ๋ฉ”์ธ ${search} ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต`, + message: 'ํƒ์ƒ‰ํƒญ ๋ฉ”์ธ ํ™”๋ฉด ๊ฐ€์ ธ์˜ค๊ธฐ ์„ฑ๊ณต', data: { - hot: [ + covers: [ { - _id: 3, - title: `${search}`, - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1682686581498-5e85c7228119?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - like: 5, - user: { - name: `${search}`, - image: - 'https://plus.unsplash.com/premium_photo-1705352059948-e5512efca860?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, + _id: 5, + title: '๊ฐ•๋‚จ์—ญ ๊ทผ์ฒ˜ ์นดํŽ˜ ๋ชจ์Œ', + liked: 0, + userName: '์จ๋‹ˆ', + date: '2024.02.06', + image: null, + userImage: 'imagekey1', }, { - _id: 4, - title: `${search} ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ2`, - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1682686581498-5e85c7228119?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - like: 5, - user: { - name: `${search}`, - image: - 'https://plus.unsplash.com/premium_photo-1705352059948-e5512efca860?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - }, - ], - new: [ - { - _id: 1, - title: `${search} ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ3`, - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1682686581498-5e85c7228119?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - like: 5, - user: { - name: `${search}`, - image: - 'https://plus.unsplash.com/premium_photo-1705352059948-e5512efca860?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - }, - { - _id: 2, - title: `${search} ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ4`, - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1682686581498-5e85c7228119?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - like: 5, - user: { - name: `${search}`, - image: - 'https://plus.unsplash.com/premium_photo-1705352059948-e5512efca860?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, + _id: 5, + title: '๊ฐ•๋‚จ์—ญ ๊ทผ์ฒ˜ ์นดํŽ˜ ๋ชจ์Œ', + liked: 0, + userName: '์จ๋‹ˆ', + date: '2024.02.06', + image: null, + userImage: 'imagekey1', }, ], }, }); - } else { + }, + ), + // ํƒ์ƒ‰ํƒญ_์ตœ์‹  ์‹œ๊ทธ๋‹ˆ์ฒ˜ + http.get( + `${baseURL}${API_URL.SEARCH_SIGNATURE}/new`, + ({ request, params }) => { return HttpResponse.json({ - status: 200, + timestamp: '2024-02-05T20:12:21.562Z', + code: 'OK', success: true, - message: `ํƒ‘์ƒ‰ํƒญ ๋ฉ”์ธ ์ „์ฒด ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต`, + message: 'ํƒ์ƒ‰ํƒญ ๋ฉ”์ธ ํ™”๋ฉด ๊ฐ€์ ธ์˜ค๊ธฐ ์„ฑ๊ณต', data: { - hot: [ - { - _id: 3, - title: `์ „์ฒด ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ1`, - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1682686581498-5e85c7228119?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - like: 5, - user: { - name: '๋‹‰๋„ค์ž„', - image: - 'https://plus.unsplash.com/premium_photo-1705352059948-e5512efca860?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - }, - { - _id: 4, - title: `์ „์ฒด ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ2`, - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1682686581498-5e85c7228119?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - like: 5, - user: { - name: '๋‹‰๋„ค์ž„', - image: - 'https://plus.unsplash.com/premium_photo-1705352059948-e5512efca860?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - }, - ], - new: [ + covers: [ { - _id: 1, - title: `์ „์ฒด ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ3`, - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1682686581498-5e85c7228119?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - like: 5, - user: { - name: '๋‹‰๋„ค์ž„', - image: - 'https://plus.unsplash.com/premium_photo-1705352059948-e5512efca860?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, + _id: 5, + title: '๊ฐ•๋‚จ์—ญ ๊ทผ์ฒ˜ ์นดํŽ˜ ๋ชจ์Œ', + liked: 0, + userName: '์จ๋‹ˆ', + date: '2024.02.06', + image: null, + userImage: 'imagekey1', }, { - _id: 2, - title: `์ „์ฒด ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ4`, - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1682686581498-5e85c7228119?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - like: 5, - user: { - name: '๋‹‰๋„ค์ž„', - image: - 'https://plus.unsplash.com/premium_photo-1705352059948-e5512efca860?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, + _id: 5, + title: '๊ฐ•๋‚จ์—ญ ๊ทผ์ฒ˜ ์นดํŽ˜ ๋ชจ์Œ', + liked: 0, + userName: '์จ๋‹ˆ', + date: '2024.02.06', + image: null, + userImage: 'imagekey1', }, ], }, }); - } - }), + }, + ), ]; diff --git a/src/mocks/handlers/home.js b/src/mocks/handlers/home.js index bb87674f..bcea40e1 100644 --- a/src/mocks/handlers/home.js +++ b/src/mocks/handlers/home.js @@ -4,172 +4,12 @@ import { baseURL } from '@/apis/api'; import { API_URL } from '@/constants/path'; export const HomeHandlers = [ - //์›”๋ณ„ ์ผ์ • ๋ถˆ๋Ÿฌ์˜ค๊ธฐ (ํ™•์ •x) - http.get( - `${baseURL}${API_URL.LOAD_MONTHLY_SCHEDULE}`, - ({ request, params }) => { - const year = params.year; - const month = params.month; - - if (!year || !month) { - return new HttpResponse(null, { status: 404 }); - } else if (year && month) { - return HttpResponse.json({ - status: 200, - success: true, - message: '๋‹‰๋„ค์ž„ ์ˆ˜์ • ์„ฑ๊ณต', - data: { - year: year, - month: month, - monthlyJourneys: [ - { - journeyId: 123, - journeyTitle: 'My Journey', - dateGroup: { - id: 1, - startDate: '2024-02-05', - endDate: '2024-02-06', - }, - schedules: [ - { - scheduleId: 1, - date: `${year}-${month}-11`, - title: 'Day 1 Schedule', - location: { - name: 'Google Location', - latitude: 37.7749, - longitude: -122.4194, - }, - detailSchedules: [ - { - detailScheduleId: 101, - content: - 'Detail for Day 1 Detail for Day 1 Detail for Day 1 Detail for Day 1 Detail for Day 1', - }, - { - detailScheduleId: 102, - content: - 'Detail for Day 12 Detail for Day 12 Detail for Day 12 Detail for Day 12 Detail for Day 1', - }, - ], - diary_written: true, - }, - { - scheduleId: 2, - date: `${year}-${month}-12`, - title: 'Day 2 Schedule', - location: { - name: 'Google Location', - latitude: 37.7749, - longitude: -122.4194, - }, - detailSchedules: [ - { - detailScheduleId: 102, - content: 'Detail for Day 2 Schedule', - }, - ], - diary_written: false, - }, - { - scheduleId: 3, - date: `${year}-${month}-13`, - title: 'Day 3 Schedule', - location: { - name: 'Google Location', - latitude: 37.7749, - longitude: -122.4194, - }, - detailSchedules: [ - { - detailScheduleId: 103, - content: 'Detail for Day 3 Schedule', - }, - ], - diary_written: false, - }, - ], - }, - { - journeyId: 124, - journeyTitle: 'My Journey', - dateGroup: { - id: 1, - startDate: '2024-02-08', - endDate: '2024-02-14', - }, - schedules: [ - { - scheduleId: 5, - date: `${year}-${month}-11`, - title: 'Day 1 Schedule', - location: { - name: 'Google Location', - latitude: 37.7749, - longitude: -122.4194, - }, - detailSchedules: [ - { - detailScheduleId: 101, - content: - 'Detail for Day 1 Detail for Day 1 Detail for Day 1 Detail for Day 1 Detail for Day 1', - }, - { - detailScheduleId: 102, - content: - 'Detail for Day 12 Detail for Day 12 Detail for Day 12 Detail for Day 12 Detail for Day 1', - }, - ], - diary_written: true, - }, - { - scheduleId: 6, - date: `${year}-${month}-12`, - title: 'Day 2 Schedule', - location: { - name: 'Google Location', - latitude: 37.7749, - longitude: -122.4194, - }, - detailSchedules: [ - { - detailScheduleId: 102, - content: 'Detail for Day 2 Schedule', - }, - ], - diary_written: false, - }, - { - scheduleId: 7, - date: `${year}-${month}-13`, - title: 'Day 3 Schedule', - location: { - name: 'Google Location', - latitude: 37.7749, - longitude: -122.4194, - }, - detailSchedules: [ - { - detailScheduleId: 103, - content: 'Detail for Day 3 Schedule', - }, - ], - diary_written: false, - }, - ], - }, - ], - }, - }); - } - }, - ), //์—ฌ์ • ์ €์žฅํ•˜๊ธฐ http.post(`${baseURL}${API_URL.SAVE_JOURNEY}`, ({ params, request }) => { return HttpResponse.json({ status: 200, success: true, - message: '์—ฌ์ • ์ €์žฅํ•˜๊ธฐ ์„ฑ๊ณต', + message: '์—ฌ์ •์ด ์ €์žฅ๋˜์—ˆ์Šต๋‹ˆ๋‹ค', data: { id: 1, title: 'New Journey', @@ -227,143 +67,59 @@ export const HomeHandlers = [ }); }), //์ผ์ • ๋ถˆ๋Ÿฌ์˜ค๊ธฐ (์ปค์„œ ๊ธฐ๋ฐ˜) -> ํ™•์ • ์•ˆ๋จ - http.get(`${baseURL}${API_URL.GET_SCHEDULE}`, async ({ request, params }) => { - const url = new URL(request.url); - const journeyId = params.journeyId; - const cursor = parseInt(url.searchParams.get('cursor')) || 0; - if (!journeyId) { - return new HttpResponse(null, { status: 404 }); - } else if (journeyId) { - await delay(3000); + http.get( + `${baseURL}${API_URL.GET_MONTHLY_LIST_SCHEDULE}/:data`, + async ({ request, params }) => { + const url = new URL(request.url); + return HttpResponse.json({ - status: 200, - success: true, - message: '์ผ์ • ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต', - data: [ - { - scheduleId: cursor + 1, - journeyId: journeyId, - title: 'Exploration', - date: '2024-01-11', - location: { - name: 'Googleplex', - latitude: 37.422, - longitude: -122.0841, - }, - detailSchedules: [ - { - detailScheduleId: 1, - content: 'Morning exploration', - isDone: false, - }, - { - detailScheduleId: 2, - content: 'Afternoon adventure', - isDone: true, - }, - ], - diary_written: true, - }, - { - scheduleId: cursor + 2, - journeyId: journeyId, - title: 'Relaxation', - date: '2024-01-12', - location: { - name: 'Sunny Beach', - latitude: 36.7783, - longitude: -119.4179, - }, - detailSchedules: [ - { - detailScheduleId: 3, - content: 'Beach time', - isDone: false, - }, - { - detailScheduleId: 4, - content: 'Sunset watching', - isDone: true, - }, - ], - diary_written: false, - }, - { - scheduleId: cursor + 3, - journeyId: journeyId, - title: 'City Tour', - date: '2024-01-13', - location: { - name: 'City Center', - latitude: 37.7749, - longitude: -122.4194, - }, - detailSchedules: [ - { - detailScheduleId: 5, - content: 'Visit landmarks', - isDone: false, - }, - { - detailScheduleId: 6, - content: 'Try local cuisine', - isDone: false, - }, - ], - diary_written: false, - }, - { - scheduleId: cursor + 4, - journeyId: journeyId, - title: 'City Tour', - date: '2024-01-13', - location: { - name: 'City Center', - latitude: 37.7749, - longitude: -122.4194, + data: { + success: true, + code: 200, + message: '์ผ์ •๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š”๋ฐ ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค.', + data: { + journeyInfo: { + userId: 1, + journeyId: 6, + startDate: '2024-02-01', + endDate: '2024-02-15', }, - detailSchedules: [ + paginatedSchedules: [ { - detailScheduleId: 5, - content: 'Visit landmarks', - isDone: false, - }, - { - detailScheduleId: 6, - content: 'Try local cuisine', - isDone: false, + scheduleId: 17, + title: '2์›” 24์ผ ์ผ์ •', + date: '2024-02-01', + location: [ + { + locationId: 3, + name: '์„œ์šธ', + latitude: '11.000000', + longitude: '11.000000', + }, + ], + detailSchedules: [ + [ + { + id: 2, + content: null, + isDone: false, + }, + ], + ], + diary: [true], }, ], - diary_written: false, - }, - { - scheduleId: cursor + 5, - journeyId: journeyId, - title: 'City Tour', - date: '2024-01-13', - location: { - name: 'City Center', - latitude: 37.7749, - longitude: -122.4194, + meta: { + take: '1', + total: 15, + hasNextData: true, + cursor: 1, }, - detailSchedules: [ - { - detailScheduleId: 5, - content: 'Visit landmarks', - isDone: false, - }, - { - detailScheduleId: 6, - content: 'Try local cuisine', - isDone: false, - }, - ], - diary_written: false, }, - ], + }, }); - } - }), + }, + ), //์„ธ๋ถ€ ์ผ์ • ์ถ”๊ฐ€ํ•˜๊ธฐ http.post( `${baseURL}${API_URL.CREATE_DETAIL_SCHEDULE}`, @@ -618,66 +374,6 @@ export const HomeHandlers = [ 'https://images.unsplash.com/photo-1682687219570-4c596363fd96?w=900&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwyMXx8fGVufDB8fHx8fA%3D%3D', }, }, - { - journeyId: journeyId, - date: '2022-03-21', - diary: { - id: 2, - title: '์ผ์ง€', - place: '๋‚ด ์ง‘', - weather: 'SUNNY', - mood: 'HAPPY', - content: '5๋ฒˆ์งธ ์ผ์ง€๋ฅผ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค...', - created: '2024-02-06T20:07:47.266Z', - updated: '2024-02-06T20:07:47.266Z', - deleted: null, - }, - diaryImage: { - id: 2, - imageUrl: - 'https://images.unsplash.com/photo-1682687219570-4c596363fd96?w=900&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwyMXx8fGVufDB8fHx8fA%3D%3D', - }, - }, - { - journeyId: journeyId, - date: '2022-03-22', - diary: { - id: 3, - title: '์ผ์ง€', - place: '๋‚ด ์ง‘', - weather: 'SUNNY', - mood: 'HAPPY', - content: '5๋ฒˆ์งธ ์ผ์ง€๋ฅผ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค...', - created: '2024-02-06T20:07:47.266Z', - updated: '2024-02-06T20:07:47.266Z', - deleted: null, - }, - diaryImage: { - id: 3, - imageUrl: - 'https://images.unsplash.com/photo-1682687219570-4c596363fd96?w=900&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwyMXx8fGVufDB8fHx8fA%3D%3D', - }, - }, - { - journeyId: journeyId, - date: '2022-03-23', - diary: { - id: 4, - title: '์ผ์ง€', - place: '๋‚ด ์ง‘', - weather: 'SUNNY', - mood: 'HAPPY', - content: '5๋ฒˆ์งธ ์ผ์ง€๋ฅผ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค...', - created: '2024-02-06T20:07:47.266Z', - updated: '2024-02-06T20:07:47.266Z', - deleted: null, - }, - diaryImage: { - id: 4, - imageUrl: - 'https://images.unsplash.com/photo-1682687219570-4c596363fd96?w=900&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwyMXx8fGVufDB8fHx8fA%3D%3D', - }, - }, ], }); } @@ -753,9 +449,10 @@ export const HomeHandlers = [ // ์ „์ฒด ์ผ์ง€ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ (๋งˆ์ดํŽ˜์ด์ง€) http.get(`${baseURL}${API_URL.GET_ALL_DIARY}`, ({ params, request }) => { return HttpResponse.json({ - status: 200, + timestamp: '2024-02-11T16:13:33.881Z', + code: 'OK', success: true, - message: '์ง€๋„์—์„œ ์ผ์ง€ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต', + message: '์ผ์ง€ ๋ชฉ๋ก ์กฐํšŒ ์„ฑ๊ณต', data: { diaries: [ { diff --git a/src/mocks/handlers/mate.js b/src/mocks/handlers/mate.js index 7dbcf855..e4932a05 100644 --- a/src/mocks/handlers/mate.js +++ b/src/mocks/handlers/mate.js @@ -1,11 +1,11 @@ import { HttpResponse, http } from 'msw'; import { baseURL } from '@/apis/api'; -import { API_URL } from '@/constants/path'; +import { API_BASE, API_URL } from '@/constants/path'; export const MateHandlers = [ //๋ฉ”์ดํŠธ ๊ฒ€์ƒ‰ํ•˜๊ธฐ - http.get(`${baseURL}${API_URL.SEARCH_MATE}`, ({ request, params }) => { + http.get(`${baseURL}${API_URL.FOLLOW_MATE}/search`, ({ request, params }) => { const url = new URL(request.url); const searchTerm = url.searchParams.get('searchTerm'); const cursor = url.searchParams.get('cursor'); @@ -13,9 +13,7 @@ export const MateHandlers = [ if (!searchTerm) { return new HttpResponse(null, { status: 404 }); - } - - if (searchTerm === 'ahnyewon') { + } else { return HttpResponse.json({ status: 200, success: true, @@ -68,8 +66,8 @@ export const MateHandlers = [ }), //๋ฉ”์ดํŠธ ํŒ”๋กœ์šฐ - http.post( - `${baseURL}${API_URL.FOLLOW_MATE}/:userId`, + http.patch( + `${baseURL}${API_URL.FOLLOW_MATE}/:followingId`, ({ request, params }) => { const userId = params.userId; @@ -164,63 +162,117 @@ export const MateHandlers = [ }); }, ), + //๋ฉ”์ดํŠธ ํƒ์ƒ‰2 + http.get(`${baseURL}${API_URL.LOCATION_MATE}`, ({ request, params }) => { + const url = new URL(request.url); + const cursorId = parseInt(url.searchParams.get('cursor')) || 0; + const take = parseInt(url.searchParams.get('take')) || 0; - //ํŒ”๋กœ์›Œ ๋ชฉ๋ก ๋ถˆ๋Ÿฌ์˜ค๊ธฐ - http.get(`${baseURL}${API_URL.GET_MATE_FOLLOWER}`, ({ request, params }) => { + return HttpResponse.json({ + timestamp: '2024-02-09T11:49:13.427Z', + code: 'OK', + success: true, + message: '์žฅ์†Œ ๊ธฐ๋ฐ˜ ๋ฉ”์ดํŠธ ์ถ”์ฒœ ๋ฆฌ์ŠคํŠธ ๊ฐ€์ ธ์˜ค๊ธฐ ์„ฑ๊ณต', + data: { + location: '์•Œ๋ฒ ๋ฅด', + userName: '์ƒ๋ฆฌ', + mateProfiles: [ + { + _id: 3, + mateName: '์จ๋‹ˆ', + introduction: '์•ˆ๋…•ํ•˜์„ธ์š” ๋ฐ˜๊ฐ€์›Œ์š”', + is_followed: false, + mateImage: + 'https://hereyou-cdn.kaaang.dev/signature/07f8c65c-5966-4b2e-9d96-08d5d084d013.png', + signatures: [ + { + _id: 22, + title: '๊ฐ•๋‚จ์—ญ ๊ทผ์ฒ˜ ์นดํŽ˜ ์ถ”์ฒœ', + image: + 'https://hereyou-cdn.kaaang.dev/signature/07f8c65c-5966-4b2e-9d96-08d5d084d013.png', + }, + { + _id: 22, + title: '๊ฐ•๋‚จ์—ญ๊ทผ์ฒ˜', + image: + 'https://hereyou-cdn.kaaang.dev/signature/07f8c65c-5966-4b2e-9d96-08d5d084d013.png', + }, + ], + }, + { + _id: 4, + mateName: '์˜ˆ๋‹ˆ', + introduction: '์•ˆ๋…•ํ•˜์„ธ์š” ๋ฐ˜๊ฐ€์›Œ์š”', + is_followed: false, + mateImage: + 'https://hereyou-cdn.kaaang.dev/signature/07f8c65c-5966-4b2e-9d96-08d5d084d013.png', + signatures: { + _id: 22, + title: '๊ฐ•๋‚จ์—ญ ๊ทผ์ฒ˜ ์นดํŽ˜ ์ถ”์ฒœ', + image: + 'https://hereyou-cdn.kaaang.dev/signature/07f8c65c-5966-4b2e-9d96-08d5d084d013.png', + }, + }, + ], + }, + }); + }), + + //ํŒ”๋กœ์ž‰ ๋ชฉ๋ก ๋ถˆ๋Ÿฌ์˜ค๊ธฐ + http.get(`${baseURL}${API_URL.GET_MATE_FOLLOW}`, ({ request, params }) => { return HttpResponse.json({ status: 200, success: true, - message: 'ํŒ”๋กœ์›Œ ๋ฆฌ์ŠคํŠธ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต', + message: 'ํŒ”๋กœ์ž‰ ๋ฆฌ์ŠคํŠธ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต', data: { mates: [ { _id: 1, - name: '์•ˆ์˜ˆ์›', + name: 'ํŒ”๋กœ์ž‰_์•ˆ์˜ˆ์›', nickname: 'ahnyewon', - introduction: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์˜ˆ์› ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', + bio: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์˜ˆ์›์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', image: - 'https://plus.unsplash.com/premium_photo-1671478394583-3d91fd9c7ca5?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxN3x8fGVufDB8fHx8fA%3D%3D', + 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', followId: 123, }, { _id: 2, name: '์•ˆ์˜ˆ', nickname: 'ahnyw', - introduction: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์˜ˆ ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', + bio: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์˜ˆ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', image: - 'https://plus.unsplash.com/premium_photo-1671478394583-3d91fd9c7ca5?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxN3x8fGVufDB8fHx8fA%3D%3D', + 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', followId: 'null', }, ], }, }); }), - - //ํŒ”๋กœ์ž‰ ๋ชฉ๋ก ๋ถˆ๋Ÿฌ์˜ค๊ธฐ - http.get(`${baseURL}${API_URL.GET_MATE_FOLLOWING}`, ({ request, params }) => { + //ํŒ”๋กœ์›Œ ๋ชฉ๋ก ๋ถˆ๋Ÿฌ์˜ค๊ธฐ + http.get(`${baseURL}${API_URL.GET_MATE_FOLLOWER}`, ({ request, params }) => { return HttpResponse.json({ status: 200, success: true, - message: 'ํŒ”๋กœ์ž‰ ๋ฆฌ์ŠคํŠธ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต', + message: 'ํŒ”๋กœ์›Œ ๋ฆฌ์ŠคํŠธ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต', data: { mates: [ { _id: 1, - name: 'ํŒ”๋กœ์ž‰_์•ˆ์˜ˆ์›', + name: '์•ˆ์˜ˆ์›', nickname: 'ahnyewon', - bio: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์˜ˆ์›์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', + introduction: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์˜ˆ์› ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - is_following: true, + 'https://plus.unsplash.com/premium_photo-1671478394583-3d91fd9c7ca5?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxN3x8fGVufDB8fHx8fA%3D%3D', + followId: 123, }, { _id: 2, name: '์•ˆ์˜ˆ', nickname: 'ahnyw', - bio: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์˜ˆ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', + introduction: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์˜ˆ ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - is_following: false, + 'https://plus.unsplash.com/premium_photo-1671478394583-3d91fd9c7ca5?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxN3x8fGVufDB8fHx8fA%3D%3D', + followId: 'null', }, ], }, @@ -354,54 +406,63 @@ export const MateHandlers = [ } return HttpResponse.json({ - timestamp: '2024-02-08T12:15:07.069Z', + timestamp: '2024-02-12T07:35:57.786Z', code: 'OK', success: true, - message: '์—ฌํ–‰ ๊ทœ์น™ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต', - data: [ - { - id: 123, - mainTitle: '์ œ์ฃผ๋„ ์—ฌํ–‰', - detailMembers: [ - { - id: 1234, - name: '๊น€์šฉ๋ฏผ', - nickname: 'dydals3440', - introduction: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์˜ˆ์› ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - { - id: 12345, - name: '๋‹ค์ธ', - nickname: 'chakk', - introduction: '์•ˆ๋…•ํ•˜์„ธ์š” ์•ˆ์› ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - { - id: 1235, - name: '์˜ˆ์›', - nickname: 'yewon', - introduction: '์•ˆ๋…•ํ•˜์„ธ์š” ์˜ˆ์› ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๊ฐ€์›Œ์š”', - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - ], - rulePairs: [ - { - id: 123, - ruleTitle: '๊ทœ์น™ ์ œ๋ชฉ1', - ruleDetail: '์„ธ๋ถ€ ๋‚ด์šฉ1', - }, - { - id: 124, - ruleTitle: '๊ทœ์น™ ์ œ๋ชฉ2', - ruleDetail: '์„ธ๋ถ€ ๋‚ด์šฉ2', - }, - ], + message: '์—ฌํ–‰ ๊ทœ์น™ ์ƒ์„ธ ํŽ˜์ด์ง€ (๊ฒŒ์‹œ๊ธ€) ์กฐํšŒ ์„ฑ๊ณต', + data: { + id: '21', + mainTitle: '์ผ๋ณธ ์—ฌํ–‰', + rulePairs: [ + { + id: 40, + ruleTitle: '์ทจ์นจ ์‹œ๊ฐ„ ๊ทœ์น™', + ruleDetail: '12์‹œ์—” ์ž๊ธฐ', + }, + { + id: 41, + ruleTitle: '๊ธฐ์ƒ ๊ทœ์น™', + ruleDetail: '7์‹œ ๊ธฐ์ƒ', + }, + ], + detailMembers: [ + { + id: 2, + name: 'Test2', + image: null, + }, + { + id: 3, + name: 'Test3', + image: null, + }, + { + id: 1, + name: 'Test1', + image: null, + }, + ], + comments: [ + { + id: 1234, + image: 'profile_img_url', + text: '์™„๋ฒฝํ•œ ๊ทœ์น™์ด๋„ค์š”', + created: 1675275543, + }, + { + id: 124, + image: 'profile_img_url', + text: '์™„๋ฒฝํ•œ ๊ทœ์น™์ด๋„ค์š”', + created: 1675275543, + }, + ], + metaToBack: { + total: 3, + take: 2, + cursor: 1, + hasNextData: true, }, - ], + }, }); }, ), @@ -541,8 +602,6 @@ export const MateHandlers = [ ({ request, params }) => { const ruleId = params.ruleId; - console.log(ruleId); - if (!ruleId) { return new HttpResponse(null, { status: 404 }); } @@ -558,72 +617,86 @@ export const MateHandlers = [ //์—ฌํ–‰ ๊ทœ์น™ ์ „์ฒด ๋ฆฌ์ŠคํŠธ http.get(`${baseURL}${API_URL.GET_TEAM_RULE_LIST}`, ({ request, params }) => { return HttpResponse.json({ - status: 200, + timestamp: '2024-02-10T15:33:53.125Z', + code: 'OK', success: true, - message: '์ฐธ์—ฌ ์ค‘์ธ ์—ฌํ–‰ ๊ทœ์น™ ๋ฆฌ์ŠคํŠธ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต', - data: { - rules: [ - { - id: 1, - memberCnt: 3, - title: '์ œ์ฃผ๋„ ์—ฌํ–‰์„ ์œ„ํ•œ ๊ทœ์น™', - updated: 1675275543, - participants: [ - { - id: 345, - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - { - id: 678, - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - ], - }, - { - id: 2, - memberCnt: 3, - title: '์ œ์ฃผ๋„ ์—ฌํ–‰์„ ์œ„ํ•œ ๊ทœ์น™', - updated: 1675275543, - participants: [ - { - id: 345, - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - { - id: 678, - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - ], - }, - { - id: 3, - memberCnt: 3, - title: '์ œ์ฃผ๋„ ์—ฌํ–‰์„ ์œ„ํ•œ ๊ทœ์น™', - updated: 1675275543, - participants: [ - { - id: 345, - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - { - id: 678, - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', - }, - ], - }, - ], - }, + message: '์—ฌํ–‰ ๊ทœ์น™ ์ „์ฒด ๋ฆฌ์ŠคํŠธ ์กฐํšŒ ์„ฑ๊ณต', + data: [ + { + id: '20', + title: '์ผ๋ณธ ์—ฌํ–‰', + updated: '2024-02-09T03:37:32.711Z', + memberCnt: 3, + memberPairs: [ + { + id: 3, + name: 'Test3', + image: null, + }, + { + id: 2, + name: 'Test2', + image: null, + }, + { + id: 1, + name: 'Test1', + image: null, + }, + ], + }, + { + id: '21', + title: '์ผ๋ณธ ์—ฌํ–‰', + updated: '2024-02-09T04:47:27.972Z', + memberCnt: 3, + memberPairs: [ + { + id: 2, + name: 'Test2', + image: null, + }, + { + id: 3, + name: 'Test3', + image: null, + }, + { + id: 1, + name: 'Test1', + image: null, + }, + ], + }, + { + id: '31', + title: '์ค‘๊ตญ ์—ฌํ–‰', + updated: '2024-02-09T13:18:30.953Z', + memberCnt: 3, + memberPairs: [ + { + id: 2, + name: 'Test2', + image: null, + }, + { + id: 3, + name: 'Test3', + image: null, + }, + { + id: 1, + name: 'Test1', + image: null, + }, + ], + }, + ], }); }), // ์—ฌํ–‰ ๊ทœ์น™ ์ฐธ์—ฌ์—์„œ ๋‚˜๊ฐ€๊ธฐ - http.delete(`${API_URL.EXIT_TEAM_RULE}`, ({ request, params }) => { + http.delete(`${API_URL.EXIT_TEAM_RULE}/:ruleId`, ({ request, params }) => { const ruleId = params.ruleId; if (!ruleId) { @@ -636,4 +709,85 @@ export const MateHandlers = [ message: '์—ฌํ–‰ ๊ทœ์น™์—์„œ ๋‚˜๊ฐ€๊ธฐ ์„ฑ๊ณต', }); }), + //๋ฉ”์ดํŠธ ํ”„๋กœํ•„ ์ •๋ณด + http.get( + `${baseURL}${API_URL.MATE_PROFILE_SEARCH}/:mateId`, + ({ request, params }) => { + return HttpResponse.json({ + timestamp: '2024-02-10T17:27:55.001Z', + code: 'OK', + success: true, + message: '์œ ์ € ํ”„๋กœํ•„ ์ •๋ณด ๊ฐ€์ ธ์˜ค๊ธฐ ์„ฑ๊ณต', + data: { + _id: 1, + nickname: '์—ฌํ–‰์˜ ์ด์œ ', + introduction: '์กธ๋ฆฌ๋‹น', + image: null, + is_followed: true, + following: 1, + follower: 2, + signatures: 28, + isQuit: false, + }, + }); + }, + ), + + //๋ฉ”์ดํŠธ ์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋ฆฌ์ŠคํŠธ + http.get( + `${baseURL}${API_URL.MATE_PROFILE_SEARCH}/signature/:mateId`, + ({ request, params }) => { + const url = new URL(request.url); + const take = parseInt(url.searchParams.get('take')) || 5; + const cursorId = parseInt(url.searchParams.get('cursorId')) || 0; + if (!cursorId) { + return new HttpResponse(null, { status: 404 }); + } else { + return HttpResponse.json({ + timestamp: '2024-02-10T19:54:19.895Z', + code: 'OK', + success: true, + message: '๋ฉ”์ดํŠธ์˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜ ๊ฐ€์ ธ์˜ค๊ธฐ ์„ฑ๊ณต', + data: { + data: [ + { + _id: 27, + title: '์•Œ๋ฒ ๋ฅด ํ…Œ์ŠคํŠธ ์œ ์ €5', + liked: 0, + image: + 'https://hereyou-cdn.kaaang.dev/signature/91a3d721-0998-44e6-91a0-843c00f3ab1b.png', + }, + { + _id: 26, + title: '์•Œ๋ฒ ๋ฅด ํ…Œ์ŠคํŠธ ์œ ์ €5', + liked: 0, + image: + 'https://hereyou-cdn.kaaang.dev/signature/d5956637-c404-4985-8a12-764455ce6cad.png', + }, + { + _id: 25, + title: '์•Œ๋ฒ ๋ฅด ํ…Œ์ŠคํŠธ ์œ ์ €5', + liked: 0, + image: + 'https://hereyou-cdn.kaaang.dev/signature/300492d8-34ec-44f2-9fff-2de15686ad75.png', + }, + { + _id: 24, + title: '์•Œ๋ฒ ๋ฅด ํ…Œ์ŠคํŠธ ์œ ์ €5', + liked: 0, + image: + 'https://hereyou-cdn.kaaang.dev/signature/c663dc21-3b0e-4902-aa11-b90d91a12787.png', + }, + ], + meta: { + take: '5', + total: 4, + hasNextData: false, + cursor: null, + }, + }, + }); + } + }, + ), ]; diff --git a/src/mocks/handlers/profile.js b/src/mocks/handlers/profile.js index 2885a90b..1422e18b 100644 --- a/src/mocks/handlers/profile.js +++ b/src/mocks/handlers/profile.js @@ -58,21 +58,33 @@ export const ProfileHandlers = [ data: [ { id: 1, - type: 'LIKE', - content: '์ƒ์ถ”๋ถ€์ž, ์ด๋…•12๋‹˜ ์™ธ 10๋ช…์ด ๋‚ด ์‹œ๊ทธ๋‹ˆ์ฒ˜์— ์ข‹์•„์š”', + content: { + actionUserNickname: '์ƒ์ถ”๋ถ€์ž', + type: 'SIGNATURE', + action: 'LIKE', + }, itemId: 10, + itemDesc: 'ํ…Œ์ŠคํŠธ ๊ฒŒ์‹œ๋ฌผ', isRead: false, created: '2024-02-11T14:52:14.240Z', }, + ], + }); + }), + // ์ฝ์ง€ ์•Š์€ ์•Œ๋ฆผ์˜ ๊ฐœ์ˆ˜ ์กฐํšŒ + http.get(`${baseURL}${API_URL.NOTIFICATION}/unread`, () => { + return HttpResponse.json({ + status: 200, + success: true, + message: '์•Œ๋ฆผ ์กฐํšŒ ์„ฑ๊ณต', + data: [ { - id: 2, - type: 'COMMENT', - content: '์ƒ์ถ”๋ถ€์ž, ์ด๋…•12๋‹˜ ์™ธ 10๋ช…์ด ๋‚ด ์‹œ๊ทธ๋‹ˆ์ฒ˜์— ์ข‹์•„์š”', - }, - { - id: 3, - type: 'INVITE', + id: 1, + type: 'LIKE', content: '์ƒ์ถ”๋ถ€์ž, ์ด๋…•12๋‹˜ ์™ธ 10๋ช…์ด ๋‚ด ์‹œ๊ทธ๋‹ˆ์ฒ˜์— ์ข‹์•„์š”', + itemId: 10, + isRead: false, + created: '2024-02-11T14:52:14.240Z', }, ], }); diff --git a/src/mocks/handlers/signature.js b/src/mocks/handlers/signature.js index b4e4b178..801180fa 100644 --- a/src/mocks/handlers/signature.js +++ b/src/mocks/handlers/signature.js @@ -8,22 +8,21 @@ export const SignatureHandlers = [ http.get(`${baseURL}${API_URL.GET_MY_SIGNATURE}`, ({ request, params }) => { return HttpResponse.json({ status: 200, + code: 'OK', success: true, - message: '๋‚ด ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์กฐํšŒ ์„ฑ๊ณต', + message: '๋‚ด ์‹œ๊ทธ๋‹ˆ์ฒ˜ ๊ฐ€์ ธ์˜ค๊ธฐ ์„ฑ๊ณต', data: [ { - id: '01', - title: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ1', - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', + id: 1, + title: 'ํ˜ธ์ฃผ์™€ ๊ฒจ๋ฃฌ 8๊ฐ•์ „ ์ง๊ด€ ํ›„๊ธฐ', + date: '2024-02-03T08:03:22.000Z', + image: null, }, { - id: '02', - title: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ2', - date: '24/01/19', - image: - 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', + id: 2, + title: '๊ฐ•๋‚จ์—ญ ๊ทผ์ฒ˜ ์นดํŽ˜ ๋ชจ์Œ', + date: '2024-02-03T08:14:40.000Z', + image: null, }, ], }); @@ -74,7 +73,7 @@ export const SignatureHandlers = [ return HttpResponse.json({ status: 200, success: true, - message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ์กฐํšŒ ์„ฑ๊ณต', + message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ƒ์„ธ๋ณด๊ธฐ ์„ฑ๊ณต: ๋‚ด ์‹œ๊ทธ๋‹ˆ์ฒ˜', data: { author: { _id: 2, @@ -126,25 +125,28 @@ export const SignatureHandlers = [ `${baseURL}${API_URL.GET_DETAIL_SIGNATURE}`, ({ request, params }) => { return HttpResponse.json({ - title: '์ƒˆ๋กœ์šด ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ œ๋ชฉ', + title: '์‹ ์‚ฌ์—ญ ๊ทผ์ฒ˜ ์นดํŽ˜ ๋ชจ์Œ', pages: [ { - content: '์˜ค๋Š˜์€ ํ˜ธ์ˆ˜ ๊ณต์›์„ ์‚ฐ์ฑ…ํ–ˆ์Šต๋‹ˆ๋‹ค ์–ด์ฉŒ๊ตฌ', - location: '๊ด‘๊ต ํ˜ธ์ˆ˜ ๊ณต์›', + _id: 20, + content: '๊ณต๊ฐ„์ด ๋งค์šฐ ๋„“๊ณ  ๋‚˜๋ฌด๊ฐ€ ๋งŽ์•„์„œ ์ˆฒ์— ์˜จ ๊ฒƒ ๊ฐ™์€ ๋А๋‚Œ! ', + location: '์ˆ˜์ €์–ด์–ด์–ด์–ด์–ด์–ด์–ด์–ด์—‰', page: 1, image: 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', }, { - content: '์ €๋Š” ์›๋ž˜ ํ˜ธ์ˆ˜ ์‚ฐ์ฑ…์„ ์ฐธ ์ข‹์•„ํ•˜๋Š”๋ฐ์š” ์–ด์ฉŒ๊ตฌ', - location: '๋™๋ฐฑ ํ˜ธ์ˆ˜ ๊ณต์›', + _id: 21, + content: '๋ฒ ๋ผ ์‹ซ์Œ ', + location: '๋ฒ ์Šคํ‚จ๋ผ๋นˆ์Šค', page: 2, image: 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', }, { - content: '์˜ค๋Š˜์€ ํ˜ธ์ˆ˜ ๊ณต์›์„ ์‚ฐ์ฑ…ํ–ˆ์Šต๋‹ˆ๋‹ค ์–ด์ฉŒ๊ตฌ', - location: '๊ด‘๊ต ํ˜ธ์ˆ˜ ๊ณต์›', + _id: 22, + content: '๋ณด๋“œ๊ฒŒ์ž„ ์‹ซ์Œ ', + location: '๋ ˆ๋“œ๋ฒ„ํŠผ', page: 3, image: 'https://images.unsplash.com/photo-1671920090611-9a40303b52cb?q=80&w=1965&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D', @@ -165,9 +167,11 @@ export const SignatureHandlers = [ `${baseURL}${API_URL.GET_DETAIL_SIGNATURE}`, ({ request, params }) => { return HttpResponse.json({ - status: 204, + timestamp: '2024-02-05T07:40:21.691Z', + code: 'OK', success: true, - message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ์‚ญ์ œํ•˜๊ธฐ ์„ฑ๊ณต', + message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ์‚ญ์ œ ์„ฑ๊ณต', + data: null, }); }, ), @@ -186,8 +190,187 @@ export const SignatureHandlers = [ }); }), - //์‹œ๊ทธ๋‹ˆ์ฒ˜_์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ข‹์•„์š”ํ•œ ์‚ฌ์šฉ์ž ๋ชฉ๋ก (API๋ช…์„ธ์„œ ๋ฏธ์™„์„ฑ) - // http.get(`${baseURL}${API_URL.LIKE_SIGNATURE}`, ({ request, params }) => { - // return HttpResponse.json(); - // }), + // ์‹œ๊ทธ๋‹ˆ์ฒ˜_์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ข‹์•„์š”ํ•œ ์‚ฌ์šฉ์ž ๋ชฉ๋ก + http.get(`${baseURL}${API_URL.LIKE_SIGNATURE}`, ({ request, params }) => { + return HttpResponse.json({ + timestamp: '2024-02-05T15:03:14.672Z', + code: 'OK', + success: true, + message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ์ข‹์•„์š” ๋ชฉ๋ก ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ์„ฑ๊ณต', + data: { + liked: 3, + profiles: [ + { + _id: 1, + image: 'imagekey1', + introduction: '์‚ฌ์šฉ์ž ์†Œ๊ฐœ', + nickname: '์™„๋‘์ฝฉ', + is_followed: null, + }, + { + _id: 2, + image: 'imagekey2', + introduction: '์‚ฌ์šฉ์ž ์†Œ๊ฐœ', + nickname: '๊ฐ•๋‚ญ์ฝฉ', + is_followed: false, + }, + { + _id: 3, + image: 'imagekey3', + introduction: '์‚ฌ์šฉ์ž ์†Œ๊ฐœ', + nickname: '๊ฒ€์€์ฝฉ', + is_followed: false, + }, + ], + }, + }); + }), + //์‹œ๊ทธ๋‹ˆ์ฒ˜_์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋Œ“๊ธ€ ์ž‘์„ฑํ•˜๊ธฐ + http.post( + `${baseURL}${API_URL.GET_DETAIL_SIGNATURE}/comment`, + ({ request, params }) => { + return HttpResponse.json({ + timestamp: '2024-02-12T18:55:52.393Z', + code: 'CREATED', + success: true, + message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋Œ“๊ธ€ ์ƒ์„ฑ ์„ฑ๊ณต', + data: 2, + }); + }, + ), + //์‹œ๊ทธ๋‹ˆ์ฒ˜_์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋‹ต๊ธ€ ์ž‘์„ฑํ•˜๊ธฐ + http.post( + `${baseURL}${API_URL.GET_DETAIL_SIGNATURE}/comment/:parentId`, + ({ request, params }) => { + return HttpResponse.json({ + timestamp: '2024-02-12T18:55:52.393Z', + code: 'CREATED', + success: true, + message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋‹ต๊ธ€ ์ƒ์„ฑ ์„ฑ๊ณต', + data: 2, + }); + }, + ), + //์‹œ๊ทธ๋‹ˆ์ฒ˜_์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋Œ“๊ธ€/๋‹ต๊ธ€ ์ˆ˜์ •ํ•˜๊ธฐ + http.patch( + `${baseURL}${API_URL.GET_DETAIL_SIGNATURE}/comment/:commentId`, + ({ request, params }) => { + return HttpResponse.json({ + timestamp: '2024-02-13T09:39:40.316Z', + code: 'OK', + success: true, + message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋Œ“๊ธ€ ์ˆ˜์ •ํ•˜๊ธฐ ์„ฑ๊ณต', + data: 2, + }); + }, + ), + //์‹œ๊ทธ๋‹ˆ์ฒ˜_์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋Œ“๊ธ€/๋‹ต๊ธ€ ์‚ญ์ œํ•˜๊ธฐ + http.delete( + `${baseURL}${API_URL.GET_DETAIL_SIGNATURE}/comment/:commentId`, + ({ request, params }) => { + return HttpResponse.json({ + timestamp: '2024-02-13T18:14:31.531Z', + code: 'OK', + success: true, + message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋Œ“๊ธ€ ์‚ญ์ œํ•˜๊ธฐ ์„ฑ๊ณต', + data: '1', + }); + }, + ), + // ์‹œ๊ทธ๋‹ˆ์ฒ˜_์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋Œ“๊ธ€/๋‹ต๊ธ€ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ + http.get( + `${baseURL}${API_URL.GET_DETAIL_SIGNATURE}/comment`, + + ({ request, params }) => { + const url = new URL(request.url); + const take = parseInt(url.searchParams.get('take')) || 5; + const cursorId = parseInt(url.searchParams.get('cursorId')) || 0; + if (!cursorId) { + return new HttpResponse(null, { status: 404 }); + } else { + return HttpResponse.json({ + timestamp: '2024-02-12T18:21:21.636Z', + code: 'OK', + success: true, + message: '์‹œ๊ทธ๋‹ˆ์ฒ˜ ๋Œ“๊ธ€ ๊ฐ€์ ธ์˜ค๊ธฐ ์„ฑ๊ณต', + data: { + data: [ + { + _id: 2, + content: '์šฐ์™€', + parentId: 2, // (parentId == _id) ์ด๋ฏ€๋กœ ํ•ด๋‹น ๋Œ“๊ธ€์ด ๋ถ€๋ชจ ๋Œ“๊ธ€ + writer: { + _id: 3, + name: '๊ณ ๊ตฌ๋งˆ', + is_writer: true, // ํ˜„์žฌ ๋กœ๊ทธ์ธํ•œ ํšŒ์›(id=4)์€ ์ž‘์„ฑ์ž ๋ณธ์ธ + image: null, + }, + date: '2024.02.13', + is_edited: false, // ๋Œ“๊ธ€ ์ˆ˜์ •๋œ์  ์—†์Œ + }, + { + _id: 3, + content: '์šฐ์™€ ๋‹ต๊ธ€1', + parentId: 2, // (parentId != _id) ์ด๋ฏ€๋กœ ํ•ด๋‹น ๋Œ“๊ธ€์€ ๋‹ต๊ธ€ + writer: { + _id: 3, + name: '๊ณ ๊ตฌ๋งˆ', + is_writer: true, + image: null, + }, + date: '2024.02.13', + is_edited: false, + }, + { + _id: 5, + content: '์šฐ์™€ ๋‹ต๊ธ€2', + parentId: 2, + writer: { + _id: 3, + name: '๊ณ ๊ตฌ๋งˆ', + is_writer: true, + image: null, + }, + date: '2024.02.13', + is_edited: false, + }, + { + _id: 7, + content: '๋‹ต๊ธ€์ž…๋‹ˆ๋‹ค', + parentId: 2, + writer: { + _id: 4, + name: '๊ฐ์ž', // ๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž(id=4)์™€ ์ž‘์„ฑ์ž๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์Œ + is_writer: false, // ๊ทธ๋Ÿฌ๋ฏ€๋กœ is_writer๋Š” false + image: null, + }, + date: '2024.02.13', + is_edited: false, + }, // ์—ฌ๊ธฐ๊นŒ์ง€๊ฐ€ ๋ถ€๋ชจ ๋Œ“๊ธ€ ์•„์ด๋””๊ฐ€ 2์ธ ๋Œ“,๋‹ต๊ธ€๋“ค + { + // ์ด์ œ ๋‹ค์Œ ๋ถ€๋ชจ ๋Œ“๊ธ€,๋‹ต๊ธ€๋“ค์ด ์ถœ๋ ฅ๋จ + _id: 4, + content: '์žฌ๋ฐŒ๋„ค์š”!', + parentId: 4, + writer: { + _id: 3, + name: '๊ณ ๊ตฌ๋งˆ', + is_writer: true, + image: null, + }, + date: '2024.02.13', + is_edited: false, + }, + ], + meta: { + take: '5', + total: 6, + hasNextData: true, + cursor: 4, + }, + }, + }); + } + }, + ), ]; diff --git a/src/pages/dailyRecord/edit/DailyRecordEdit.style.js b/src/pages/dailyRecord/edit/DailyRecordEdit.style.js index 270d277c..9610bdf2 100644 --- a/src/pages/dailyRecord/edit/DailyRecordEdit.style.js +++ b/src/pages/dailyRecord/edit/DailyRecordEdit.style.js @@ -141,6 +141,7 @@ const TitleText = styled.input` font-weight: 700; text-align: center; border: none; + padding: 0 5px; &::placeholder { color: #aaa; diff --git a/src/pages/explore/followRedirect/FollowRedirectPage.jsx b/src/pages/explore/followRedirect/FollowRedirectPage.jsx new file mode 100644 index 00000000..c6fab338 --- /dev/null +++ b/src/pages/explore/followRedirect/FollowRedirectPage.jsx @@ -0,0 +1,20 @@ +import { useNavigate } from 'react-router-dom'; + +import * as S from './FollowRedirectPage.style'; +import AirplaneImg from '/images/onboarding1.svg'; + +const FollowRedirectPage = () => { + const navigate = useNavigate(); + return ( + + + + ๋กœ๊ทธ์ธํ•˜๊ณ  ๋‚ด ๋ฉ”์ดํŠธ์™€ + ์ƒˆ๋กœ์šด ์—ฌํ–‰ ๊ธฐ๋ก์„ ํ™•์ธํ•ด๋ณด์„ธ์š”! + navigate('/login')}>๋กœ๊ทธ์ธ ํ•˜๊ธฐ + + + ); +}; + +export default FollowRedirectPage; diff --git a/src/pages/explore/followRedirect/FollowRedirectPage.style.js b/src/pages/explore/followRedirect/FollowRedirectPage.style.js new file mode 100644 index 00000000..c894070a --- /dev/null +++ b/src/pages/explore/followRedirect/FollowRedirectPage.style.js @@ -0,0 +1,43 @@ +import styled from 'styled-components'; + +import theme from '@/theme'; + +const PageContainer = styled.div` + display: flex; + justify-content: center; + align-items: center; + width: 70%; + height: 40vh; + margin: 0 auto; +`; +const ContentContainer = styled.div` + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: center; + gap: 10px; +`; + +const Text = styled.div` + display: flex; + font-size: 18px; + font-family: 'Pretendard-bold'; +`; + +const Button = styled.div` + display: flex; + background-color: ${theme.COLOR.MAIN.GREEN}; + color: white; + font-size: 20px; + filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25)); + border-radius: 30px; + padding: 12px 50px; + + cursor: pointer; + + &:hover { + transform: scale(0.95); + } +`; + +export { PageContainer, ContentContainer, Button, Text }; diff --git a/src/pages/login/Login.jsx b/src/pages/login/Login.jsx index 788e4e0e..c6f90fcd 100644 --- a/src/pages/login/Login.jsx +++ b/src/pages/login/Login.jsx @@ -1,60 +1,15 @@ -import { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; - import * as S from './Login.style'; import plane from '/images/airplane.svg'; import Logo from '/images/main.svg'; -import { axios, axiosWithToken } from '@/apis/api'; import LoginButton from '@/components/login/LoginButton'; -import useAuth from '@/store/useAuth'; const LoginPage = () => { - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); - const navigate = useNavigate(); - const { login } = useAuth(); - - const handleSubmit = async e => { - e.preventDefault(); - - try { - const response = await axios.post( - 'https://hereyou.kaaang.dev/api/v1/user/login', - { - email, - password, - }, - ); - - console.log(response); - login(response.data.token); - navigate('/'); - } catch (error) { - console.error('Login failed:', error.message); - } - }; - return ( -
- setEmail(e.target.value)} - /> - setPassword(e.target.value)} - /> - -
); diff --git a/src/pages/mate/Mate.jsx b/src/pages/mate/Mate.jsx index b9211a65..6f94fafa 100644 --- a/src/pages/mate/Mate.jsx +++ b/src/pages/mate/Mate.jsx @@ -77,7 +77,7 @@ const MatePage = () => { console.error(e); } }}> - {member.isFollowing === true ? '์–ธํŒ”๋กœ์šฐ' : 'ํŒ”๋กœ์šฐ'} + {member.isFollowing === true ? 'ํŒ”๋กœ์ž‰' : 'ํŒ”๋กœ์šฐ'} {member.introduction} diff --git a/src/pages/mate/Mate.style.js b/src/pages/mate/Mate.style.js index eefd8b48..7e258bdc 100644 --- a/src/pages/mate/Mate.style.js +++ b/src/pages/mate/Mate.style.js @@ -57,7 +57,7 @@ const NickNameContainer = styled.div` const FollowButton = styled.button` background-color: ${props => - props.follow ? theme.COLOR.MAIN.RED : theme.COLOR.MAIN.MEDIUM_GREEN}; + props.follow ? theme.COLOR.MAIN.GRAY : theme.COLOR.MAIN.MEDIUM_GREEN}; padding: 8px 16px; border: none; border-radius: 20px; diff --git a/src/pages/mate/main/MateMain.jsx b/src/pages/mate/main/MateMain.jsx index 9eb2bb1f..f7cd368e 100644 --- a/src/pages/mate/main/MateMain.jsx +++ b/src/pages/mate/main/MateMain.jsx @@ -1,9 +1,12 @@ +import toast from 'react-hot-toast'; + import * as S from './MateMain.style'; import mateRuleCheckIcon from '/images/mate/mateRule_check.svg'; import mateRuleWriteIcon from '/images/mate/mateRule_write.svg'; import mateManagementIcon from '/images/mate/mate_management.svg'; import mateSearchIcon from '/images/mate/mate_search.svg'; import Card from '@/components/mate/Card'; +import useAuth from '@/store/useAuth'; const MY_MATE = [ { @@ -39,15 +42,24 @@ const OUR_RULE = [ }, ]; -const renderCards = data => { - return data.map(({ id, link, text1, text2, imgSrc }) => ( - - - - )); +const renderCards = (data, isLogin) => { + return isLogin + ? data.map(({ id, link, text1, text2, imgSrc }) => ( + + + + )) + : data.map(({ id, link, text1, text2, imgSrc }) => ( + toast('๋กœ๊ทธ์ธ ํ›„ ์ด์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.')}> + + + )); }; const MateMainPage = () => { + const { isLogin } = useAuth(); return ( @@ -57,13 +69,13 @@ const MateMainPage = () => { ๋‚ด ๋ฉ”์ดํŠธ ๋‚˜์™€ ํ•จ๊ป˜ ์—ฌํ–‰ ํ•  ๋ฉ”์ดํŠธ๋“ค์„ ์ฐพ์•„๋ณด์„ธ์š”! - {renderCards(MY_MATE)} + {renderCards(MY_MATE, isLogin)} ์šฐ๋ฆฌ ์—ฌํ–‰์˜ ๊ทœ์น™์€? ํ•จ๊ป˜ ์—ฌํ–‰ํ•  ๋ฉ”์ดํŠธ๋“ค๊ณผ ๊ทœ์น™์„ ์ •ํ•ด๋ณด์„ธ์š”! - {renderCards(OUR_RULE)} + {renderCards(OUR_RULE, isLogin)} ); diff --git a/src/pages/mate/main/MateMain.style.js b/src/pages/mate/main/MateMain.style.js index 52cac9fa..7daef71d 100644 --- a/src/pages/mate/main/MateMain.style.js +++ b/src/pages/mate/main/MateMain.style.js @@ -74,6 +74,10 @@ const LinkTo = styled(Link)` color: inherit; `; +const CardButton = styled.div` + cursor: pointer; +`; + export { Maincontainer, SpanWrapper, @@ -82,4 +86,5 @@ export { Des, CardContainer, LinkTo, + CardButton, }; diff --git a/src/pages/mate/ruleEdit/RuleEdit.jsx b/src/pages/mate/ruleEdit/RuleEdit.jsx index 960d871b..e2c1a0db 100644 --- a/src/pages/mate/ruleEdit/RuleEdit.jsx +++ b/src/pages/mate/ruleEdit/RuleEdit.jsx @@ -84,7 +84,6 @@ const RuleEditPage = () => { rulePairs: sortedRulePairs, membersId: extractMembersId, }; - console.log(postDataWithId); updateTeamMateRule(ruleId, { postDataWithId }) .then(() => { diff --git a/src/pages/mate/ruleEdit/RuleEdit.style.js b/src/pages/mate/ruleEdit/RuleEdit.style.js index f40e2310..f466c113 100644 --- a/src/pages/mate/ruleEdit/RuleEdit.style.js +++ b/src/pages/mate/ruleEdit/RuleEdit.style.js @@ -2,6 +2,7 @@ import styled from 'styled-components'; import { FONT_SIZE } from '@/constants/size'; import theme from '@/theme'; +import { th } from 'date-fns/locale'; const Container = styled.div` ${theme.ALIGN.COLUMN_CENTER}; @@ -89,6 +90,7 @@ const DeleteRuleButton = styled.button` border-radius: 10px; text-align: center; cursor: pointer; + color: ${theme.COLOR.MAIN.BLACK}; &:hover { transform: scale(0.9); @@ -122,6 +124,7 @@ const AddQuestionButton = styled.button` border-radius: 10px; background-color: ${theme.COLOR.MAIN.LIGHT_GREEN}; cursor: pointer; + color: ${theme.COLOR.MAIN.BLACK}; &:hover { transform: scale(0.9); diff --git a/src/pages/mate/ruleWrite/MateRuleWrite.style.js b/src/pages/mate/ruleWrite/MateRuleWrite.style.js index 4ed76f41..dfe38964 100644 --- a/src/pages/mate/ruleWrite/MateRuleWrite.style.js +++ b/src/pages/mate/ruleWrite/MateRuleWrite.style.js @@ -86,6 +86,7 @@ const DeleteRuleButton = styled.button` border-radius: 10px; text-align: center; cursor: pointer; + color: ${theme.COLOR.MAIN.BLACK}; &:hover { transform: scale(0.9); @@ -127,6 +128,7 @@ const AddQuestionButton = styled.button` border-radius: 10px; background-color: ${theme.COLOR.MAIN.LIGHT_GREEN}; cursor: pointer; + color: ${theme.COLOR.MAIN.BLACK}; &:hover { transform: scale(0.9); diff --git a/src/pages/mypage/diary/MyDiary.jsx b/src/pages/mypage/diary/MyDiary.jsx index 521dc268..6e4e87e4 100644 --- a/src/pages/mypage/diary/MyDiary.jsx +++ b/src/pages/mypage/diary/MyDiary.jsx @@ -30,7 +30,7 @@ const MyDiary = () => { - {isFetching + {isLoading ? new Array(10).fill(0).map(() => ) : diaryList?.map((page, pageIndex) => ( diff --git a/src/pages/notification/Notification.jsx b/src/pages/notification/Notification.jsx index 10fe9f7a..3ce1f51e 100644 --- a/src/pages/notification/Notification.jsx +++ b/src/pages/notification/Notification.jsx @@ -5,13 +5,14 @@ import { useGetNotification } from '@/hooks/notification/useGetNotification'; const Notification = () => { const { data, isPending, isError } = useGetNotification(); - const notification = data?.data?.data; + const notifications = data?.data?.data; + return ( {isPending ? ( ) : ( - + )} ); diff --git a/src/pages/quitUserPage/QuitUserPage.jsx b/src/pages/quitUserPage/QuitUserPage.jsx index d611cf88..4427d05c 100644 --- a/src/pages/quitUserPage/QuitUserPage.jsx +++ b/src/pages/quitUserPage/QuitUserPage.jsx @@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom'; import * as S from './QuitUserPage.style'; import RedirectIcon from '/images/RedirectIcon.png'; -const QuitUserPage = ({ type }) => { +const QuitUserPage = ({ type, bgColor }) => { const navigate = useNavigate(); let message; switch (type) { @@ -16,11 +16,14 @@ const QuitUserPage = ({ type }) => { case 'not-login': message = '๋กœ๊ทธ์ธ ํ›„ ์„œ๋น„์Šค๋ฅผ ์ด์šฉํ•ด์ฃผ์„ธ์š”!'; break; + case 'no-diary-data': + message = '์ž‘์„ฑํ•˜์‹  ํ•˜๋ฃจ์ผ์ง€๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.'; + break; default: message = ''; } return ( - +

{message}

navigate('/')}>ํ™ˆ ํ™”๋ฉด์œผ๋กœ ๋Œ์•„๊ฐ€๊ธฐ diff --git a/src/pages/quitUserPage/QuitUserPage.style.js b/src/pages/quitUserPage/QuitUserPage.style.js index 03014cf0..fe2fdd99 100644 --- a/src/pages/quitUserPage/QuitUserPage.style.js +++ b/src/pages/quitUserPage/QuitUserPage.style.js @@ -20,7 +20,8 @@ const Container = styled.div` width: 100%; height: 100%; gap: 30px; - background-color: ${theme.COLOR.MAIN.LIGHT_GRAY}; + background-color: ${props => + props?.$bgColor ? props.$bgColor : `${theme.COLOR.MAIN.LIGHT_GRAY}`}; h3 { color: ${theme.COLOR.MAIN.BLACK}; diff --git a/src/pages/signature/SignaturePage.jsx b/src/pages/signature/SignaturePage.jsx index 5fe9a3df..f8e7ab7d 100644 --- a/src/pages/signature/SignaturePage.jsx +++ b/src/pages/signature/SignaturePage.jsx @@ -1,13 +1,15 @@ -import React, { useEffect, useState } from 'react'; +import React, { useState } from 'react'; +import toast from 'react-hot-toast'; import * as S from './SignaturePage.style'; import MySignaturePage from './main/MySignaturePage'; import Editor from './write/Editor'; -import { getSignaturePreview } from '@/apis/request/preview'; import Banner from '@/components/banner/Banner'; +import useAuth from '@/store/useAuth'; import useSignatureWrite from '@/store/useSignatureWrite'; export default function SignaturePage() { + const { isLogin } = useAuth(); const [selectedHeader, setSelectedHeader] = useState('๋‚ด ์‹œ๊ทธ๋‹ˆ์ฒ˜'); const handleHeaderClick = header => { setSelectedHeader(header); @@ -22,7 +24,7 @@ export default function SignaturePage() { { - if (selectedHeader === '์ž‘์„ฑํ•˜๊ธฐ') { + if (selectedHeader === '์ž‘์„ฑํ•˜๊ธฐ' && isLogin) { if ( !confirm( '์ง€๊ธˆ ์ž‘์„ฑ ์ค‘์ธ ๋ชจ๋“  ๋‚ด์šฉ์ด ์‚ฌ๋ผ์ง‘๋‹ˆ๋‹ค.\n๋‚ด ์‹œ๊ทธ๋‹ˆ์ฒ˜๋กœ ์ด๋™ํ• ๊นŒ์š”?', @@ -41,8 +43,12 @@ export default function SignaturePage() { { - handleHeaderClick('์ž‘์„ฑํ•˜๊ธฐ'); - addPage(); + if (isLogin) { + handleHeaderClick('์ž‘์„ฑํ•˜๊ธฐ'); + addPage(); + } else { + toast('๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•œ ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค.'); + } }}> ์ž‘์„ฑํ•˜๊ธฐ diff --git a/src/pages/signature/main/MySignaturePage.jsx b/src/pages/signature/main/MySignaturePage.jsx index 9b4f7df0..b5195141 100644 --- a/src/pages/signature/main/MySignaturePage.jsx +++ b/src/pages/signature/main/MySignaturePage.jsx @@ -3,9 +3,16 @@ import NoSignature from './NoSignature'; import Preview from '@/components/preview/Preview'; import PreviewSkeleton from '@/components/preview/skeleton/PreviewSkeleton'; import { useSignaturePreview } from '@/hooks/signature/useSignaturePreview '; +import { QuitUserPage } from '@/pages'; +import theme from '@/theme'; const MySignaturePage = () => { const { data: signaturePreview, loading, error } = useSignaturePreview(); + if (error) { + return ( + + ); + } return ( {loading ? ( diff --git a/src/pages/signature/main/NoSignature.jsx b/src/pages/signature/main/NoSignature.jsx index cc2702ea..50a2762e 100644 --- a/src/pages/signature/main/NoSignature.jsx +++ b/src/pages/signature/main/NoSignature.jsx @@ -1,17 +1,12 @@ -import React from 'react'; -import { useNavigate } from 'react-router-dom'; - import * as S from './NoSignature.style'; import bookImg from '/images/bookImg.svg'; -//๋‚ด ์‹œ๊ทธ๋‹ˆ์ฒ˜ ์—†์œผ๋ฉด ๋„์šฐ๋Š” ํŽ˜์ด์ง€ export default function NoSignature() { - const navigate = useNavigate(); return ( - ์•„์ง ์ž‘์„ฑํ•œ ์‹œ๊ทธ๋‹ˆ์ฒ˜๊ฐ€ ์—†์–ด์š”! + ์•„์ง ์ž‘์„ฑํ•œ ์‹œ๊ทธ๋‹ˆ์ฒ˜๊ฐ€ ์—†์–ด์š”!! ); diff --git a/src/pages/signature/write/Editor.jsx b/src/pages/signature/write/Editor.jsx index d2582ba1..31cbb881 100644 --- a/src/pages/signature/write/Editor.jsx +++ b/src/pages/signature/write/Editor.jsx @@ -118,7 +118,9 @@ export default function Editor({ setSelectedHeader }) { - ๋ฐœํ–‰ + + ๋ฐœํ–‰ + {(currentPageIndex === pages.length - 1 || pages.length === 1) && ( ํŽ˜์ด์ง€ ์ถ”๊ฐ€ )}