diff --git a/Layout/AdminLayout.tsx b/Layout/AdminLayout.tsx index 9a23d7fc6..6befb7a24 100644 --- a/Layout/AdminLayout.tsx +++ b/Layout/AdminLayout.tsx @@ -27,10 +27,10 @@ function AdminAppLayout({ children }: AdminLayoutProps) { } return ( - - {children} + <> + {children} {ModalProviderComponent && } - + ); } diff --git a/Layout/AgendaLayout.tsx b/Layout/AgendaLayout.tsx index ebedb256f..f84499d2c 100644 --- a/Layout/AgendaLayout.tsx +++ b/Layout/AgendaLayout.tsx @@ -28,11 +28,11 @@ function AgendaAppLayout({ children }: AgendaLayoutProps) {
{children}
+ ); } diff --git a/Layout/TakguLayout.tsx b/Layout/TakguLayout.tsx index c95d01aa0..315385095 100644 --- a/Layout/TakguLayout.tsx +++ b/Layout/TakguLayout.tsx @@ -85,11 +85,13 @@ function TakguLayout({ children }: TakguLayoutProps) { } const TakguAppLayout = ({ children }: TakguLayoutProps) => { return ( - - {children} + <> + + {children} + + - - + ); }; diff --git a/components/admin/agenda/SideNavAgenda.tsx b/components/admin/agenda/SideNavAgenda.tsx index 8898a4b6d..63cabbde5 100644 --- a/components/admin/agenda/SideNavAgenda.tsx +++ b/components/admin/agenda/SideNavAgenda.tsx @@ -1,5 +1,7 @@ import { useRouter } from 'next/router'; -import { TbMessageReport } from 'react-icons/tb'; +import { FaRegCalendarCheck, FaRegUserCircle } from 'react-icons/fa'; +import { GrAnnounce } from 'react-icons/gr'; +import { RiTeamLine } from 'react-icons/ri'; import SideNavContent from 'components/admin/SideNavContent'; import styles from 'styles/admin/SideNav.module.scss'; @@ -11,10 +13,10 @@ export default function SideNavParty() { - + - + - + - + ); diff --git a/components/admin/agenda/agendaList/AgendaFillterTab.tsx b/components/admin/agenda/agendaList/AgendaFillterTab.tsx index 79c6c2cce..61e792a87 100644 --- a/components/admin/agenda/agendaList/AgendaFillterTab.tsx +++ b/components/admin/agenda/agendaList/AgendaFillterTab.tsx @@ -13,15 +13,15 @@ export default function AgendaFillterTab() { }, { contentId: 1, - contentName: '공식', + contentName: '모집 중', }, { contentId: 2, - contentName: '비공식', + contentName: '진행 중', }, { contentId: 3, - contentName: '완료된 대회', + contentName: '진행 완료', }, ]; @@ -31,13 +31,13 @@ export default function AgendaFillterTab() { setChild(); break; case 1: - setChild(); + setChild(); break; case 2: - setChild(); + setChild(); break; case 3: - setChild(); + setChild(); break; } }, [tabIdx]); diff --git a/components/admin/agenda/agendaList/AgendaTable.tsx b/components/admin/agenda/agendaList/AgendaTable.tsx index ab3c06cbd..03401670f 100644 --- a/components/admin/agenda/agendaList/AgendaTable.tsx +++ b/components/admin/agenda/agendaList/AgendaTable.tsx @@ -88,8 +88,9 @@ export default function AgendaTable({ status, isOfficial }: AgendaTableProps) { const { openModal, closeModal } = useModal(); const buttonList: string[] = [ - styles.detail, styles.delete, + styles.default, + styles.detail, styles.coin, styles.penalty, ]; @@ -122,6 +123,7 @@ export default function AgendaTable({ status, isOfficial }: AgendaTableProps) { { agenda_key: agendaKey }, (data) => { alert('취소 요청이 성공적으로 전송되었습니다.'); + getAgendaList(); }, (error) => { alert('취소 요청에 실패했습니다: ' + error); @@ -156,6 +158,18 @@ export default function AgendaTable({ status, isOfficial }: AgendaTableProps) { case '공지사항': router.push(`/admin/agenda/announcements?agendaKey=${agendaKey}`); break; + case '포스터': + if (!agenda.agendaPosterUrl) { + alert('포스터가 없습니다.'); + return; + } + openModal({ + type: 'notice', + title: '포스터', + description: "포스터 수정은 '자세히' 버튼을 눌러주세요.", + image: agenda.agendaPosterUrl, + }); + break; } }; @@ -164,6 +178,7 @@ export default function AgendaTable({ status, isOfficial }: AgendaTableProps) { const getData = await instanceInAgenda.get( `/admin/request/list?page=${currentPage}&size=${itemsPerPage}` ); + const filteredAgendaList = getData.data.content.filter( (agenda: IAgenda) => { const matchesStatus = status ? agenda.agendaStatus === status : true; @@ -199,9 +214,9 @@ export default function AgendaTable({ status, isOfficial }: AgendaTableProps) { case AgendaStatus.CANCEL: return '취소'; case AgendaStatus.OPEN: - return '진행 중'; + return '모집 중'; case AgendaStatus.CONFIRM: - return '확정'; + return '진행 중'; case AgendaStatus.FINISH: return '진행완료'; default: diff --git a/components/admin/agenda/announcements/AnnouncementTable.tsx b/components/admin/agenda/announcements/AnnouncementTable.tsx index 79e9b80c4..025a8ba47 100644 --- a/components/admin/agenda/announcements/AnnouncementTable.tsx +++ b/components/admin/agenda/announcements/AnnouncementTable.tsx @@ -4,6 +4,7 @@ import { MenuItem, Paper, Select, + SelectChangeEvent, Table, TableBody, TableCell, @@ -46,11 +47,6 @@ export interface IAnnouncementTable { currentPage: number; } -export interface Request { - page: number; - size: number; -} - export default function AnnouncementTable() { const router = useRouter(); const { agendaKey } = router.query; @@ -61,39 +57,26 @@ export default function AnnouncementTable() { totalPage: 1, currentPage: 1, }); - const [currentPage, setCurrentPage] = useState(1); - const [selectedAgendaKey, setSelectedAgendaKey] = useState(''); - const agendaList = useFetchGet(`list`).data || []; + const [selectedAgendaKey, setSelectedAgendaKey] = useState(''); + const agendaList = useFetchGet('admin/list').data || []; - const buttonList: string[] = [styles.coin, styles.penalty]; + useEffect(() => { + if (agendaKey) { + setSelectedAgendaKey(agendaKey as string); + } + }, [agendaKey]); - const handleButtonAction = (buttonName: string, announce: IAnnouncement) => { - switch (buttonName) { - case '수정': - openModal({ - type: 'modify', - title: '공지사항 수정', - description: '변경 후 수정 버튼을 눌러주세요.', - FormComponent: AnnouncementForm, - data: announce, - stringKey: agendaKey as string, - isAdmin: true, - onProceed: () => { - closeModal(); - getAnnoucementList(); - }, - }); + useEffect(() => { + if (selectedAgendaKey) { + fetchAnnouncementList(); } - }; + }, [selectedAgendaKey, currentPage]); - const getAnnoucementList = useCallback(async () => { - try { - if (!selectedAgendaKey) { - return; - } // 선택된 agenda가 없으면 반환 + const fetchAnnouncementList = useCallback(async () => { + if (!selectedAgendaKey) return; - // const res = mockTeamList; // 여기에 API 호출 추가 + try { const response = await instance.get(`/agenda/admin/announcement`, { params: { agenda_key: selectedAgendaKey, @@ -104,44 +87,44 @@ export default function AnnouncementTable() { setAnnouncementInfo({ announcementList: response.data.content.map( - (announce: IAnnouncement) => { - return { - ...announce, - createdAt: dateToString(new Date(announce.createdAt)), - }; - } + (announce: IAnnouncement) => ({ + ...announce, + createdAt: dateToString(new Date(announce.createdAt)), + }) ), totalPage: Math.ceil(response.data.totalSize / itemsPerPage), - currentPage: currentPage, + currentPage, }); - } catch (e) { - console.error('Error fetching team list:', e); + } catch (error) { + console.error('Error fetching announcement list:', error); } - }, [currentPage, selectedAgendaKey]); // selectedAgendaKey 추가 + }, [currentPage, selectedAgendaKey]); - useEffect(() => { - if (agendaKey) { - setSelectedAgendaKey(agendaKey as string); - } - }, [agendaKey]); - - useEffect(() => { - if (selectedAgendaKey) { - getAnnoucementList(); - } - }, [selectedAgendaKey, currentPage, getAnnoucementList]); - - const handleSelectChange = (event: { target: { value: any } }) => { - const newValue = event.target.value; + const handleSelectChange = (event: SelectChangeEvent) => { + const newValue = event.target.value as string; setSelectedAgendaKey(newValue); - setCurrentPage(1); // 페이지 초기화 + setCurrentPage(1); router.push(`?agendaKey=${newValue}`); }; - const renderIsShow = (isShow: boolean) => { - return isShow ? '공개' : '비공개'; + const handleButtonAction = (announce: IAnnouncement) => { + openModal({ + type: 'modify', + title: '공지사항 수정', + description: '변경 후 수정 버튼을 눌러주세요.', + FormComponent: AnnouncementForm, + data: announce, + stringKey: agendaKey as string, + isAdmin: true, + onProceed: () => { + closeModal(); + fetchAnnouncementList(); + }, + }); }; + const renderIsShow = (isShow: boolean) => (isShow ? '공개' : '비공개'); + return (
@@ -163,75 +146,67 @@ export default function AnnouncementTable() {
{selectedAgendaKey ? ( - - - - - {announcementInfo.announcementList.length > 0 ? ( - announcementInfo.announcementList.map( - (announce: IAnnouncement, index) => ( - - {agendaTableFormat['announcement'].columns.map( - (columnName: string, index: number) => { - return ( - - {columnName === 'isShow' - ? renderIsShow(announce[columnName]) - : columnName !== 'etc' - ? announce[columnName as keyof IAnnouncement] // 다른 열의 기본 값 표시 - : agendaTableFormat[ - 'announcement' - ].etc?.value.map( - (buttonName: string, index: number) => ( - - ) - )} - - ); - } - )} - + <> + +
+ + + {announcementInfo.announcementList && + announcementInfo.announcementList.length > 0 ? ( + announcementInfo.announcementList.map( + (announce: IAnnouncement, index) => ( + + {agendaTableFormat['announcement'].columns.map( + (columnName: string, index: number) => { + return ( + + {columnName === 'isShow' ? ( + renderIsShow(announce[columnName]) + ) : columnName !== 'etc' ? ( + announce[columnName as keyof IAnnouncement] // 다른 열의 기본 값 표시 + ) : ( + + )} + + ); + } + )} + + ) ) - ) - ) : ( - - )} - -
-
+ ) : ( + + )} + + + +
+ { + setCurrentPage(pageNumber); + }} + /> +
+ ) : (
아젠다를 선택해주세요.
)} -
- { - setCurrentPage(pageNumber); - getAnnoucementList(); - }} - /> -
); } diff --git a/components/admin/agenda/teamList/TeamTable.tsx b/components/admin/agenda/teamList/TeamTable.tsx index 61fd3745c..ad68ff152 100644 --- a/components/admin/agenda/teamList/TeamTable.tsx +++ b/components/admin/agenda/teamList/TeamTable.tsx @@ -113,15 +113,6 @@ export default function TeamTable() { }, }); - if (response.data.content.length === 0) { - setSnackBar({ - toastName: 'GET request', - message: '팀이 없습니다.', - severity: 'error', - clicked: true, - }); - } - setTeamInfo({ teamList: response.data.content, totalPage: Math.ceil(response.data.totalSize / itemsPerPage), @@ -129,12 +120,6 @@ export default function TeamTable() { }); } catch (e) { console.error('Error fetching team list:', e); - setSnackBar({ - toastName: 'GET request', - message: '팀 목록을 가져오는데 실패했습니다.', - severity: 'error', - clicked: true, - }); } }, [currentPage, selectedAgendaKey, agendaKey]); @@ -195,66 +180,68 @@ export default function TeamTable() { {selectedAgendaKey ? ( - - - - - {teamInfo.teamList.length > 0 ? ( - teamInfo.teamList.map((team: ITeam, index) => ( - - {agendaTableFormat['team'].columns.map( - (columnName: string, index: number) => { - return ( - - {columnName === 'teamStatus' - ? renderStatus(team.teamStatus) // 상태 표시 - : columnName === 'teamIsPrivate' - ? renderIsPrivate(team.teamIsPrivate) // 공개 여부 표시 - : columnName !== 'etc' - ? team[columnName as keyof ITeam] // 다른 열의 기본 값 표시 - : agendaTableFormat['team'].etc?.value.map( - (buttonName: string, index: number) => ( - - ) - )} - - ); - } - )} - - )) - ) : ( - - )} - -
-
+ <> + + + + + {teamInfo.teamList.length > 0 ? ( + teamInfo.teamList.map((team: ITeam, index) => ( + + {agendaTableFormat['team'].columns.map( + (columnName: string, index: number) => { + return ( + + {columnName === 'teamStatus' + ? renderStatus(team.teamStatus) // 상태 표시 + : columnName === 'teamIsPrivate' + ? renderIsPrivate(team.teamIsPrivate) // 공개 여부 표시 + : columnName !== 'etc' + ? team[columnName as keyof ITeam] // 다른 열의 기본 값 표시 + : agendaTableFormat['team'].etc?.value.map( + (buttonName: string, index: number) => ( + + ) + )} + + ); + } + )} + + )) + ) : ( + + )} + +
+
+
+ { + setCurrentPage(pageNumber); + }} + /> +
+ ) : (
아젠다를 선택해주세요.
)} -
- { - setCurrentPage(pageNumber); - }} - /> -
); } diff --git a/components/agenda/Form/AdminTicketForm.tsx b/components/agenda/Form/AdminTicketForm.tsx index 67550231d..e269269b8 100644 --- a/components/agenda/Form/AdminTicketForm.tsx +++ b/components/agenda/Form/AdminTicketForm.tsx @@ -50,15 +50,6 @@ const AdminTicketForm = ({ stringKey, data, onProceed }: userFormProps) => { jsonData.isApproved = isApproved; jsonData.isUsed = isUsed; - if (!jsonData.issuedFromKey) { - alert('발급처는 반드시 선택해야 합니다.'); - return; - } - if ((jsonData.isUsed || jsonData.usedAt) && !jsonData.usedToKey) { - alert('사용처는 반드시 선택해야 합니다.'); - return; - } - sendRequest( 'PATCH', 'admin/ticket', @@ -81,14 +72,18 @@ const AdminTicketForm = ({ stringKey, data, onProceed }: userFormProps) => { className={styles.container} >
-
IntraId : {stringKey}
+
IntraId : {stringKey}
+
+ 발급처를 선택하지 않으면 42Intra 로 발급됩니다. +

발급처

@@ -97,6 +92,7 @@ const AdminTicketForm = ({ stringKey, data, onProceed }: userFormProps) => { selectedKey={usedToKey} dataList={agendaList} handleSelectChange={handleusedTo} + defaultSelect='42Intra' />
diff --git a/components/agenda/Form/TicketForm.tsx b/components/agenda/Form/TicketForm.tsx index 056b01b8a..9fd820c41 100644 --- a/components/agenda/Form/TicketForm.tsx +++ b/components/agenda/Form/TicketForm.tsx @@ -54,10 +54,15 @@ const TicketForm = ({ stringKey }: userFormProps) => { >
IntraId : {stringKey}
+
발급처
+

+ 발급처를 선택하지 않으면 42Intra 로 발급됩니다. +

diff --git a/components/agenda/Form/userForm.tsx b/components/agenda/Form/userForm.tsx index d9cd2155b..f147bcc48 100644 --- a/components/agenda/Form/userForm.tsx +++ b/components/agenda/Form/userForm.tsx @@ -81,7 +81,7 @@ const UserForm = ({ stringKey }: userFormProps) => {
diff --git a/components/agenda/Home/AgendaInfo.tsx b/components/agenda/Home/AgendaInfo.tsx index d4b797add..7d8cc2aba 100644 --- a/components/agenda/Home/AgendaInfo.tsx +++ b/components/agenda/Home/AgendaInfo.tsx @@ -1,7 +1,7 @@ import Image from 'next/image'; import { AgendaDataProps } from 'types/agenda/agendaDetail/agendaTypes'; import { showPeriod, fillZero } from 'utils/handleTime'; -import AgendaTag from 'components/agenda/utils/AgendaTag'; +import { AgendaTag } from 'components/agenda/utils/AgendaTag'; import { isSoloTeam } from 'components/agenda/utils/team'; import styles from 'styles/agenda/Home/AgendaInfo.module.scss'; diff --git a/components/agenda/Home/MyTeamInfo.tsx b/components/agenda/Home/MyTeamInfo.tsx index 10f8813a7..9ac1df2a2 100644 --- a/components/agenda/Home/MyTeamInfo.tsx +++ b/components/agenda/Home/MyTeamInfo.tsx @@ -1,7 +1,7 @@ import Link from 'next/link'; import { MyTeamDataProps } from 'types/agenda/agendaDetail/agendaTypes'; import { fillZero } from 'utils/handleTime'; -import AgendaTag from 'components/agenda/utils/AgendaTag'; +import { AgendaTag } from 'components/agenda/utils/AgendaTag'; import agendastyles from 'styles/agenda/Home/AgendaInfo.module.scss'; import styles from 'styles/agenda/Home/MyTeamInfo.module.scss'; diff --git a/components/agenda/Input/AgendaSelect.tsx b/components/agenda/Input/AgendaSelect.tsx index 7d441ca92..392960be9 100644 --- a/components/agenda/Input/AgendaSelect.tsx +++ b/components/agenda/Input/AgendaSelect.tsx @@ -6,18 +6,18 @@ interface AgendaSelectProps { selectedKey: string; dataList: any; handleSelectChange: (event: { target: { value: any } }) => void; + defaultSelect?: string; } const AgendaSelect = ({ selectedKey, dataList, handleSelectChange, + defaultSelect = 'Choose an agenda...', }: AgendaSelectProps) => { return (