From 58edcbd909ebea952a90cded6ba706c42084f808 Mon Sep 17 00:00:00 2001 From: Chaeyeon1 <66813821+Chaeyeon1@users.noreply.github.com> Date: Thu, 30 Nov 2023 02:42:21 +0900 Subject: [PATCH 1/8] =?UTF-8?q?Github=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EB=93=A4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/api/github-api.ts | 13 +-- client/src/api/index.ts | 2 +- client/src/api/pr-api.ts | 14 ++- client/src/api/write-api.ts | 8 +- .../home/[categoryId]/[postId]/page.tsx | 21 ++++- .../[blogName]/prList/[categoryId]/page.tsx | 56 +++++++----- .../components/DND/CreateCategoryModal.tsx | 85 ++++++++++--------- client/src/components/DND/DragAndDrop.tsx | 43 +++++----- client/src/components/Github/Github.tsx | 49 ++++++++--- client/src/components/Layout/FullLayout.tsx | 7 +- client/src/constant/common.ts | 4 +- client/src/types/dto.ts | 38 ++++++++- 12 files changed, 225 insertions(+), 115 deletions(-) diff --git a/client/src/api/github-api.ts b/client/src/api/github-api.ts index 03f63d8a..a6079640 100644 --- a/client/src/api/github-api.ts +++ b/client/src/api/github-api.ts @@ -1,4 +1,4 @@ -import { RepositoryParams } from '@/types/dto'; +import { Repository, RepositoryParams } from '@/types/dto'; import { defaultInstance } from '.'; import { useQuery } from '@tanstack/react-query'; @@ -9,14 +9,17 @@ export const getRepositoryApi = async () => { }; export const useGetRepositoryQuery = () => { - const { isLoading, error, data } = useQuery([`repository`], () => getRepositoryApi()); + const { + isLoading, + error, + data: backendData, + } = useQuery([`repository`], () => getRepositoryApi()); + const data: Repository = backendData; return { data, isLoading, error }; }; export const PostRepository = async (body: RepositoryParams) => { - const { data } = await defaultInstance.put('/repository', { - body, - }); + const { data } = await defaultInstance.post('/repository', body); return data; }; diff --git a/client/src/api/index.ts b/client/src/api/index.ts index 837d1b97..1062c263 100644 --- a/client/src/api/index.ts +++ b/client/src/api/index.ts @@ -8,7 +8,7 @@ const axiosApi = (url: string, data?: any) => { if (typeof window !== 'undefined') { token = localStorage.getItem('token'); } - console.log(token); + const instance = axios.create({ baseURL: url, withCredentials: true, diff --git a/client/src/api/pr-api.ts b/client/src/api/pr-api.ts index f9411738..9d150011 100644 --- a/client/src/api/pr-api.ts +++ b/client/src/api/pr-api.ts @@ -1,4 +1,4 @@ -import { IPRParams } from '@/types/dto'; +import { IPRParams, IPostedPost, IUnPostedPost } from '@/types/dto'; import { defaultInstance } from '.'; import { useQuery } from '@tanstack/react-query'; @@ -9,7 +9,10 @@ export const getPRApi = async (params: IPRParams) => { }; export const useGetPRQuery = (params: IPRParams) => { - const { isLoading, error, data } = useQuery([`prList`], () => getPRApi(params)); + const { isLoading, error, data: backendData } = useQuery([`prList`], () => getPRApi(params)); + + const data: IPostedPost = backendData; + return { data, isLoading, error }; }; @@ -20,6 +23,11 @@ export const getPRUnPostedApi = async (params: IPRParams) => { }; export const useGetPRUnpostedQuery = (params: IPRParams) => { - const { isLoading, error, data } = useQuery([`prUnpostedList`], () => getPRUnPostedApi(params)); + const { + isLoading, + error, + data: backendData, + } = useQuery([`prUnpostedList`], () => getPRUnPostedApi(params)); + const data: IUnPostedPost = backendData; return { data, isLoading, error }; }; diff --git a/client/src/api/write-api.ts b/client/src/api/write-api.ts index c95ce054..3083eefd 100644 --- a/client/src/api/write-api.ts +++ b/client/src/api/write-api.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; import { defaultInstance } from '.'; -import { ITemplateDetailParams, ITemporaryDetailParams } from '@/types/dto'; +import { IRemovePostParams, ITemplateDetailParams, ITemporaryDetailParams } from '@/types/dto'; export const PostWriteApi = async (body: FormData) => { const { data } = await defaultInstance.post('/post', body, { @@ -22,6 +22,12 @@ export const UpdateWriteApi = async (body: FormData) => { return data; }; +export const DeleteWriteApi = async (params: IRemovePostParams) => { + const { data } = await defaultInstance.delete('/post', { params }); + + return data; +}; + const GetTemplateApi = async () => { const { data } = await defaultInstance.get(`/template`); diff --git a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx index 726fdd21..c31cbe48 100644 --- a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx +++ b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx @@ -44,6 +44,8 @@ import CloseIcon from '@mui/icons-material/Close'; import Image from 'next/image'; import FootPrintAnimation from '@/components/FootPrint/FootPrintAnimation'; import { usegetblogIdQuery } from '@/api/readme-api'; +import { DeleteWriteApi } from '@/api/write-api'; +import { enqueueSnackbar } from 'notistack'; const page = ({ params }: { params: { blogName: string; categoryId: string; postId: string } }) => { const { data: blogIdData } = usegetblogIdQuery({ blogUrl: params.blogName }); @@ -131,6 +133,20 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post setBlogId(blogIdData); }, [sidebarData, postData, introduceData, replyData, blogIdData]); + const deleteWritePrQuery = useMutation(DeleteWriteApi, { + onSuccess: () => { + queryClient.invalidateQueries(['postData']); + enqueueSnackbar({ message: '게시글 삭제가 완료되었습니다.', variant: 'success' }); + }, + onError: () => { + enqueueSnackbar({ message: '에러가 발생하였습니다.', variant: 'error' }); + }, + }); + + const deletePrPostOnClick = (postId: number) => { + deleteWritePrQuery.mutate({ postId }); + }; + //댓글 정렬기준 const [anchorEl, setAnchorEl] = React.useState(null); const handleClick = (event: React.MouseEvent) => { @@ -139,7 +155,6 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post const handleClose = () => { setAnchorEl(null); }; - return ( @@ -190,7 +205,9 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post - + diff --git a/client/src/app/[blogName]/prList/[categoryId]/page.tsx b/client/src/app/[blogName]/prList/[categoryId]/page.tsx index 0f98a6d1..72381198 100644 --- a/client/src/app/[blogName]/prList/[categoryId]/page.tsx +++ b/client/src/app/[blogName]/prList/[categoryId]/page.tsx @@ -11,10 +11,27 @@ import Image from 'next/image'; import React from 'react'; import EmptyContent from '../../../../../public/assets/box.png'; import Complete from '../../../../../public/assets/complete-icon.svg'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { DeleteWriteApi } from '@/api/write-api'; +import { enqueueSnackbar } from 'notistack'; function page({ params }: { params: { categoryId: string } }) { const { data: postedData } = useGetPRQuery({ categoryId: Number(params.categoryId) }); const { data: unPostedData } = useGetPRUnpostedQuery({ categoryId: Number(params.categoryId) }); + const queryClient = useQueryClient(); + const deleteWritePrQuery = useMutation(DeleteWriteApi, { + onSuccess: () => { + queryClient.invalidateQueries(['prList']); + enqueueSnackbar({ message: 'PR 삭제가 완료되었습니다.', variant: 'success' }); + }, + onError: () => { + enqueueSnackbar({ message: '에러가 발생하였습니다.', variant: 'error' }); + }, + }); + + const deletePrPostOnClick = (postId: number) => { + deleteWritePrQuery.mutate({ postId }); + }; return ( @@ -22,9 +39,9 @@ function page({ params }: { params: { categoryId: string } }) { 작성하지 않은 PR - {unPostedData?.map((unPost: { id: number }, i: number) => { + {unPostedData?.prUnpostedDtos?.prUnpostedDtos?.map((unPost) => { return ( - + #77 - {/* FIXME : 이미지 수정해야함. */} - {/* profileImage */} - 로딩구현 ㅏㅁㅇ나러ㅏㅇㅁㄹ ㄴ아 ㄴㅇ라ㅓ ㄴ ㄹ + {unPost.prTitle} @@ -85,20 +91,24 @@ function page({ params }: { params: { categoryId: string } }) { 작성한 PR 목록 - {postedData?.prPostedDtos?.prPostedDtos || - postedData?.prPostedDtos?.prPostedDtos?.length > 0 ? ( - postedData.prPostedDtos.prPostedDtos?.map((post: { id: number }, i: number) => { + {postedData?.prPostedDtos?.prPostedDtos?.length > 0 ? ( + postedData.prPostedDtos.prPostedDtos?.map((post) => { return ( - - + + diff --git a/client/src/components/DND/CreateCategoryModal.tsx b/client/src/components/DND/CreateCategoryModal.tsx index 19ead622..e1dc8743 100644 --- a/client/src/components/DND/CreateCategoryModal.tsx +++ b/client/src/components/DND/CreateCategoryModal.tsx @@ -6,15 +6,15 @@ import ModalButton from '../Modal/ModalButton'; import { ModalType } from '@/types/common'; import Button from '../Button/Button'; import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { PostCategoryApi } from '@/api/category-api'; +import { PostCategoryApi } from '@/api/category-api'; import CheckIcon from '@mui/icons-material/Check'; import CloseIcon from '@mui/icons-material/Close'; function CreateCategoryModal({ open, onClose }: ModalType) { const queryClient = useQueryClient(); const [categoryName, setCategoryName] = useState(''); - const [repositoryUrl, setRepositoryUrl] = useState(''); - const [isPrCategory, setIsPrCategory] = useState(Boolean); + const [, setRepositoryUrl] = useState(''); + const [, setIsPrCategory] = useState(Boolean); const postCategoryQuery = useMutation(PostCategoryApi, { onSuccess() { queryClient.invalidateQueries(['guestbook']); @@ -23,14 +23,13 @@ function CreateCategoryModal({ open, onClose }: ModalType) { const postCategoryClick = () => { const newCategoryBody = { categoryName: categoryName, - isPrCategory: isPrCategory, - repositoryUrl: repositoryUrl, + isPrCategory: false, + repositoryUrl: '', }; postCategoryQuery.mutate(newCategoryBody); onClose(); }; - return ( @@ -38,55 +37,57 @@ function CreateCategoryModal({ open, onClose }: ModalType) { - - - 카테고리 이름 : - - { - setCategoryName(e.target.value); - }} - /> + + + 카테고리 이름 : - - 깃허브 연동 여부 : - - + { + setCategoryName(e.target.value); + }} + /> + + + 깃허브 연동 여부 : + + - - + + 레포지토리 URL : - { - setRepositoryUrl(e.target.value); - }} /> + { + setRepositoryUrl(e.target.value); + }} + /> - + ); } -export default CreateCategoryModal; \ No newline at end of file +export default CreateCategoryModal; diff --git a/client/src/components/DND/DragAndDrop.tsx b/client/src/components/DND/DragAndDrop.tsx index 168eec93..f11724f4 100644 --- a/client/src/components/DND/DragAndDrop.tsx +++ b/client/src/components/DND/DragAndDrop.tsx @@ -18,6 +18,7 @@ import CreateCategoryModal from './CreateCategoryModal'; type Footprint = { categoryId: number; categoryName: string; + isPrCategory: boolean; postTitleDtos: { postId: number; title: string; @@ -37,7 +38,7 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro const [createCategoryOpen, setCreateCategoryOpen] = useState(false); const [open, setOpen] = useState(false); const [categoryId, setCategoryId] = useState(0); - const [paramsCategoryId, setParamsCategoryId] = useState(Number) + const [paramsCategoryId, setParamsCategoryId] = useState(Number); const router = useRouter(); useEffect(() => { @@ -98,27 +99,28 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro - {/* FIXME : 레포지토리 연동 여부 받아와야 함 */} - { - <> - { - setCategoryId(category.categoryId); - }} - href={`${blogName}/prList/${category.categoryId}`}> - - PR 연동 - - - setOpen(true)} - sx={{ cursor: 'pointer' }} - pl={4} - py={1}> + {category?.isPrCategory ? ( + { + setCategoryId(category.categoryId); + }} + href={`/${blogName}/prList/${category.categoryId}`}> + PR 연동 - - } + + ) : ( + { + setOpen(true); + setCategoryId(category.categoryId); + }} + sx={{ cursor: 'pointer' }} + pl={4} + py={1}> + PR 연동 + + )} ); })} - {(provided) => { diff --git a/client/src/components/Github/Github.tsx b/client/src/components/Github/Github.tsx index d1b23fe4..ed38166a 100644 --- a/client/src/components/Github/Github.tsx +++ b/client/src/components/Github/Github.tsx @@ -1,10 +1,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import React from 'react'; +import React, { useState } from 'react'; import Modal from '../Modal/Modal'; import { ModalTitle } from '../Modal/Modal.style'; import { PostRepository, useGetRepositoryQuery } from '@/api/github-api'; -import { Stack } from '@mui/material'; import { useMutation, useQueryClient } from '@tanstack/react-query'; +import List from '../List/List'; +import Button from '../Button/Button'; +import { Stack } from '@mui/material'; function Github({ open, @@ -17,6 +19,7 @@ function Github({ }) { const queryClient = useQueryClient(); const { data: datas } = useGetRepositoryQuery(); + const [clickList, setClickList] = useState(0); const putAllowFriendIdCreateQuery = useMutation(PostRepository, { onSuccess: () => { @@ -25,17 +28,37 @@ function Github({ }); return ( - Repository 선택 - {/* FIXME : 백엔드 타입 알게 되면 수정해야함 */} - {datas?.repository?.map((data: any, i: any) => { - return ( - putAllowFriendIdCreateQuery.mutate({ category: categoryId, repo: i })} - key={i}> - {data} - - ); - })} + + + Repository 선택 + + + + {datas?.repository?.map((repo, i: number) => { + return ( + setClickList(i), + }} + content={repo} + key={i} + /> + ); + })} + + ); } diff --git a/client/src/components/Layout/FullLayout.tsx b/client/src/components/Layout/FullLayout.tsx index 5bea9168..926535fa 100644 --- a/client/src/components/Layout/FullLayout.tsx +++ b/client/src/components/Layout/FullLayout.tsx @@ -3,6 +3,7 @@ import { Stack } from '@mui/material'; import { Theme, styled } from '@mui/material/styles'; import { usePathname } from 'next/navigation'; +import { SnackbarProvider } from 'notistack'; // import { useAndroidSSR, useIphoneSSR } from '../../../hooks/useRecoilSSR'; type Children = { @@ -22,5 +23,9 @@ const MainStack = styled(Stack, { export default function FullLayout({ children }: Children) { const pathname = usePathname(); - return {children}; + return ( + + {children} + + ); } diff --git a/client/src/constant/common.ts b/client/src/constant/common.ts index 4dd1b739..825fb9e7 100644 --- a/client/src/constant/common.ts +++ b/client/src/constant/common.ts @@ -15,8 +15,8 @@ export const getCurrentThemeClass = ( export const API_BASE_URL = 'http://glogglogglog-env.eba-fuksumx7.ap-northeast-2.elasticbeanstalk.com'; -// export const OAUTH2_REDIRECT_URI = 'http://localhost:3000/oauth2/redirect'; -export const OAUTH2_REDIRECT_URI = 'http://15.164.221.35:3000/oauth2/redirect'; +export const OAUTH2_REDIRECT_URI = 'http://localhost:3000/oauth2/redirect'; +// export const OAUTH2_REDIRECT_URI = 'http://15.164.221.35:3000/oauth2/redirect'; export const GITHUB_AUTH_URL = API_BASE_URL + '/oauth2/authorization/github?redirect_uri=' + OAUTH2_REDIRECT_URI; diff --git a/client/src/types/dto.ts b/client/src/types/dto.ts index e4fa487c..fd0194f9 100644 --- a/client/src/types/dto.ts +++ b/client/src/types/dto.ts @@ -139,6 +139,7 @@ export interface ISidebar { export interface ISidebarContent { categoryId: number; categoryName: string; + isPrCategory: boolean; postTitleDtos: { postId: number; title: string; @@ -198,6 +199,11 @@ export interface IPostContent { viewsCount?: number; } +// 게시글 삭제 +export interface IRemovePostParams { + postId: number; +} + //리드미 get export interface IReadMeParams { blogId?: number; @@ -323,9 +329,14 @@ export interface IIntroduce { friendCount: number; } +// 레포지토리 +export interface Repository { + repository: string[]; +} + // 레포지토리 가져오기 export interface RepositoryParams { - category?: number; + categoryId?: number; repo?: string; } @@ -432,3 +443,28 @@ export interface IUserInfo { export interface IBlogInfo { newBlogName: string; } + +// pr unposted +export interface IUnPostedPost { + isAuthor: boolean; + prUnpostedDtos: { + prUnpostedDtos: { + prId: number; + prNumber: number; + prTitle: string; + }[]; + }; +} + +// pr posted +export interface IPostedPost { + isAuthor: boolean; + prPostedDtos: { + prPostedDtos: { + postId: number; + prId: number; + prNumber: number; + prTitle: string; + }[]; + }; +} From 6e216405182bd882c3a9ce9cae5a62ce03e06c60 Mon Sep 17 00:00:00 2001 From: Chaeyeon1 <66813821+Chaeyeon1@users.noreply.github.com> Date: Thu, 30 Nov 2023 03:51:20 +0900 Subject: [PATCH 2/8] =?UTF-8?q?#163=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/api/.index.ts.swp | Bin 0 -> 12288 bytes client/src/api/blog-api.ts | 14 ++++--- client/src/api/category-api.ts | 40 +++++++++--------- client/src/api/friend-api.ts | 42 +++++++++++-------- client/src/api/github-api.ts | 4 +- client/src/api/index.ts | 16 +++++++ client/src/api/introduce-api.ts | 18 ++++---- client/src/api/reply-api.ts | 4 +- client/src/api/userDetail-api.ts | 24 +++++------ client/src/app/oauth2/redirect/page.tsx | 2 +- client/src/app/register/page.tsx | 7 ---- client/src/components/Header/SettingMenu.tsx | 34 ++++++++++++--- client/src/components/Layout/Header.tsx | 24 +++++------ 13 files changed, 137 insertions(+), 92 deletions(-) create mode 100644 client/src/api/.index.ts.swp delete mode 100644 client/src/app/register/page.tsx diff --git a/client/src/api/.index.ts.swp b/client/src/api/.index.ts.swp new file mode 100644 index 0000000000000000000000000000000000000000..2cb62be85c9dfd3e66b16990fcf19d2f702ec91c GIT binary patch literal 12288 zcmeI2zmMER6vyXiXb3?d(WH4HNcKr*+BZ4>;o(iX zl%7{Oo>S`A^^DIvT=5x)*>}-4WACH?lzv|o~dC$A#m9%uZE+3ow>0b(F zZ*jc{uFCS#S^g+@%Szkh?D~y&uOnpGhOG8^rYn;fJLOdx>c`fUpb!uOPfFmFy0~|t z`>CIM=`6kQ{Ou>bQSyX<5D)@FKnMr{As_^VfDrf}5D3+ddVoHj8hW8&-TB)(oXR2u zgn$qb0zyCt2mv7=1cZPP5CTF#2>b^L=&4d)KBLsdQ!tPJ|7qyqkJC#14*dju1wDie zbO}<>pU*1w8}uFY1@t+zf$l>E#LzY90`wyEH1rGh_!;^U`T_bL`WE^I`WpHSdKGHD z>_Kt}0U;m+gn$qb0zyCt2mv7=1pZ|LyZeeLnuk!0vuswn*;WbLk5iuLq-Yj(vs}HF z>MF6$hdJvyBzq~BSWP}*ZR?=RMT)WKXry>mA&GK_C{4N0O&Jc`44X3@kX{*AU#U!t zH>`GR&!O>_%#g86D_pY+`?CIroa0|AZ zdwm{UPTALET6cFJnJ~ZRd5TeNqf3N?Z@AB#=$dc8e`8FIFWX4(d~0ZHIn6!m!11~@ z*rvFWF&#dOyIo-z;mwHd9AUuQ9o-!|*mRo{)f_%(-NoHJ`K{o*o^d+ka2R+QM_r9* zceu$E6o=!AT|s>{I(u+HQG?0x!dRY0yIoUF&2JY4=OK=F>EJSAC+6>T1xF{_-bEKk zzZKBI>vizP&geebrYtYVQG{*#p10o(vSYv)Q=dAb_FH&kOqgjOcFHp1x->Q*T { return { data, isLoading, error }; }; -export const getIsNewBlogApi = async () => { - const { data } = await defaultInstance.get('/is/new/blog'); +export const getIsNewBlogApi = async (token?: string | null) => { + const { data } = await unAxiosDefaultInstance.get('/is/new/blog', { + headers: { + Authorization: `Bearer ${token}`, + }, + }); return data; }; -export const useGetIsNewBlogQuery = () => { - const { isLoading, error, data } = useQuery([`isNewBlog`], () => getIsNewBlogApi(), {}); +export const useGetIsNewBlogQuery = (token?: string | null) => { + const { isLoading, error, data } = useQuery([`isNewBlog`], () => getIsNewBlogApi(token), {}); return { data, isLoading, error }; }; diff --git a/client/src/api/category-api.ts b/client/src/api/category-api.ts index b7590da8..56d0ab90 100644 --- a/client/src/api/category-api.ts +++ b/client/src/api/category-api.ts @@ -1,36 +1,36 @@ -import { ICategoryParams, IDeleteCategory, IPostCategory, IPutCategory } from "@/types/dto"; -import { defaultInstance } from "."; -import { useQuery } from "@tanstack/react-query"; +import { ICategoryParams, IDeleteCategory, IPostCategory, IPutCategory } from '@/types/dto'; +import { defaultInstance } from '.'; +import { useQuery } from '@tanstack/react-query'; //카테고리 이름/pr연동여부 가져오기 export const GetCategoryApi = async (params: ICategoryParams) => { - const { data } = await defaultInstance.get('/category', { params }); - - return data; + const { data } = await defaultInstance.get('/category', { params }); + + return data; }; - - export const useGetCategoryQuery = (params: ICategoryParams) => { - const { isLoading, error, data } = useQuery(['category', params], () => GetCategoryApi(params)); - - return { isLoading, error, data }; + +export const useGetCategoryQuery = (params: ICategoryParams) => { + const { isLoading, error, data } = useQuery(['category', params], () => GetCategoryApi(params)); + + return { isLoading, error, data }; }; //카테고리 생성 export const PostCategoryApi = async (body: IPostCategory) => { - const { data } = await defaultInstance.post('/category', body); - return data; + const { data } = await defaultInstance.post('/category', body); + return data; }; //카테고리 이름 수정 export const PutCategoryApi = async (body: IPutCategory) => { - const { data } = await defaultInstance.put('/category', body); - return data; + const { data } = await defaultInstance.put('/category', body); + return data; }; //카테고리 삭제 export const DeleteCategoryApi = async (params: IDeleteCategory) => { - const { data } = await defaultInstance.delete('/category', { - params, - }); - return data; -}; \ No newline at end of file + const { data } = await defaultInstance.delete('/category', { + params, + }); + return data; +}; diff --git a/client/src/api/friend-api.ts b/client/src/api/friend-api.ts index f2b2c286..1209d1fe 100644 --- a/client/src/api/friend-api.ts +++ b/client/src/api/friend-api.ts @@ -1,4 +1,11 @@ -import { IDeleteFriend, IFriendAllow, IFriendReadParams, IFriendRequest, IFriendSearchParams, IFriendsParams } from '@/types/dto'; +import { + IDeleteFriend, + IFriendAllow, + IFriendReadParams, + IFriendRequest, + IFriendSearchParams, + IFriendsParams, +} from '@/types/dto'; import { defaultInstance } from '.'; import { useQuery } from '@tanstack/react-query'; @@ -16,31 +23,30 @@ export const useGetFriendQuery = (params: IFriendsParams) => { //친구 검색 export const GetFriendSearchApi = async (params: IFriendSearchParams) => { - const {data} = await defaultInstance.get('/search/friend/name', {params}); + const { data } = await defaultInstance.get('/search/friend/name', { params }); return data; -} +}; export const useGetFriendSearchQuery = (params: IFriendSearchParams) => { - const {isLoading, error, data } = useQuery(['search', params], () => GetFriendSearchApi(params)); + const { isLoading, error, data } = useQuery(['search', params], () => GetFriendSearchApi(params)); - return {isLoading, error, data }; -} + return { isLoading, error, data }; +}; -//친구 요청 +//친구 요청 export const PutFriendRequestApi = async (body: IFriendRequest) => { - const { data } = await defaultInstance.put(`/friend?userId=${body.userId}`, - body, - ); + const { data } = await defaultInstance.put(`/friend?userId=${body.userId}`, body); return data; -} +}; //친구 요청 수락/거절 export const PutFriendAllowApi = async (body: IFriendAllow) => { - const { data } = await defaultInstance.put(`/friend/allow?isAccept=${body.isAccept}&userId=${body.userId}`, - body, - ); + const { data } = await defaultInstance.put( + `/friend/allow?isAccept=${body.isAccept}&userId=${body.userId}`, + body, + ); return data; }; @@ -56,12 +62,14 @@ export const DeleteFriendApi = async (params: IDeleteFriend) => { //새 포스트 읽음 유무 export const GetFriendReadApi = async (params: IFriendReadParams) => { - const { data } = await defaultInstance.get('/friend/read', {params}); + const { data } = await defaultInstance.get('/friend/read', { params }); return data; }; export const useGetFriendReadQuery = (params: IFriendReadParams) => { - const { isLoading, error, data } = useQuery(['friendRead', params], () => GetFriendReadApi(params)); + const { isLoading, error, data } = useQuery(['friendRead', params], () => + GetFriendReadApi(params), + ); return { data, isLoading, error }; -}; \ No newline at end of file +}; diff --git a/client/src/api/github-api.ts b/client/src/api/github-api.ts index a6079640..669e08fd 100644 --- a/client/src/api/github-api.ts +++ b/client/src/api/github-api.ts @@ -19,7 +19,9 @@ export const useGetRepositoryQuery = () => { }; export const PostRepository = async (body: RepositoryParams) => { - const { data } = await defaultInstance.post('/repository', body); + const { data } = await defaultInstance.post( + `/repository?categoryId=${body.categoryId}&repo=${body.repo}`, + ); return data; }; diff --git a/client/src/api/index.ts b/client/src/api/index.ts index 1062c263..4acbdc59 100644 --- a/client/src/api/index.ts +++ b/client/src/api/index.ts @@ -5,6 +5,7 @@ import axios from 'axios'; // eslint-disable-next-line @typescript-eslint/no-explicit-any const axiosApi = (url: string, data?: any) => { let token: string | null = ''; + if (typeof window !== 'undefined') { token = localStorage.getItem('token'); } @@ -21,6 +22,21 @@ const axiosApi = (url: string, data?: any) => { return instance; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const unAxiosApi = (url: string, data?: any) => { + const instance = axios.create({ + baseURL: url, + withCredentials: true, + ...data, + }); + + return instance; +}; + export const defaultInstance = axiosApi( 'http://glogglogglog-env.eba-fuksumx7.ap-northeast-2.elasticbeanstalk.com', ); + +export const unAxiosDefaultInstance = unAxiosApi( + 'http://glogglogglog-env.eba-fuksumx7.ap-northeast-2.elasticbeanstalk.com', +); diff --git a/client/src/api/introduce-api.ts b/client/src/api/introduce-api.ts index 4c696094..0f4efcd2 100644 --- a/client/src/api/introduce-api.ts +++ b/client/src/api/introduce-api.ts @@ -4,12 +4,12 @@ import { useQuery } from '@tanstack/react-query'; //유저 introducion 가져오기 export const GetIntroducedApi = async (params: IIntroduceParams) => { - const { data } = await defaultInstance.get('/introduce', {params}); - - return data; - }; - - export const useGetIntroduceQuery = (params: IIntroduceParams) => { - const { isLoading, error, data } = useQuery(['friend', params], () => GetIntroducedApi(params)); - return { data, isLoading, error }; - }; \ No newline at end of file + const { data } = await defaultInstance.get('/introduce', { params }); + + return data; +}; + +export const useGetIntroduceQuery = (params: IIntroduceParams) => { + const { isLoading, error, data } = useQuery(['friend', params], () => GetIntroducedApi(params)); + return { data, isLoading, error }; +}; diff --git a/client/src/api/reply-api.ts b/client/src/api/reply-api.ts index 72009624..ca10687c 100644 --- a/client/src/api/reply-api.ts +++ b/client/src/api/reply-api.ts @@ -20,6 +20,6 @@ export const PostReplyApi = async (body: IReply) => { }; export const PatchReplyLikeApi = async (params: IPatchReplyLike) => { - const {data} = await defaultInstance.patch(`/replies/like/${params.replyId}`, params) + const { data } = await defaultInstance.patch(`/replies/like/${params.replyId}`, params); return data; -} \ No newline at end of file +}; diff --git a/client/src/api/userDetail-api.ts b/client/src/api/userDetail-api.ts index 43cc9e47..53c3dc4b 100644 --- a/client/src/api/userDetail-api.ts +++ b/client/src/api/userDetail-api.ts @@ -1,14 +1,14 @@ -import { useQuery } from "@tanstack/react-query"; -import { defaultInstance } from "."; +import { useQuery } from '@tanstack/react-query'; +import { defaultInstance } from '.'; export const GetUserDetailApi = async () => { - const {data} = await defaultInstance.get('/user/detail'); - - return data; - }; - - export const useGetUserDetailQuery = () => { - const {isLoading, error, data } = useQuery(['userDetail'], () => GetUserDetailApi()); - - return {isLoading, error, data }; - }; \ No newline at end of file + const { data } = await defaultInstance.get('/user/detail'); + + return data; +}; + +export const useGetUserDetailQuery = () => { + const { isLoading, error, data } = useQuery(['userDetail'], () => GetUserDetailApi()); + + return { isLoading, error, data }; +}; diff --git a/client/src/app/oauth2/redirect/page.tsx b/client/src/app/oauth2/redirect/page.tsx index df35d14a..004365d1 100644 --- a/client/src/app/oauth2/redirect/page.tsx +++ b/client/src/app/oauth2/redirect/page.tsx @@ -17,7 +17,7 @@ const Page = () => { const [blogUrl, setBlogUrl] = useState(''); const [blogName, setBlogName] = useState(''); const [nickname, setNickname] = useState(''); - const { data, isLoading } = useGetIsNewBlogQuery(); + const { data, isLoading } = useGetIsNewBlogQuery(params.get('token')); const postMakeAccountCreateQuery = useMutation(PostMakeAccountApi, { onSuccess: () => router.push('/collect'), diff --git a/client/src/app/register/page.tsx b/client/src/app/register/page.tsx deleted file mode 100644 index 7fb5ccb6..00000000 --- a/client/src/app/register/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react'; - -function page() { - return
page
; -} - -export default page; diff --git a/client/src/components/Header/SettingMenu.tsx b/client/src/components/Header/SettingMenu.tsx index 5aa4b0f7..41c249ab 100644 --- a/client/src/components/Header/SettingMenu.tsx +++ b/client/src/components/Header/SettingMenu.tsx @@ -1,11 +1,19 @@ +'use client'; + import { ModalType } from '@/types/common'; import { Menu, MenuItem } from '@mui/material'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import PageLink from '../PageLink/PageLink'; import FriendModal from '../Layout/HeaderFriendModal/FriendModal'; +import { enqueueSnackbar } from 'notistack'; function SettingMenu({ open, onClose, anchorEl }: ModalType & { anchorEl: null | HTMLElement }) { const [friendOpen, setFriendOpen] = useState(false); + const [token, setToken] = useState(''); + + useEffect(() => { + setToken(localStorage.getItem('token')); + }, []); return ( @@ -28,16 +36,30 @@ function SettingMenu({ open, onClose, anchorEl }: ModalType & { anchorEl: null | 스크랩 - localStorage.setItem('token', '')}>Logout - + {token && ( { - onClose(); + enqueueSnackbar({ + message: '로그아웃이 성공적으로 완료되었습니다.', + variant: 'success', + }); + localStorage.setItem('token', ''); }}> - 로그인 + Logout - + )} + {!token && ( + + { + onClose(); + }}> + 로그인 + + + )} setFriendOpen(false)}> ); diff --git a/client/src/components/Layout/Header.tsx b/client/src/components/Layout/Header.tsx index 141756ac..31da0993 100644 --- a/client/src/components/Layout/Header.tsx +++ b/client/src/components/Layout/Header.tsx @@ -19,8 +19,8 @@ export default function Header() { const pathname = usePathname(); const [isSearch, setIsSearch] = useIsSearchSSR(); const [anchorEl, setAnchorEl] = useState(null); - const {data: userDetailData} = useGetUserDetailQuery() - const [userDetail, setUserDetail] = useState() + const { data: userDetailData } = useGetUserDetailQuery(); + const [userDetail, setUserDetail] = useState(); const toggleUserTheme = () => { setUserTheme((prevTheme) => (prevTheme === 'dark' ? 'light' : 'dark')); @@ -63,15 +63,16 @@ export default function Header() {
- {isSearch ? ( - setIsSearch(false)}> - - - ) : ( - setIsSearch(true)}> - - - )} + {pathname.includes('/collect') && + (isSearch ? ( + setIsSearch(false)}> + + + ) : ( + setIsSearch(true)}> + + + ))} {userTheme === 'dark' ? ( @@ -88,7 +89,6 @@ export default function Header() { overflow="hidden" sx={{ cursor: 'pointer', backgroundColor: '#ffffff' }}> - {/* FIXME : 나중에 src={userDetail?.thumbnail} 로 바꿔야함 */} profile Image From 4e5211e9049edc6360171532d876403764293a22 Mon Sep 17 00:00:00 2001 From: Chaeyeon1 <66813821+Chaeyeon1@users.noreply.github.com> Date: Thu, 30 Nov 2023 04:41:27 +0900 Subject: [PATCH 3/8] =?UTF-8?q?=EB=AA=A8=EC=95=84=EB=B3=B4=EA=B8=B0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/api/.index.ts.swp | Bin 12288 -> 0 bytes client/src/api/collect-api.ts | 18 +++++ .../home/[categoryId]/[postId]/page.tsx | 3 +- .../[categoryId]/[postId]/postId.style.tsx | 71 ++++++++++-------- .../[blogName]/prList/[categoryId]/page.tsx | 13 +++- client/src/app/collect/CollectPost.tsx | 14 ++-- client/src/app/collect/page.tsx | 27 ++----- .../src/app/{[blogName] => }/scrap/page.tsx | 2 +- .../{[blogName] => }/scrap/scrap.style.tsx | 0 client/src/app/write/Modal/SaveModal.tsx | 8 +- client/src/components/Header/SettingMenu.tsx | 2 +- .../Layout/HeaderFriendModal/FriendModal.tsx | 8 +- client/src/components/Post/Post.tsx | 1 - client/src/types/dto.ts | 11 ++- 14 files changed, 103 insertions(+), 75 deletions(-) delete mode 100644 client/src/api/.index.ts.swp rename client/src/app/{[blogName] => }/scrap/page.tsx (96%) rename client/src/app/{[blogName] => }/scrap/scrap.style.tsx (100%) diff --git a/client/src/api/.index.ts.swp b/client/src/api/.index.ts.swp deleted file mode 100644 index 2cb62be85c9dfd3e66b16990fcf19d2f702ec91c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2zmMER6vyXiXb3?d(WH4HNcKr*+BZ4>;o(iX zl%7{Oo>S`A^^DIvT=5x)*>}-4WACH?lzv|o~dC$A#m9%uZE+3ow>0b(F zZ*jc{uFCS#S^g+@%Szkh?D~y&uOnpGhOG8^rYn;fJLOdx>c`fUpb!uOPfFmFy0~|t z`>CIM=`6kQ{Ou>bQSyX<5D)@FKnMr{As_^VfDrf}5D3+ddVoHj8hW8&-TB)(oXR2u zgn$qb0zyCt2mv7=1cZPP5CTF#2>b^L=&4d)KBLsdQ!tPJ|7qyqkJC#14*dju1wDie zbO}<>pU*1w8}uFY1@t+zf$l>E#LzY90`wyEH1rGh_!;^U`T_bL`WE^I`WpHSdKGHD z>_Kt}0U;m+gn$qb0zyCt2mv7=1pZ|LyZeeLnuk!0vuswn*;WbLk5iuLq-Yj(vs}HF z>MF6$hdJvyBzq~BSWP}*ZR?=RMT)WKXry>mA&GK_C{4N0O&Jc`44X3@kX{*AU#U!t zH>`GR&!O>_%#g86D_pY+`?CIroa0|AZ zdwm{UPTALET6cFJnJ~ZRd5TeNqf3N?Z@AB#=$dc8e`8FIFWX4(d~0ZHIn6!m!11~@ z*rvFWF&#dOyIo-z;mwHd9AUuQ9o-!|*mRo{)f_%(-NoHJ`K{o*o^d+ka2R+QM_r9* zceu$E6o=!AT|s>{I(u+HQG?0x!dRY0yIoUF&2JY4=OK=F>EJSAC+6>T1xF{_-bEKk zzZKBI>vizP&geebrYtYVQG{*#p10o(vSYv)Q=dAb_FH&kOqgjOcFHp1x->Q*T { return { data, isLoading, error }; }; +const GetColletSearchApi = async (params: ISearch) => { + const { data } = await defaultInstance.get(`/search`, { params }); + + return data; +}; + +export const useGetCollectSearchQuery = (params: ISearch) => { + const { isLoading, error, data } = useQuery( + [`search`, params], + () => GetColletSearchApi(params), + { + enabled: !!params.value, + }, + ); + return { data, isLoading, error }; +}; + const GetColletSearchUserApi = async (params: ISearchUser) => { const { data } = await defaultInstance.get(`/search/user`, { params }); diff --git a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx index c31cbe48..05f26d15 100644 --- a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx +++ b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx @@ -161,7 +161,8 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post diff --git a/client/src/app/[blogName]/home/[categoryId]/[postId]/postId.style.tsx b/client/src/app/[blogName]/home/[categoryId]/[postId]/postId.style.tsx index 0294dfa5..76fac7cd 100644 --- a/client/src/app/[blogName]/home/[categoryId]/[postId]/postId.style.tsx +++ b/client/src/app/[blogName]/home/[categoryId]/[postId]/postId.style.tsx @@ -44,7 +44,7 @@ export const ProfileImg = styled(Stack)(({ imageSrc }: { imageSrc: string }) => backgroundImage: `url(${imageSrc})`, backgroundRepeat: 'no-repeat', borderRadius: '50%', -})) +})); export const PostReply = styled(Stack)({ height: '100%', @@ -96,8 +96,8 @@ function RepliesComponent({ isLiked, isEdit, }: { - userId: number, - replyId: number, + userId: number; + replyId: number; profileImage: string; nickname: string; message: string; @@ -107,9 +107,9 @@ function RepliesComponent({ }) { const theme = useTheme(); const queryClient = useQueryClient(); - + const [IntroduceOpen, setIntroduceOpen] = useState(false); - const {data: introduceData} = useGetIntroduceQuery({ + const { data: introduceData } = useGetIntroduceQuery({ userId: userId, }); const [introduce, setIntroduce] = useState(); @@ -117,7 +117,7 @@ function RepliesComponent({ const [isAccept, setIsAccept] = useState(Number); const putAllowFriendIdCreateQuery = useMutation(PutFriendAllowApi, { onSuccess: () => { - queryClient.invalidateQueries(['friend']) + queryClient.invalidateQueries(['friend']); }, }); const AllowFriendOnClick = () => { @@ -131,36 +131,38 @@ function RepliesComponent({ const PutFriendRequestQuery = useMutation(PutFriendRequestApi, { onSuccess: () => { - queryClient.invalidateQueries(['friend']) + queryClient.invalidateQueries(['friend']); }, }); const FriendRequestOnClick = () => { const newRequestBody = { - userId: userId + userId: userId, }; PutFriendRequestQuery.mutate(newRequestBody); }; const PatchReplyLikeQuery = useMutation(PatchReplyLikeApi, { onSuccess: () => { - queryClient.invalidateQueries(['replies']) + queryClient.invalidateQueries(['replies']); }, }); const ReplyLikeOnClick = () => { const newReplyLikeBody = { - replyId: replyId + replyId: replyId, }; PatchReplyLikeQuery.mutate(newReplyLikeBody); }; useInsertionEffect(() => { setIntroduce(introduceData); - }, [introduceData]) + }, [introduceData]); return ( - - + {nickname} {message} @@ -179,17 +181,16 @@ function RepliesComponent({ - {isLiked ? - ( - - ) : ( + {isLiked ? ( + + + + ) : ( - + )} - - {isEdit ? : <>} - + {isEdit ? : <>} {likesCount} @@ -210,7 +211,9 @@ function RepliesComponent({ alt="profileImage" /> - {introduce?.nickname} + + {introduce?.nickname} + - + - + + + )} diff --git a/client/src/app/[blogName]/prList/[categoryId]/page.tsx b/client/src/app/[blogName]/prList/[categoryId]/page.tsx index 72381198..7f533681 100644 --- a/client/src/app/[blogName]/prList/[categoryId]/page.tsx +++ b/client/src/app/[blogName]/prList/[categoryId]/page.tsx @@ -8,7 +8,7 @@ import List from '@/components/List/List'; import PageLink from '@/components/PageLink/PageLink'; import { Stack } from '@mui/material'; import Image from 'next/image'; -import React from 'react'; +import React, { useEffect, useState } from 'react'; import EmptyContent from '../../../../../public/assets/box.png'; import Complete from '../../../../../public/assets/complete-icon.svg'; import { useMutation, useQueryClient } from '@tanstack/react-query'; @@ -18,6 +18,7 @@ import { enqueueSnackbar } from 'notistack'; function page({ params }: { params: { categoryId: string } }) { const { data: postedData } = useGetPRQuery({ categoryId: Number(params.categoryId) }); const { data: unPostedData } = useGetPRUnpostedQuery({ categoryId: Number(params.categoryId) }); + const [unPosted, setUnPosted] = useState(unPostedData); const queryClient = useQueryClient(); const deleteWritePrQuery = useMutation(DeleteWriteApi, { onSuccess: () => { @@ -33,15 +34,21 @@ function page({ params }: { params: { categoryId: string } }) { deleteWritePrQuery.mutate({ postId }); }; + useEffect(() => { + setUnPosted(unPostedData); + }, [unPostedData]); + + console.log(unPosted); return ( 작성하지 않은 PR - {unPostedData?.prUnpostedDtos?.prUnpostedDtos?.map((unPost) => { + {unPosted?.prUnPostedDtos?.prUnPostedDtos?.map((unPost) => { + console.log('1', unPost); return ( - + 썸네일 - - - - - + {like?.isPrivate && ( + + + + + + )} {like.title} diff --git a/client/src/app/collect/page.tsx b/client/src/app/collect/page.tsx index 974b12a5..3ef9e5d8 100644 --- a/client/src/app/collect/page.tsx +++ b/client/src/app/collect/page.tsx @@ -5,35 +5,20 @@ import React, { useState } from 'react'; import CollectArray from './CollectArray'; import { Search, Star } from '@mui/icons-material'; import { useIsSearchSSR } from '../../../hooks/useRecoilSSR'; -import { - useGetCollectSearchContentQuery, - useGetCollectSearchHashtagQuery, - useGetCollectSearchTitleQuery, - useGetCollectSearchUserQuery, -} from '@/api/collect-api'; +import { useGetCollectSearchQuery } from '@/api/collect-api'; import { ICollectPost } from '@/types/dto'; import PostComponent from '@/components/Post/Post'; -import { PostAreaComponent } from '../[blogName]/scrap/scrap.style'; +import { PostAreaComponent } from '../scrap/scrap.style'; function Collect() { const [isSearch] = useIsSearchSSR(); const [searchText, setSearchText] = useState(''); const [searchType, setSearchType] = useState<'user' | 'title' | 'hashtag' | 'content'>('user'); - const { data: userData } = useGetCollectSearchUserQuery({ nickname: searchText }); - const { data: titleData } = useGetCollectSearchTitleQuery({ title: searchText }); - const { data: hashtagData } = useGetCollectSearchHashtagQuery({ hashtag: searchText }); - const { data: contentData } = useGetCollectSearchContentQuery({ content: searchText }); - - const typeToDataMap = { - user: userData, - title: titleData, - hashtag: hashtagData, - content: contentData, - }; + const { data } = useGetCollectSearchQuery({ type: searchType, value: searchText }); return ( - + {!isSearch ? ( @@ -79,7 +64,7 @@ function Collect() { )} - {typeToDataMap[searchType]?.postPreviewDtos.map((user: ICollectPost) => { + {data?.postPreviewDtos.map((user: ICollectPost) => { return ( } - href={`/${user.blogUrl}/home/1/${user.postId}`} + href={`/${user.blogUrl}/home/${user.categoryId}/${user.postId}`} /> ); })} diff --git a/client/src/app/[blogName]/scrap/page.tsx b/client/src/app/scrap/page.tsx similarity index 96% rename from client/src/app/[blogName]/scrap/page.tsx rename to client/src/app/scrap/page.tsx index 399cb3c1..5539a05d 100644 --- a/client/src/app/[blogName]/scrap/page.tsx +++ b/client/src/app/scrap/page.tsx @@ -1,7 +1,7 @@ 'use client'; import React, { useEffect } from 'react'; -import PostComponent from '../../../components/Post/Post'; +import PostComponent from '../../components/Post/Post'; import { useState } from 'react'; import { PostAreaComponent, PostPagination, ScrapList } from './scrap.style'; import CenterContent from '@/components/Layout/CenterContent'; diff --git a/client/src/app/[blogName]/scrap/scrap.style.tsx b/client/src/app/scrap/scrap.style.tsx similarity index 100% rename from client/src/app/[blogName]/scrap/scrap.style.tsx rename to client/src/app/scrap/scrap.style.tsx diff --git a/client/src/app/write/Modal/SaveModal.tsx b/client/src/app/write/Modal/SaveModal.tsx index 09468dd3..ad96422a 100644 --- a/client/src/app/write/Modal/SaveModal.tsx +++ b/client/src/app/write/Modal/SaveModal.tsx @@ -130,7 +130,7 @@ function SaveModal({ const postOnClick = () => { onClose(); const formData = createFormData({ - thumbnail: image, + thumbnail: image ?? null, postCreateRequest: { title: writeProps?.title, content: writeProps?.content, @@ -147,7 +147,7 @@ function SaveModal({ const postUpdateOnClick = () => { onClose(); const formData = createFormData({ - thumbnail: image, + thumbnail: image ?? null, postCreateRequest: { title: writeProps?.title, content: writeProps?.content, @@ -166,7 +166,7 @@ function SaveModal({ onClose(); const formData = createToolFormData({ - thumbnail: image, + thumbnail: image ?? null, postBasicDto: { title: writeProps?.title ?? '', content: writeProps?.content ?? '', @@ -182,7 +182,7 @@ function SaveModal({ onClose(); const formData = createToolFormData({ - thumbnail: image, + thumbnail: image ?? null, postBasicDto: { title: writeProps?.title ?? '', content: writeProps?.content ?? '', diff --git a/client/src/components/Header/SettingMenu.tsx b/client/src/components/Header/SettingMenu.tsx index 41c249ab..e388e487 100644 --- a/client/src/components/Header/SettingMenu.tsx +++ b/client/src/components/Header/SettingMenu.tsx @@ -29,7 +29,7 @@ function SettingMenu({ open, onClose, anchorEl }: ModalType & { anchorEl: null | setFriendOpen(true)}>친구 { onClose(); }}> diff --git a/client/src/components/Layout/HeaderFriendModal/FriendModal.tsx b/client/src/components/Layout/HeaderFriendModal/FriendModal.tsx index a2ae3355..639982ac 100644 --- a/client/src/components/Layout/HeaderFriendModal/FriendModal.tsx +++ b/client/src/components/Layout/HeaderFriendModal/FriendModal.tsx @@ -19,8 +19,8 @@ function FriendModal({ open, onClose }: ModalType) { const [friend, setFriend] = useState(); const kindList = ['recentFriend', 'name', 'recentPost']; const friendCount = friend?.userSimpleDtos.simpleDtos.length; - const {data: userDetailData} = useGetUserDetailQuery() - const [userDetail, setUserDetail] = useState() + const { data: userDetailData } = useGetUserDetailQuery(); + const [userDetail, setUserDetail] = useState(); const [nickname, setNickname] = useState(''); const { data: searchFriendData } = useGetFriendSearchQuery({ @@ -30,7 +30,7 @@ function FriendModal({ open, onClose }: ModalType) { useEffect(() => { setFriend(friendData); setSearch(searchFriendData); - setUserDetail(userDetailData) + setUserDetail(userDetailData); }, [friendData, searchFriendData, userDetailData]); //정렬기준 @@ -100,6 +100,7 @@ function FriendModal({ open, onClose }: ModalType) { profileImg={friendInfo.nickname} relationship={friendInfo.relationship} haveNewPost={friendInfo.haveNewPost} + // FIXME : 1 하드코딩 recentPostId={`/{blogUrl}/home/1/${friendInfo.recentPostId}`} /> ); @@ -139,6 +140,7 @@ function FriendModal({ open, onClose }: ModalType) { profileImg={searchInfo.nickname} relationship={searchInfo.relationship} haveNewPost={searchInfo.haveNewPost} + // FIXME : 1 하드코딩 recentPostId={`/${userDetail?.blogUrl}/home/1/${searchInfo.recentPostId}`} /> ); diff --git a/client/src/components/Post/Post.tsx b/client/src/components/Post/Post.tsx index 994d06af..d4229b0a 100644 --- a/client/src/components/Post/Post.tsx +++ b/client/src/components/Post/Post.tsx @@ -21,7 +21,6 @@ function PostComponent({ const isLaptop = useMediaQuery(theme.breakpoints.down('lg')); return ( - // FIXME : Scrap 페이지에선 href 안 되어 있겠네 diff --git a/client/src/types/dto.ts b/client/src/types/dto.ts index fd0194f9..5e29ad67 100644 --- a/client/src/types/dto.ts +++ b/client/src/types/dto.ts @@ -10,6 +10,7 @@ export interface ICollectPost { createdAt?: string; isPrivate?: boolean; likesCount?: number; + categoryId?: number; postId?: number; repliesCount?: number; thumbnail?: string | null; @@ -28,6 +29,12 @@ export interface ISearchUser { nickname: string; } +// 모아보기 페이지 검색 +export interface ISearch { + type: string; + value: string; +} + export interface ISearchTitle { title: string; } @@ -447,8 +454,8 @@ export interface IBlogInfo { // pr unposted export interface IUnPostedPost { isAuthor: boolean; - prUnpostedDtos: { - prUnpostedDtos: { + prUnPostedDtos: { + prUnPostedDtos: { prId: number; prNumber: number; prTitle: string; From 5f798b58ddea9b6017677ed63f5758a0a60f6e33 Mon Sep 17 00:00:00 2001 From: Chaeyeon1 <66813821+Chaeyeon1@users.noreply.github.com> Date: Thu, 30 Nov 2023 05:10:26 +0900 Subject: [PATCH 4/8] =?UTF-8?q?PR=20=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/[blogName]/prList/[categoryId]/page.tsx | 13 ++++++------- client/src/app/write/Modal/SaveModal.tsx | 6 +++--- .../pr/update/[categoryId]/{ => [postId]}/page.tsx | 6 +++--- .../app/write/update/[categoryId]/[postId]/page.tsx | 2 +- client/src/components/Github/Github.tsx | 3 +++ 5 files changed, 16 insertions(+), 14 deletions(-) rename client/src/app/write/pr/update/[categoryId]/{ => [postId]}/page.tsx (90%) diff --git a/client/src/app/[blogName]/prList/[categoryId]/page.tsx b/client/src/app/[blogName]/prList/[categoryId]/page.tsx index 7f533681..3a4a29a6 100644 --- a/client/src/app/[blogName]/prList/[categoryId]/page.tsx +++ b/client/src/app/[blogName]/prList/[categoryId]/page.tsx @@ -1,7 +1,6 @@ 'use client'; import { useGetPRQuery, useGetPRUnpostedQuery } from '@/api/pr-api'; -// import { useGetPRQuery } from '@/api/pr-api'; import Button from '@/components/Button/Button'; import CenterContent from '@/components/Layout/CenterContent'; import List from '@/components/List/List'; @@ -17,7 +16,9 @@ import { enqueueSnackbar } from 'notistack'; function page({ params }: { params: { categoryId: string } }) { const { data: postedData } = useGetPRQuery({ categoryId: Number(params.categoryId) }); - const { data: unPostedData } = useGetPRUnpostedQuery({ categoryId: Number(params.categoryId) }); + const { data: unPostedData } = useGetPRUnpostedQuery({ + categoryId: Number(params.categoryId), + }); const [unPosted, setUnPosted] = useState(unPostedData); const queryClient = useQueryClient(); const deleteWritePrQuery = useMutation(DeleteWriteApi, { @@ -38,7 +39,6 @@ function page({ params }: { params: { categoryId: string } }) { setUnPosted(unPostedData); }, [unPostedData]); - console.log(unPosted); return ( @@ -46,9 +46,8 @@ function page({ params }: { params: { categoryId: string } }) { {unPosted?.prUnPostedDtos?.prUnPostedDtos?.map((unPost) => { - console.log('1', unPost); return ( - + - #77 + #{unPost.prId} - + diff --git a/client/src/app/write/Modal/SaveModal.tsx b/client/src/app/write/Modal/SaveModal.tsx index ad96422a..eabb4773 100644 --- a/client/src/app/write/Modal/SaveModal.tsx +++ b/client/src/app/write/Modal/SaveModal.tsx @@ -45,7 +45,7 @@ function SaveModal({ const [image, setImage] = useState(''); const [privateMode, setPrivateMode] = useState<'private' | 'public'>('private'); const queryClient = useQueryClient(); - const isPrUpdate = pathname.startsWith('/write/pr/update'); + // const isPrUpdate = pathname.startsWith('/write/pr/update'); const isPr = pathname.startsWith('/write/pr'); const postWriteCreateQuery = useMutation(PostWriteApi, { @@ -152,10 +152,10 @@ function SaveModal({ title: writeProps?.title, content: writeProps?.content, isPrivate: privateMode === 'private' ? true : false, - prId: isPrUpdate ? Number(categoryId) : undefined, + // prId: isPrUpdate ? Number(postId) : undefined, hashtags: writeProps?.tags, categoryId: Number(categoryId), - postId, + postId: Number(postId), }, }); diff --git a/client/src/app/write/pr/update/[categoryId]/page.tsx b/client/src/app/write/pr/update/[categoryId]/[postId]/page.tsx similarity index 90% rename from client/src/app/write/pr/update/[categoryId]/page.tsx rename to client/src/app/write/pr/update/[categoryId]/[postId]/page.tsx index bbb07cbd..00c98fff 100644 --- a/client/src/app/write/pr/update/[categoryId]/page.tsx +++ b/client/src/app/write/pr/update/[categoryId]/[postId]/page.tsx @@ -13,11 +13,11 @@ import { useTemplateIdSSR, useTemporaryIdSSR, useUserThemeSSR, -} from '../../../../../../hooks/useRecoilSSR'; +} from '../../../../../../../hooks/useRecoilSSR'; import { WriteProps } from '@/util/useWriteProps'; import { useGetTemplateDetailQuery, useGetTemporaryDetailQuery } from '@/api/write-api'; -const PR = ({ params }: { params: { categoryId: number } }) => { +const PR = ({ params }: { params: { categoryId: number; postId: number } }) => { const [userTheme] = useUserThemeSSR(); const [title, setTitle] = useState(''); const [content, setContent] = useState(''); @@ -73,7 +73,7 @@ const PR = ({ params }: { params: { categoryId: number } }) => { - + ); }; diff --git a/client/src/app/write/update/[categoryId]/[postId]/page.tsx b/client/src/app/write/update/[categoryId]/[postId]/page.tsx index a3020645..8f0d6ba5 100644 --- a/client/src/app/write/update/[categoryId]/[postId]/page.tsx +++ b/client/src/app/write/update/[categoryId]/[postId]/page.tsx @@ -25,7 +25,7 @@ const Update = ({ params }: { params: { categoryId: number; postId: number } }) const [tags, setTags] = useState([]); const [templateId] = useTemplateIdSSR(); const [temporaryId] = useTemporaryIdSSR(); - const { data: postData } = useGetPostQuery({ postId: Number(params.postId) }); + const { data: postData } = useGetPostQuery({ postId: Number(params.categoryId) }); const { data: templateData, refetch: templateRefetch } = useGetTemplateDetailQuery({ templateId, diff --git a/client/src/components/Github/Github.tsx b/client/src/components/Github/Github.tsx index ed38166a..4402ea22 100644 --- a/client/src/components/Github/Github.tsx +++ b/client/src/components/Github/Github.tsx @@ -7,6 +7,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import List from '../List/List'; import Button from '../Button/Button'; import { Stack } from '@mui/material'; +import { enqueueSnackbar } from 'notistack'; function Github({ open, @@ -24,6 +25,8 @@ function Github({ const putAllowFriendIdCreateQuery = useMutation(PostRepository, { onSuccess: () => { queryClient.invalidateQueries(['repository']); + onClose(); + enqueueSnackbar({ message: 'Repository 연동이 완료되었습니다.', variant: 'success' }); }, }); return ( From 01aaa18ebffe9e888b21f4c4ed16cd2a527d164c Mon Sep 17 00:00:00 2001 From: Chaeyeon1 <66813821+Chaeyeon1@users.noreply.github.com> Date: Thu, 30 Nov 2023 05:30:42 +0900 Subject: [PATCH 5/8] =?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DND/CategorySettingModal.tsx | 42 ++++++++++--------- client/src/components/DND/DragAndDrop.tsx | 41 +++++++++++++----- client/src/components/Layout/Header.tsx | 2 +- 3 files changed, 53 insertions(+), 32 deletions(-) diff --git a/client/src/components/DND/CategorySettingModal.tsx b/client/src/components/DND/CategorySettingModal.tsx index 08ea0294..83b4eaa4 100644 --- a/client/src/components/DND/CategorySettingModal.tsx +++ b/client/src/components/DND/CategorySettingModal.tsx @@ -18,7 +18,7 @@ function CategorySettingModal({ open, categoryId, onClose }: CategorySettingModa }, }); const deleteClick = () => { - deleteCategoryQuery.mutate({ categoryId : categoryId }); + deleteCategoryQuery.mutate({ categoryId: categoryId }); onClose(); }; @@ -35,42 +35,44 @@ function CategorySettingModal({ open, categoryId, onClose }: CategorySettingModa }; putCategoryQuery.mutate(newCategoryNameBody); onClose(); - } + }; console.log(`카테고리 ID : ${categoryId}`); return ( - 카테고리 설정 - + + 카테고리 설정 + + - + 깃허브 연동 여부 : X - + 카테고리 이름 : - { - setNewCategoryName(e.target.value); - }} /> + { + setNewCategoryName(e.target.value); + }} + /> - + - {category.categoryName} + + + {category.categoryName} + + { setCategoryEditOpen(true); @@ -93,11 +99,13 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro - - - + + + + + - + {category?.isPrCategory ? ( - - PR 연동 + + PR 연동 보러가기 {'->'} ) : ( @@ -115,10 +131,13 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro setOpen(true); setCategoryId(category.categoryId); }} - sx={{ cursor: 'pointer' }} + sx={{ + cursor: 'pointer', + ':hover': { color: 'rgba(0,0,0,0.4)' }, + }} pl={4} - py={1}> - PR 연동 + pt={1}> + PR 연동 하러가기 {'->'} )} - + profile Image From 592d2c6162d72fc2fb311aa6f83e5fea013b7c9b Mon Sep 17 00:00:00 2001 From: Chaeyeon1 <66813821+Chaeyeon1@users.noreply.github.com> Date: Thu, 30 Nov 2023 06:13:25 +0900 Subject: [PATCH 6/8] =?UTF-8?q?#163=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/api/write-api.ts | 6 + .../home/[categoryId]/[postId]/page.tsx | 29 ++- .../[categoryId]/[postId]/postId.style.tsx | 3 +- client/src/components/DND/DragAndDrop.tsx | 190 ++++++++++-------- 4 files changed, 137 insertions(+), 91 deletions(-) diff --git a/client/src/api/write-api.ts b/client/src/api/write-api.ts index 3083eefd..f68be981 100644 --- a/client/src/api/write-api.ts +++ b/client/src/api/write-api.ts @@ -22,6 +22,12 @@ export const UpdateWriteApi = async (body: FormData) => { return data; }; +export const AddLikeApi = async (params: { postId: number }) => { + const { data } = await defaultInstance.patch(`/post/like?postId=${params?.postId}`); + + return data; +}; + export const DeleteWriteApi = async (params: IRemovePostParams) => { const { data } = await defaultInstance.delete('/post', { params }); diff --git a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx index 05f26d15..634133cf 100644 --- a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx +++ b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx @@ -2,6 +2,7 @@ import { Avatar, Box, + Chip, Icon, Menu, MenuItem, @@ -44,8 +45,9 @@ import CloseIcon from '@mui/icons-material/Close'; import Image from 'next/image'; import FootPrintAnimation from '@/components/FootPrint/FootPrintAnimation'; import { usegetblogIdQuery } from '@/api/readme-api'; -import { DeleteWriteApi } from '@/api/write-api'; +import { AddLikeApi, DeleteWriteApi } from '@/api/write-api'; import { enqueueSnackbar } from 'notistack'; +import ThumbUpIcon from '@mui/icons-material/ThumbUp'; const page = ({ params }: { params: { blogName: string; categoryId: string; postId: string } }) => { const { data: blogIdData } = usegetblogIdQuery({ blogUrl: params.blogName }); @@ -83,6 +85,13 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post queryClient.invalidateQueries(['replies']); }, }); + + const patchAddLikeQuery = useMutation(AddLikeApi, { + onSuccess: () => { + queryClient.invalidateQueries(['post']); + }, + }); + const ReplyOnClick = () => { const newReplyBody = { postId: Number(params.postId), @@ -221,9 +230,25 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post rightContainer={ - {/* 댓글 */} + + + 조회수 : {post?.viewsCount} + + 추천수 : {post?.likesCount} + patchAddLikeQuery.mutate({ postId: Number(params?.postId) })}> + + + + + {post?.hashtags?.map((hashtag, i) => { + return ( + + ); + })} + diff --git a/client/src/app/[blogName]/home/[categoryId]/[postId]/postId.style.tsx b/client/src/app/[blogName]/home/[categoryId]/[postId]/postId.style.tsx index 76fac7cd..910d9075 100644 --- a/client/src/app/[blogName]/home/[categoryId]/[postId]/postId.style.tsx +++ b/client/src/app/[blogName]/home/[categoryId]/[postId]/postId.style.tsx @@ -47,13 +47,14 @@ export const ProfileImg = styled(Stack)(({ imageSrc }: { imageSrc: string }) => })); export const PostReply = styled(Stack)({ + marginTop: '60px', height: '100%', flexDirection: 'column', }); export const ReplyHandle = styled(Stack)({ flexDirection: 'row', - marginBottom: '20px', + // marginBottom: '20px', }); export const ReplyCount = styled(Stack)({}); diff --git a/client/src/components/DND/DragAndDrop.tsx b/client/src/components/DND/DragAndDrop.tsx index ffb92a26..6cae261a 100644 --- a/client/src/components/DND/DragAndDrop.tsx +++ b/client/src/components/DND/DragAndDrop.tsx @@ -1,7 +1,7 @@ 'use client'; import React, { ReactNode } from 'react'; import CenterContent from '@/components/Layout/CenterContent'; -import { Stack } from '@mui/material'; +import { Stack, Tooltip } from '@mui/material'; import { useEffect, useState } from 'react'; import { DragDropContext, Droppable, Draggable, DropResult } from 'react-beautiful-dnd'; import { useRouter } from 'next/navigation'; @@ -58,7 +58,13 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro - + {footprintList?.map((category) => { return ( @@ -72,9 +78,6 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro }} {...provided.droppableProps} ref={provided.innerRef}> - - 글쓰기 - - - {category.categoryName} - + + + {category.categoryName} + + - { setCategoryEditOpen(true); setParamsCategoryId(category.categoryId); }} - sx={{ padding: '0px' }} - size="small"> - - + title="게시글 수정"> + + + + - - - + + + + + - {category?.isPrCategory ? ( - { - setCategoryId(category.categoryId); - }} - href={`/${blogName}/prList/${category.categoryId}`}> + + {category?.isPrCategory ? ( + { + setCategoryId(category.categoryId); + }} + href={`/${blogName}/prList/${category.categoryId}`}> + + PR 연동 보러가기 {'->'} + + + ) : ( { + setOpen(true); + setCategoryId(category.categoryId); + }} sx={{ + fontSize: '14px', cursor: 'pointer', ':hover': { color: 'rgba(0,0,0,0.4)' }, }} pl={4} pt={1}> - PR 연동 보러가기 {'->'} + PR 연동 하러가기 {'->'} - - ) : ( + )} + + {!category?.isPrCategory && ( { - setOpen(true); - setCategoryId(category.categoryId); - }} sx={{ - cursor: 'pointer', - ':hover': { color: 'rgba(0,0,0,0.4)' }, - }} - pl={4} - pt={1}> - PR 연동 하러가기 {'->'} + padding: '8px', + borderRadius: '8px', + }}> + {category.postTitleDtos?.map((post) => { + return ( + + {(provided) => ( + + + + footPrint + {post.title} + + + + )} + + ); + })} )} - - {category.postTitleDtos?.map((post) => { - return ( - - {(provided) => ( - - - - footPrint - {post.title} - - - - )} - - ); - })} - {provided.placeholder} )} From 2d21cf6cbc3e2891fb6801aa6ddd29f4b7b9d4f1 Mon Sep 17 00:00:00 2001 From: Chaeyeon1 <66813821+Chaeyeon1@users.noreply.github.com> Date: Thu, 30 Nov 2023 06:16:42 +0900 Subject: [PATCH 7/8] =?UTF-8?q?UI=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/[categoryId]/[postId]/page.tsx | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx index 634133cf..5a4046ae 100644 --- a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx +++ b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx @@ -51,7 +51,7 @@ import ThumbUpIcon from '@mui/icons-material/ThumbUp'; const page = ({ params }: { params: { blogName: string; categoryId: string; postId: string } }) => { const { data: blogIdData } = usegetblogIdQuery({ blogUrl: params.blogName }); - const [blogId, setBlogId] = useState(); + const [, setBlogId] = useState(); const { data: sidebarData } = useGetSidebarQuery({ blogId: blogIdData }); const { data: postData } = useGetPostQuery({ postId: Number(params.postId) }); const [IntroduceOpen, setIntroduceOpen] = useState(false); @@ -59,8 +59,6 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post const router = useRouter(); const theme = useTheme(); - console.log(`useState blogId : ${blogId}`); - //[FIXME: repliese get할 때 body말고 parameter로 바뀌어졌을 때 useState() 바꿔주기] const [page, setPage] = useState(0); const [order, setOrder] = useState('like'); @@ -234,20 +232,23 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post - 조회수 : {post?.viewsCount} - - 추천수 : {post?.likesCount} + 조회수 : {post?.viewsCount} + + 추천수 : {post?.likesCount} patchAddLikeQuery.mutate({ postId: Number(params?.postId) })}> - {post?.hashtags?.map((hashtag, i) => { - return ( - - ); - })} + + {post?.hashtags?.map((hashtag, i) => { + return ( + + ); + })} + From 76cd352b376d8e1cd47aa4cd1a9324a4d6723848 Mon Sep 17 00:00:00 2001 From: Chaeyeon1 <66813821+Chaeyeon1@users.noreply.github.com> Date: Thu, 30 Nov 2023 06:33:35 +0900 Subject: [PATCH 8/8] PRList --- .../home/[categoryId]/[postId]/page.tsx | 19 ++-- .../[blogName]/prList/[categoryId]/page.tsx | 79 +++++++---------- client/src/components/DND/DragAndDrop.tsx | 86 +++++++++++-------- 3 files changed, 93 insertions(+), 91 deletions(-) diff --git a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx index 5a4046ae..185972e7 100644 --- a/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx +++ b/client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx @@ -210,12 +210,18 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post router.push(`/${params.blogName}`)} /> - - - - + {post?.isAuthor && ( + <> + + + + + + )} @@ -223,6 +229,7 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post - {unPosted?.prUnPostedDtos?.prUnPostedDtos?.map((unPost) => { - return ( - - - - - #{unPost.prId} - - + {unPosted?.isAuthor && + unPosted?.prUnPostedDtos?.prUnPostedDtos?.map((unPost) => { + return ( + - {unPost.prTitle} + sx={{ + transition: 'all .35s ease-in-out', + cursor: 'pointer', + ':hover': { transform: 'translateY(-4px)' }, + }} + minWidth="220px" + height="124px" + bgcolor="primary.main" + p={4} + borderRadius="8px" + justifyContent="space-around"> + + + #{unPost.prId} + + + + {unPost.prTitle} + - - - ); - }) ?? ( - - - - - - 모든 PR 글 작성을 완료하셨습니다. - - - )} + + ); + })} 작성한 PR 목록 diff --git a/client/src/components/DND/DragAndDrop.tsx b/client/src/components/DND/DragAndDrop.tsx index 6cae261a..7db5d9cd 100644 --- a/client/src/components/DND/DragAndDrop.tsx +++ b/client/src/components/DND/DragAndDrop.tsx @@ -14,6 +14,7 @@ import PageLink from '../PageLink/PageLink'; import Github from '../Github/Github'; import Button from '../Button/Button'; import CreateCategoryModal from './CreateCategoryModal'; +import { IPostContent } from '@/types/dto'; type Footprint = { categoryId: number; @@ -30,9 +31,10 @@ interface DragAndDropProps { rightContainer: ReactNode; footprintList?: Footprint[]; categoryNumber?: string; + post?: IPostContent; } -function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropProps) { +function DragAndDrop({ rightContainer, footprintList, blogName, post }: DragAndDropProps) { const [isBrowser, setIsBrowser] = useState(false); const [categoryEditOpen, setCategoryEditOpen] = useState(false); const [createCategoryOpen, setCreateCategoryOpen] = useState(false); @@ -58,13 +60,15 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro - + {post?.isAuthor && ( + + )} {footprintList?.map((category) => { return ( @@ -94,25 +98,29 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro - { - setCategoryEditOpen(true); - setParamsCategoryId(category.categoryId); - }} - title="게시글 수정"> - - - - - - - - + {post?.isAuthor && ( + { + setCategoryEditOpen(true); + setParamsCategoryId(category.categoryId); + }} + title="게시글 수정"> - + - + )} + + + {post?.isAuthor && ( + + + + + + + + )} @@ -136,20 +144,22 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro ) : ( - { - setOpen(true); - setCategoryId(category.categoryId); - }} - sx={{ - fontSize: '14px', - cursor: 'pointer', - ':hover': { color: 'rgba(0,0,0,0.4)' }, - }} - pl={4} - pt={1}> - PR 연동 하러가기 {'->'} - + post?.isAuthor && ( + { + setOpen(true); + setCategoryId(category.categoryId); + }} + sx={{ + fontSize: '14px', + cursor: 'pointer', + ':hover': { color: 'rgba(0,0,0,0.4)' }, + }} + pl={4} + pt={1}> + PR 연동 하러가기 {'->'} + + ) )} {!category?.isPrCategory && (