Skip to content

Commit

Permalink
PRList
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaeyeon1 committed Nov 29, 2023
1 parent 2d21cf6 commit 76cd352
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 91 deletions.
19 changes: 13 additions & 6 deletions client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,26 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post
<IconButton color="white">
<Home fontSize="small" onClick={() => router.push(`/${params.blogName}`)} />
</IconButton>
<PageLink href={`/write/update/${params.categoryId}/${params.postId}`}>
<Button>수정</Button>
</PageLink>
<Button onClick={() => deletePrPostOnClick(Number(params?.postId))} color="error">
삭제
</Button>
{post?.isAuthor && (
<>
<PageLink href={`/write/update/${params.categoryId}/${params.postId}`}>
<Button>수정</Button>
</PageLink>
<Button
onClick={() => deletePrPostOnClick(Number(params?.postId))}
color="error">
삭제
</Button>
</>
)}
</Stack>
</Stack>
</Stack>
</CenterContent>
</BlackContainer>
</ThumbnailArea>
<DragAndDrop
post={post}
blogName={params.blogName}
footprintList={writeList}
rightContainer={
Expand Down
79 changes: 32 additions & 47 deletions client/src/app/[blogName]/prList/[categoryId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Stack } from '@mui/material';
import Image from 'next/image';
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';
import { DeleteWriteApi } from '@/api/write-api';
import { enqueueSnackbar } from 'notistack';
Expand Down Expand Up @@ -45,54 +44,40 @@ function page({ params }: { params: { categoryId: string } }) {
작성하지 않은 PR
</Stack>
<Stack p={2} direction="row" spacing={4} overflow={'scroll'}>
{unPosted?.prUnPostedDtos?.prUnPostedDtos?.map((unPost) => {
return (
<PageLink key={unPost.prId} href={`/write/pr/${unPost.prId}`}>
<Stack
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">
<Stack direction="row" justifyContent="space-between">
<Stack color="#000000" fontSize="20px" fontWeight="bold">
#{unPost.prId}
</Stack>
</Stack>
{unPosted?.isAuthor &&
unPosted?.prUnPostedDtos?.prUnPostedDtos?.map((unPost) => {
return (
<PageLink key={unPost.prId} href={`/write/pr/${unPost.prId}`}>
<Stack
color="#000000"
sx={{ wordBreak: 'break-all' }}
overflow="hidden"
textOverflow="ellipsis"
display="inline"
whiteSpace="nowrap">
{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">
<Stack direction="row" justifyContent="space-between">
<Stack color="#000000" fontSize="20px" fontWeight="bold">
#{unPost.prId}
</Stack>
</Stack>
<Stack
color="#000000"
sx={{ wordBreak: 'break-all' }}
overflow="hidden"
textOverflow="ellipsis"
display="inline"
whiteSpace="nowrap">
{unPost.prTitle}
</Stack>
</Stack>
</Stack>
</PageLink>
);
}) ?? (
<Stack
width="100%"
direction="column"
spacing={4}
justifyContent="center"
alignItems="center"
height={200}>
<Stack width={40} height={40}>
<Complete color="#834" />
</Stack>
<Stack fontSize={'18px'} width="fit-content">
모든 PR 글 작성을 완료하셨습니다.
</Stack>
</Stack>
)}
</PageLink>
);
})}
</Stack>
<Stack margin="40px 0px 8px 0px" fontSize="24px">
작성한 PR 목록
Expand Down
86 changes: 48 additions & 38 deletions client/src/components/DND/DragAndDrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -58,13 +60,15 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro
<CenterContent bgcolor="transparent">
<Stack gap={8} width="100%" height="100%" direction="row">
<Stack sx={{ transition: 'all .35s ease-in-out' }} position="relative" gap={8}>
<Button
variant="outlined"
fullWidth
onClick={() => setCreateCategoryOpen(true)}
sx={{ marginBottom: '-24px' }}>
카테고리 생성
</Button>
{post?.isAuthor && (
<Button
variant="outlined"
fullWidth
onClick={() => setCreateCategoryOpen(true)}
sx={{ marginBottom: '-24px' }}>
카테고리 생성
</Button>
)}
{footprintList?.map((category) => {
return (
<Droppable key={category.categoryId} droppableId={String(category.categoryId)}>
Expand Down Expand Up @@ -94,25 +98,29 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro
</Stack>
</Tooltip>
</PageLink>
<Tooltip
onClick={() => {
setCategoryEditOpen(true);
setParamsCategoryId(category.categoryId);
}}
title="게시글 수정">
<IconButton sx={{ padding: '0px' }} size="small">
<Edit fontSize="small" />
</IconButton>
</Tooltip>
</Stack>
<Stack direction="row" alignItems="center" spacing={1}>
<PageLink href={`/write/create/${category.categoryId}`}>
<Tooltip title="게시글 작성">
{post?.isAuthor && (
<Tooltip
onClick={() => {
setCategoryEditOpen(true);
setParamsCategoryId(category.categoryId);
}}
title="게시글 수정">
<IconButton sx={{ padding: '0px' }} size="small">
<Add fontSize="small" />
<Edit fontSize="small" />
</IconButton>
</Tooltip>
</PageLink>
)}
</Stack>
<Stack direction="row" alignItems="center" spacing={1}>
{post?.isAuthor && (
<PageLink href={`/write/create/${category.categoryId}`}>
<Tooltip title="게시글 작성">
<IconButton sx={{ padding: '0px' }} size="small">
<Add fontSize="small" />
</IconButton>
</Tooltip>
</PageLink>
)}
</Stack>
</Stack>
<Stack>
Expand All @@ -136,20 +144,22 @@ function DragAndDrop({ rightContainer, footprintList, blogName }: DragAndDropPro
</Stack>
</PageLink>
) : (
<Stack
onClick={() => {
setOpen(true);
setCategoryId(category.categoryId);
}}
sx={{
fontSize: '14px',
cursor: 'pointer',
':hover': { color: 'rgba(0,0,0,0.4)' },
}}
pl={4}
pt={1}>
PR 연동 하러가기 {'->'}
</Stack>
post?.isAuthor && (
<Stack
onClick={() => {
setOpen(true);
setCategoryId(category.categoryId);
}}
sx={{
fontSize: '14px',
cursor: 'pointer',
':hover': { color: 'rgba(0,0,0,0.4)' },
}}
pl={4}
pt={1}>
PR 연동 하러가기 {'->'}
</Stack>
)
)}
</Stack>
{!category?.isPrCategory && (
Expand Down

0 comments on commit 76cd352

Please sign in to comment.