Skip to content

Commit

Permalink
Merge pull request #1336 from 42organization/feat/파티어드민-패널티-시간변경-#1335
Browse files Browse the repository at this point in the history
[Fix] 시간출력오류 변경
  • Loading branch information
contemplation-person authored Mar 29, 2024
2 parents 96574dc + 4ad8fe4 commit 58eeb00
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 19 deletions.
2 changes: 1 addition & 1 deletion components/admin/party/AdminCommentReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
AdminTableHead,
} from 'components/admin/common/AdminTable';
import PageNation from 'components/Pagination';
import styles from 'styles/admin/Party/AdminPartyCommon.module.scss';
import styles from 'styles/admin/party/AdminPartyCommon.module.scss';

const tableTitle: { [key: string]: string } = {
id: '번호',
Expand Down
2 changes: 1 addition & 1 deletion components/admin/party/AdminPartyNoShow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
AdminTableHead,
} from 'components/admin/common/AdminTable';
import PageNation from 'components/Pagination';
import styles from 'styles/admin/Party/AdminPartyCommon.module.scss';
import styles from 'styles/admin/party/AdminPartyCommon.module.scss';

const tableTitle: { [key: string]: string } = {
id: '번호',
Expand Down
13 changes: 9 additions & 4 deletions components/admin/party/AdminPartyPenalty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@mui/material';
import { PartyPenaltyAdmin, PartyPenaltyTable } from 'types/partyTypes';
import { instanceInPartyManage } from 'utils/axios';
import { dateToStringShort } from 'utils/handleTime';
import { modalState } from 'utils/recoil/modal';
import { toastState } from 'utils/recoil/toast';
import { tableFormat } from 'constants/admin/table';
Expand All @@ -18,7 +19,7 @@ import {
AdminTableHead,
} from 'components/admin/common/AdminTable';
import PageNation from 'components/Pagination';
import styles from 'styles/admin/Party/AdminPartyCommon.module.scss';
import styles from 'styles/admin/party/AdminPartyCommon.module.scss';

const tableTitle: { [key: string]: string } = {
id: '번호',
Expand Down Expand Up @@ -58,14 +59,14 @@ export default function AdminCommentReport() {
clicked: true,
});
});
}, [currentPage, penaltyInfo]);
}, [currentPage]);

const handleAddpenalty = () => {
setModal({ modalName: 'ADMIN-PARTY_ADMIN_PENALTY' });
setModal({ modalName: 'ADMIN-PARTY_PENALTY' });
};

const handleEditpenalty = (partyPenalty?: PartyPenaltyAdmin) => {
setModal({ modalName: 'ADMIN-PARTY_ADMIN_PENALTY', partyPenalty });
setModal({ modalName: 'ADMIN-PARTY_PENALTY', partyPenalty });
};

