Skip to content

Commit

Permalink
Merge pull request #1422 from 42organization/test-deploy
Browse files Browse the repository at this point in the history
[Bug] 파티 모집 배포 후 피드백 방영 main 동기화
  • Loading branch information
izone00 authored Apr 20, 2024
2 parents a8f537e + f4b513b commit ade8b8d
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 47 deletions.
2 changes: 1 addition & 1 deletion components/Layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function Header() {
const path = router.asPath.split('?')[0]; // 쿼리 스트링 제거
const patterns = [
/^\/party\/create$/, // '/party/create'
/^\/party\/[0-9]+$/, // '/party/[roomId]'
/^\/party\/room$/, // '/party/[roomId]'
];

return patterns.some((pattern) => pattern.test(path));
Expand Down
2 changes: 1 addition & 1 deletion components/admin/party/AdminCommentReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function AdminCommentReport() {
return (
<div className={styles.AdminTableWrap}>
<div className={styles.header}>
<span className={styles.title}>댓글 신고리스트</span>
<span className={styles.title}>댓글 신고 목록</span>
</div>
<TableContainer className={styles.tableContainer} component={Paper}>
<Table className={styles.table} aria-label='UserManagementTable'>
Expand Down
4 changes: 2 additions & 2 deletions components/admin/party/AdminPartyNoShow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function AdminPartyNoShow() {
.get(`/reports/users?page=${currentPage}&size=10`)
.then((res) => {
setNoShowInfo({
noShowReportList: res.data.noShowReportList,
noShowReportList: res.data.userReportList,
totalPages: res.data.totalPage,
currentPage: currentPage,
});
Expand All @@ -60,7 +60,7 @@ export default function AdminPartyNoShow() {
return (
<div className={styles.AdminTableWrap}>
<div className={styles.header}>
<span className={styles.title}>노쇼 신고리스트</span>
<span className={styles.title}>노쇼 신고 목록</span>
</div>
<TableContainer className={styles.tableContainer} component={Paper}>
<Table className={styles.table} aria-label='UserManagementTable'>
Expand Down
2 changes: 1 addition & 1 deletion components/admin/party/AdminPartyRoomReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function AdminPartyRoomReport() {
return (
<div className={styles.AdminTableWrap}>
<div className={styles.header}>
<span className={styles.title}>신고리스트</span>
<span className={styles.title}>신고 목록</span>
</div>
<TableContainer component={Paper}>
<Table aria-label='UserManagementTable'>
Expand Down
105 changes: 72 additions & 33 deletions components/admin/party/PartyTemplate.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { useSetRecoilState } from 'recoil';
import {
Paper,
Expand All @@ -17,7 +17,7 @@ import styles from 'styles/admin/party/AdminPartyCommon.module.scss';

const tableTitle: { [key: string]: string } = {
gameTemplateId: '템플릿번호',
categoryId: '카테고리',
categoryName: '카테고리',
gameName: '템플릿이름',
maxGamePeople: '최대인원',
minGamePeople: '최소인원',
Expand All @@ -33,6 +33,7 @@ const tableTitle: { [key: string]: string } = {
export default function PartyTemplate() {
const { templates, deleteTemplate } = usePartyTemplate();
const setModal = useSetRecoilState(modalState);
const [selectedCategory, setSelectedCategory] = useState('all');

useEffect(() => {
console.log('Render');
Expand All @@ -50,6 +51,10 @@ export default function PartyTemplate() {
deleteTemplate({ gameTemplateId });
};

const handleCategorySelect = (category: string) => {
setSelectedCategory(category);
};

return (
<div>
<div className={styles.AdminTableWrap}>
Expand All @@ -62,41 +67,75 @@ export default function PartyTemplate() {
추가
</button>
</div>
<div className={styles.container}>
<ul className={styles.ullist}>
<li
className={styles.lilist}
onClick={() => handleCategorySelect('all')}
>
전체
</li>
<li
className={styles.lilist}
onClick={() => handleCategorySelect('콘솔게임')}
>
콘솔게임
</li>
<li
className={styles.lilist}
onClick={() => handleCategorySelect('보드게임')}
>
보드게임
</li>
<li
className={styles.lilist}
onClick={() => handleCategorySelect('기타')}
>
기타
</li>
</ul>
</div>
<TableContainer className={styles.tableContainer} component={Paper}>
<Table className={styles.table} aria-label='UserManagementTable'>
<AdminTableHead tableName={'partyTemplate'} table={tableTitle} />
<TableBody className={styles.tableBody}>
{templates.map((t) => (
<TableRow key={t.gameTemplateId}>
{tableFormat['partyTemplate'].columns.map((columnName) => {
return (
<TableCell
key={columnName}
className={styles.tableBodyItem}
>
{columnName === 'change' && (
<button
onClick={() => handleEditTemplate(t)}
className={`${styles.button_1} ${styles.edit}`}
>
수정
</button>
)}
{columnName === 'delete' ? (
<button
onClick={() => deleteHandler(t.gameTemplateId)}
className={`${styles.button_1} ${styles.delete}`}
>
삭제
</button>
) : (
t[columnName as keyof PartyGameTemplate]?.toString()
)}
</TableCell>
);
})}
</TableRow>
))}
{templates
.filter(
(t) =>
selectedCategory === 'all' ||
t.categoryName === selectedCategory
)
.map((t) => (
<TableRow key={t.gameTemplateId}>
{tableFormat['partyTemplate'].columns.map((columnName) => {
return (
<TableCell
key={columnName}
className={styles.tableBodyItem}
>
{columnName === 'change' && (
<button
onClick={() => handleEditTemplate(t)}
className={`${styles.button_1} ${styles.edit}`}
>
수정
</button>
)}
{columnName === 'delete' ? (
<button
onClick={() => deleteHandler(t.gameTemplateId)}
className={`${styles.button_1} ${styles.delete}`}
>
삭제
</button>
) : (
t[columnName as keyof PartyGameTemplate]?.toString()
)}
</TableCell>
);
})}
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
Expand Down
15 changes: 12 additions & 3 deletions components/modal/admin/AdminTemplateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default function TemplateModal({
template ?? {
gameName: '',
categoryName: '기타',
maxGamePeople: 1,
minGamePeople: 1,
maxGamePeople: 2,
minGamePeople: 2,
maxGameTime: 1,
minGameTime: 1,
genre: '',
Expand All @@ -38,6 +38,7 @@ export default function TemplateModal({

const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
console.log(formData);
if (isUpdate(formData)) updateTemplate(formData);
else createTemplate(formData);
setModal({ modalName: null });
Expand All @@ -57,6 +58,14 @@ export default function TemplateModal({
setFormData({ ...formData, gameName: e.target.value })
}
/>
<label>카테고리: </label>
<input
type='text'
value={formData.categoryName}
onChange={(e) =>
setFormData({ ...formData, categoryName: e.target.value })
}
/>
<label>최소 인원: </label>
<input
type='number'
Expand All @@ -69,7 +78,7 @@ export default function TemplateModal({
});
}
}}
min={1}
min={2}
max={formData.maxGamePeople}
/>
<label>최대 인원: </label>
Expand Down
1 change: 1 addition & 0 deletions components/modal/party/PartyRoomEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export default function PartyRoomEditModal({ roomId }: { roomId: number }) {
<div>
<span className={styles.commentUserName}>
{comment.nickname}
<span className={styles.intraId}> ({comment.intraId})</span>
</span>
<span className={styles.commentDate}>
{dateToStringShort(new Date(comment.createDate))}
Expand Down
2 changes: 1 addition & 1 deletion constants/party/createOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const customTemplate: PartyTemplateWithoutCategory = {
gameTemplateId: custumTemplateId,
gameName: '직접 입력',
minGamePeople: 2,
maxGamePeople: 4,
maxGamePeople: 8,
minGameTime: 15,
maxGameTime: 30,
genre: '',
Expand Down
4 changes: 2 additions & 2 deletions hooks/party/usePartyForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ const reducer: React.Reducer<PartyCreateForm, PartyFormAction> = (
switch (action.type) {
case 'UPDATE_TITLE':
if (action.title.length > 15) return state;
return { ...state, title: action.title };
return { ...state, title: action.title.trimStart() };
case 'UPDATE_MIN_PEOPLE':
return { ...state, minPeople: action.minPeople };
case 'UPDATE_MAX_PEOPLE':
return { ...state, maxPeople: action.maxPeople };
case 'UPDATE_CONTENT':
if (action.content.length > 100) return state;
return { ...state, content: action.content };
return { ...state, content: action.content.trimStart() };
case 'UPDATE_OPEN_PERIOD':
return {
...state,
Expand Down
23 changes: 23 additions & 0 deletions styles/admin/party/AdminPartyCommon.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
@import 'styles/common.scss';
@import 'styles/admin/common/Pagination.module.scss';

.container {
width: 100%;
}

.tableContainer {
.table {
.tableBody {
Expand Down Expand Up @@ -66,4 +70,23 @@
}
}

.ullist {
display: flex;
justify-content: center;
gap: 10px;
list-style: none;
}

.lilist {
padding: 8px 16px;
cursor: pointer;
border: 2px solid #5b5a5a;
border-radius: 8px;
transition: background-color 0.3s ease;

&:hover {
background-color: #eaeaea;
}
}

@include pagination;
6 changes: 5 additions & 1 deletion styles/admin/party/PartyRoomEdit.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
ul {
display: flex;
margin: 0 5%;
margin: 0;

li {
display: flex;
Expand Down Expand Up @@ -99,6 +99,10 @@

.commentUserName {
font-weight: 500;

.intraId {
color: $dark-gray;
}
}
.commentDate {
margin-left: 1em;
Expand Down
6 changes: 4 additions & 2 deletions styles/party/PartyCreate.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@

select {
width: 2.5em;
text-align: center;
color: black;
text-align-last: center;
}
.textCenter {
width: 2.5em;
Expand All @@ -163,7 +164,8 @@

select {
width: 2.5em;
text-align: center;
color: black;
text-align-last: center;
}
.textCenter {
width: 2.5em;
Expand Down

0 comments on commit ade8b8d

Please sign in to comment.