Skip to content

Commit

Permalink
Merge pull request #1346 from 42organization/6th_party
Browse files Browse the repository at this point in the history
[test-deploy] 파티 모집 서비스 테스트 배포
  • Loading branch information
izone00 authored Apr 5, 2024
2 parents 1e1a45a + 379bc71 commit 21694b4
Show file tree
Hide file tree
Showing 69 changed files with 4,770 additions and 6 deletions.
20 changes: 19 additions & 1 deletion components/Layout/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Link from 'next/link';
import { useRouter } from 'next/router';
import { useEffect, useContext } from 'react';
import { useRecoilState, useSetRecoilState } from 'recoil';
import { BsMegaphone } from 'react-icons/bs';
import { FaArrowLeft } from 'react-icons/fa';
import { FiMenu } from 'react-icons/fi';
import { IoStorefrontOutline } from 'react-icons/io5';
import { Modal } from 'types/modalTypes';
Expand All @@ -18,6 +20,7 @@ import useAxiosGet from 'hooks/useAxiosGet';
import styles from 'styles/Layout/Header.module.scss';

export default function Header() {
const router = useRouter();
const [live, setLive] = useRecoilState(liveState);
const HeaderState = useContext<HeaderContextState | null>(HeaderContext);
const openMenuBarHandler = () => {
Expand Down Expand Up @@ -54,11 +57,26 @@ export default function Header() {
type: 'setError',
});

// 현재 경로가 뒤로 가기 버튼을 사용해야 하는 경로 패턴 중 하나와 일치하는지 확인
const isBackButtonRoute = () => {
const path = router.asPath.split('?')[0]; // 쿼리 스트링 제거
const patterns = [
/^\/party\/create$/, // '/party/create'
/^\/party\/[0-9]+$/, // '/party/[roomId]'
];

return patterns.some((pattern) => pattern.test(path));
};

return (
<div className={styles.headerContainer}>
<div className={styles.headerWrap}>
<div className={styles.headerLeft}>
<FiMenu className={styles.menuIcon} onClick={openMenuBarHandler} />
{isBackButtonRoute() ? (
<FaArrowLeft onClick={router.back} />
) : (
<FiMenu className={styles.menuIcon} onClick={openMenuBarHandler} />
)}
</div>
<Link className={styles.logoWrap} href={'/'}>
42GG
Expand Down
3 changes: 2 additions & 1 deletion components/Layout/PlayButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const PlayButton = () => {
if (
presentPath === '/match' ||
presentPath === '/manual' ||
presentPath === '/store'
presentPath === '/store' ||
presentPath.startsWith('/party')
)
return null;
return (
Expand Down
67 changes: 66 additions & 1 deletion components/admin/SideNav.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
import { useRouter } from 'next/router';
import { useState } from 'react';
import { BsShop } from 'react-icons/bs';
import { FaAngleDown, FaAngleRight } from 'react-icons/fa';
import { GoSettings } from 'react-icons/go';
import {
GrUserSettings,
GrNotification,
GrStatusWarning,
GrAnnounce,
} from 'react-icons/gr';
import { IoGameControllerOutline, IoReceiptOutline } from 'react-icons/io5';
import {
IoGameControllerOutline,
IoPeople,
IoReceiptOutline,
} from 'react-icons/io5';
import { MdOutlineMessage } from 'react-icons/md';
import {
TbCalendarTime,
TbCoin,
TbPaperBag,
TbTrophy,
TbNote,
TbFileReport,
TbMessageReport,
TbBuildingWarehouse,
TbPlaylistAdd,
TbWallet,
} from 'react-icons/tb';
import SideNavContent from 'components/admin/SideNavContent';
import styles from 'styles/admin/SideNav.module.scss';

export default function SideNav() {
const currentPath = useRouter().asPath.replace('/admin', '');
const [isPartyOpen, setPartyOpen] = useState(false);

return (
<div className={styles.container}>
Expand Down Expand Up @@ -135,6 +147,59 @@ export default function SideNav() {
>
<TbWallet className={styles.logo} />
</SideNavContent>

<div
className={styles.menuItem}
onClick={() => setPartyOpen(!isPartyOpen)}
>
<IoPeople />
<span className={styles.menuName}>파티 관리탭</span>
{isPartyOpen ? <FaAngleDown /> : <FaAngleRight />}
</div>

{isPartyOpen && (
<div className={styles.subMenu}>
<SideNavContent
url={'/partyPenalty'}
menuName={'패널티 관리'}
currentPath={currentPath}
>
<TbMessageReport className={styles.logo} />
</SideNavContent>

<SideNavContent
url={'/partyReport'}
menuName={'신고 관리'}
currentPath={currentPath}
>
<TbFileReport className={styles.logo} />
</SideNavContent>

<SideNavContent
url={'/partyRoom'}
menuName={'방 관리'}
currentPath={currentPath}
>
<TbBuildingWarehouse className={styles.logo} />
</SideNavContent>

<SideNavContent
url={'/partyTemplate'}
menuName={'템플릿 관리'}
currentPath={currentPath}
>
<TbNote className={styles.logo} />
</SideNavContent>

<SideNavContent
url={'/partyCategory'}
menuName={'카테고리 관리'}
currentPath={currentPath}
>
<TbPlaylistAdd className={styles.logo} />
</SideNavContent>
</div>
)}
</div>
);
}
108 changes: 108 additions & 0 deletions components/admin/party/AdminCommentReport.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { useEffect, useState } from 'react';
import { useSetRecoilState } from 'recoil';
import {
Paper,
Table,
TableBody,
TableCell,
TableContainer,
TableRow,
} from '@mui/material';
import { PartyCommentReport, PartyCommentReportTable } from 'types/partyTypes';
import { instanceInPartyManage } from 'utils/axios';
import { toastState } from 'utils/recoil/toast';
import { tableFormat } from 'constants/admin/table';
import {
AdminEmptyItem,
AdminTableHead,
} from 'components/admin/common/AdminTable';
import PageNation from 'components/Pagination';
import styles from 'styles/admin/party/AdminPartyCommon.module.scss';

const tableTitle: { [key: string]: string } = {
id: '번호',
reporterIntraId: '신고자 이름',
commentsId: '댓글 번호',
roomId: '방',
message: '메세지',
createdAt: '시간',
};

export default function AdminCommentReport() {
const [commentInfo, setCommentInfo] = useState<PartyCommentReportTable>({
commentReportList: [],
totalPage: 0,
currentPage: 0,
});
const [currentPage, setCurrentPage] = useState<number>(1);
const setSnackBar = useSetRecoilState(toastState);

useEffect(() => {
instanceInPartyManage
.get(`/reports/comments?page=${currentPage}&size=10`)
.then((res) => {
setCommentInfo({
commentReportList: res.data.commentReportList,
totalPage: res.data.totalPage,
currentPage: currentPage,
});
})
.catch((error) => {
setSnackBar({
toastName: 'GET request',
message: '댓글신고를 가져오는데 실패했습니다.',
severity: 'error',
clicked: true,
});
});
}, [currentPage]);

return (
<div className={styles.AdminTableWrap}>
<div className={styles.header}>
<span className={styles.title}>댓글 신고리스트</span>
</div>
<TableContainer className={styles.tableContainer} component={Paper}>
<Table className={styles.table} aria-label='UserManagementTable'>
<AdminTableHead tableName={'partyCommentReport'} table={tableTitle} />
<TableBody className={styles.tableBody}>
{commentInfo.commentReportList &&
commentInfo.commentReportList.length > 0 ? (
commentInfo.commentReportList.map(
(report: PartyCommentReport, index: number) => (
<TableRow key={index}>
{tableFormat['partyCommentReport'].columns.map(
(columnName) => {
return (
<TableCell
key={columnName}
className={styles.tableBodyItem}
>
{report[
columnName as keyof PartyCommentReport
]?.toString()}
</TableCell>
);
}
)}
</TableRow>
)
)
) : (
<AdminEmptyItem content={'패널티 기록이 비어있습니다'} />
)}
</TableBody>
</Table>
</TableContainer>
<div className={styles.pageNationContainer}>
<PageNation
curPage={commentInfo.currentPage}
totalPages={commentInfo.totalPage}
pageChangeHandler={(pageNumber: number) => {
setCurrentPage(pageNumber);
}}
/>
</div>
</div>
);
}
108 changes: 108 additions & 0 deletions components/admin/party/AdminPartyNoShow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { useEffect, useState } from 'react';
import { useSetRecoilState } from 'recoil';
import {
Paper,
Table,
TableBody,
TableCell,
TableContainer,
TableRow,
} from '@mui/material';
import { PartyNoshowReport, PartyNoshowReportTable } from 'types/partyTypes';
import { instanceInPartyManage } from 'utils/axios';
import { toastState } from 'utils/recoil/toast';
import { tableFormat } from 'constants/admin/table';
import {
AdminEmptyItem,
AdminTableHead,
} from 'components/admin/common/AdminTable';
import PageNation from 'components/Pagination';
import styles from 'styles/admin/party/AdminPartyCommon.module.scss';

const tableTitle: { [key: string]: string } = {
id: '번호',
reporterIntraId: '신고자 이름',
reporteeIntraId: '피신고자 이름',
roomId: '방',
message: '메세지',
createdAt: '시간',
};

export default function AdminPartyNoShow() {
const [noShowInfo, setNoShowInfo] = useState<PartyNoshowReportTable>({
noShowReportList: [],
totalPages: 0,
currentPage: 0,
});
const [currentPage, setCurrentPage] = useState<number>(1);
const setSnackBar = useSetRecoilState(toastState);

useEffect(() => {
instanceInPartyManage
.get(`/reports/users?page=${currentPage}&size=10`)
.then((res) => {
setNoShowInfo({
noShowReportList: res.data.noShowReportList,
totalPages: res.data.totalPage,
currentPage: currentPage,
});
})
.catch((error) => {
setSnackBar({
toastName: 'GET request',
message: '댓글신고를 가져오는데 실패했습니다.',
severity: 'error',
clicked: true,
});
});
}, [currentPage]);

return (
<div className={styles.AdminTableWrap}>
<div className={styles.header}>
<span className={styles.title}>노쇼 신고리스트</span>
</div>
<TableContainer className={styles.tableContainer} component={Paper}>
<Table className={styles.table} aria-label='UserManagementTable'>
<AdminTableHead tableName={'partyNoshowReport'} table={tableTitle} />
<TableBody className={styles.tableBody}>
{noShowInfo.noShowReportList &&
noShowInfo.noShowReportList.length > 0 ? (
noShowInfo.noShowReportList.map(
(report: PartyNoshowReport, index: number) => (
<TableRow key={index}>
{tableFormat['partyNoshowReport'].columns.map(
(columnName) => {
return (
<TableCell
key={columnName}
className={styles.tableBodyItem}
>
{report[
columnName as keyof PartyNoshowReport
]?.toString()}
</TableCell>
);
}
)}
</TableRow>
)
)
) : (
<AdminEmptyItem content={'패널티 기록이 비어있습니다'} />
)}
</TableBody>
</Table>
</TableContainer>
<div className={styles.pageNationContainer}>
<PageNation
curPage={noShowInfo.currentPage}
totalPages={noShowInfo.totalPages}
pageChangeHandler={(pageNumber: number) => {
setCurrentPage(pageNumber);
}}
/>
</div>
</div>
);
}
Loading

0 comments on commit 21694b4

Please sign in to comment.