return (
Expand Down Expand Up @@ -101,6 +102,10 @@ export default function AdminCommentReport() {
>
수정
</button>
) : columnName === 'startTime' ? (
<span>
{dateToStringShort(new Date(penalty.startTime))}
</span>
) : (
penalty[
columnName as keyof PartyPenaltyAdmin
Expand Down
8 changes: 4 additions & 4 deletions components/admin/party/AdminPartyRoomReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
AdminTableHead,
} from 'components/admin/common/AdminTable';
import PageNation from 'components/Pagination';
import styles from 'styles/admin/Party/AdminPartyCommon.module.scss';
import styles from 'styles/admin/party/AdminPartyCommon.module.scss';

const tableTitle: { [key: string]: string } = {
id: '번호',
Expand All @@ -31,7 +31,7 @@ const tableTitle: { [key: string]: string } = {
export default function AdminPartyRoomReport() {
const [roomInfo, setRoomInfo] = useState<PartyRoomReportTable>({
roomReportList: [],
totalPage: 0,
totalPages: 0,
currentPage: 0,
});
const [currentPage, setCurrentPage] = useState<number>(1);
Expand All @@ -44,7 +44,7 @@ export default function AdminPartyRoomReport() {
.then((res) => {
setRoomInfo({
roomReportList: res.data.roomReportList,
totalPage: res.data.totalPage,
totalPages: res.data.totalPage,
currentPage: currentPage,
});
})
Expand Down Expand Up @@ -92,7 +92,7 @@ export default function AdminPartyRoomReport() {
<div className={styles.pageNationContainer}>
<PageNation
curPage={roomInfo.currentPage}
totalPages={roomInfo.totalPage}
totalPages={roomInfo.totalPages}
pageChangeHandler={(pageNumber: number) => {
setCurrentPage(pageNumber);
}}
Expand Down
2 changes: 1 addition & 1 deletion components/admin/party/PartyTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { modalState } from 'utils/recoil/modal';
import { tableFormat } from 'constants/admin/table';
import { AdminTableHead } from 'components/admin/common/AdminTable';
import { usePartyTemplate } from 'hooks/party/usePartyTemplate';
import styles from 'styles/admin/Party/AdminPartyCommon.module.scss';
import styles from 'styles/admin/party/AdminPartyCommon.module.scss';

const tableTitle: { [key: string]: string } = {
gameTemplateId: '템플릿번호',
Expand Down
21 changes: 15 additions & 6 deletions components/modal/admin/AdminPartyPenaltyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ export default function PartyPenaltyModal({
partyPenalty?: PartyPenaltyAdmin;
}) {
const [formData, setFormData] = useState<PartyPenaltyAdminSubmit>(
partyPenalty ?? {
penaltyType: '',
message: '',
penaltyTime: 0,
userIntraId: '',
}
partyPenalty
? {
penaltyType: partyPenalty.penaltyType,
message: partyPenalty.message,
penaltyTime: partyPenalty.penaltyTime,
userIntraId: partyPenalty.userIntraId || '',
}
: {
penaltyType: '',
message: '',
penaltyTime: 0,
userIntraId: '',
}
);
const setModal = useSetRecoilState(modalState);
const [isUpdateMode, setIsUpdateMode] = useState(partyPenalty ? true : false);
Expand Down Expand Up @@ -67,6 +74,7 @@ export default function PartyPenaltyModal({
<input
type='text'
value={formData.penaltyType}
maxLength={20}
onChange={(e) =>
setFormData({ ...formData, penaltyType: e.target.value })
}
Expand All @@ -75,6 +83,7 @@ export default function PartyPenaltyModal({
<input
type='text'
value={formData.message}
maxLength={100}
onChange={(e) =>
setFormData({ ...formData, message: e.target.value })
}
Expand Down
2 changes: 1 addition & 1 deletion components/modal/modalType/AdminModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default function AdminModal() {
<AdminTournamentParticipantEditModal tournamentId={tournamentId} />
) : null,
'ADMIN-PARTY_TEMPLATE': <TemplateModal template={template} />,
'ADMIN-PARTY_ADMIN_PENALTY': (
'ADMIN-PARTY_PENALTY': (
<AdminPartyPenaltyModal partyPenalty={partyPenalty} />
),
'ADMIN-PARTY_EDIT': roomId ? <PartyRoomEditModal roomId={roomId} /> : null,
Expand Down
2 changes: 1 addition & 1 deletion types/modalTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type AdminModal =
| 'TOURNAMENT_BRAKET_EDIT'
| 'TOURNAMENT_PARTICIPANT_EDIT'
| 'PARTY_TEMPLATE'
| 'PARTY_ADMIN_PENALTY'
| 'PARTY_PENALTY'
| 'PARTY_EDIT';

type ModalName =
Expand Down
32 changes: 32 additions & 0 deletions types/partyTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,38 @@ export type PartyPenaltyAdmin = {
message: string;
startTime: string;
penaltyTime: number;
userIntraId?: string;
};

export type PartyPenaltyAdminSubmit = {
penaltyType: string;
message: string;
penaltyTime: number;
userIntraId: string;
};

export type PartyCommentReportTable = {
commentReportList: PartyCommentReport[];
totalPage: number;
currentPage: number;
};

export type PartyPenaltyTable = {
penaltyList: PartyPenaltyAdmin[];
totalPage: number;
currentPage: number;
};

export type PartyNoshowReportTable = {
noShowReportList: PartyNoshowReport[];
totalPages: number;
currentPage: number;
};

export type PartyRoomReportTable = {
roomReportList: PartyNoshowReport[];
totalPages: number;
currentPage: number;
};

export type PartyColors = 'PARTY-MAIN';

0 comments on commit 58eeb00

Please sign in to comment.