Skip to content

Commit

Permalink
Merge pull request #1534 from 42organization/agenda
Browse files Browse the repository at this point in the history
[test-deploy] 현재까지 수정사항 테스트
  • Loading branch information
cweedlee authored Sep 3, 2024
2 parents 8a44173 + b4f8ce1 commit 39659f4
Show file tree
Hide file tree
Showing 36 changed files with 241 additions and 136 deletions.
2 changes: 1 addition & 1 deletion components/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function PageNation({
const router = useRouter();
return (
<div className={router.pathname.includes('takgu') ? '' : styles.container}>
{!!totalPages && (
{totalPages && totalPages > 1 && (
<Pagination
activePage={curPage}
itemsCountPerPage={1}
Expand Down
3 changes: 1 addition & 2 deletions components/admin/agenda/announcements/AnnouncementTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useRouter } from 'next/router';
import { useCallback, useEffect, useState } from 'react';
import { Description } from '@mui/icons-material';
import {
MenuItem,
Paper,
Expand Down Expand Up @@ -36,7 +35,7 @@ const tableTitle: { [key: string]: string } = {
export interface IAnnouncement {
id: number;
title: string;
contents: string;
content: string;
isShow: boolean;
createdAt: string;
}
Expand Down
1 change: 0 additions & 1 deletion components/agenda/Form/AdminTicketForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { json } from 'stream/consumers';
import { useState } from 'react';
import { ITicket } from 'types/agenda/ticket/ticketTypes';
import AgendaSelect from 'components/agenda/Input/AgendaSelect';
Expand Down
6 changes: 6 additions & 0 deletions components/agenda/Form/AgendaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const AgendaForm = ({
tommorrow.setDate(today.getDate() + 1);
tommorrow.setHours(0);
tommorrow.setMinutes(0);
tommorrow.setSeconds(0);
tommorrow.setMilliseconds(0);
const startDate = new Date();
const endDate = new Date();
Expand Down Expand Up @@ -99,6 +100,7 @@ const AgendaForm = ({
const handleRecruitEnd = (e: React.ChangeEvent<HTMLInputElement>) => {
if (!e.target.value) return;
const newEnd = new Date(e.target.value);
console.log(newEnd);
checkWarn(newEnd, 0);
setRecruitEnd(new Date(e.target.value));
};
Expand All @@ -124,6 +126,10 @@ const AgendaForm = ({
const newWarning = [...dateWarn];
const DateValues = [recruitEnd, dateRange[0], dateRange[1]];
DateValues[index] = newDate;
tommorrow.setHours(0);
tommorrow.setMinutes(0);
tommorrow.setSeconds(0);
tommorrow.setMilliseconds(0);
// 모집마감일 오류
if (DateValues[0].getTime() < tommorrow.getTime()) {
newWarning[0] = '내일 이후의 날짜를 선택해주세요';
Expand Down
9 changes: 1 addition & 8 deletions components/agenda/Home/MyAgendaBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,7 @@ const MyAgendaBtn = () => {
<div className={styles.myAgendaListContainer}>
{myList.length > 0 ? (
myList.map((myTeamInfo, idx) => (
<Link
href={`/agenda/${myTeamInfo.agendaKey}/${myTeamInfo.teamKey}`}
key={idx}
>
<div className={styles.myagendaItemContainer} key={idx}>
<MyTeamInfo myTeamInfo={myTeamInfo} key={idx} idx={idx} />
</div>
</Link>
<MyTeamInfo myTeamInfo={myTeamInfo} key={idx} idx={idx} />
))
) : (
<div className={styles.noAgendaText}>There is no agenda</div>
Expand Down
65 changes: 39 additions & 26 deletions components/agenda/Home/MyTeamInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Link from 'next/link';
import { MyTeamDataProps } from 'types/agenda/agendaDetail/agendaTypes';
import { fillZero } from 'utils/handleTime';
import AgendaTag from 'components/agenda/utils/AgendaTag';
Expand All @@ -15,39 +16,51 @@ const MyTeamInfo = ({
if (!myTeamInfo) {
return <div>참가중인 일정이 없습니다.</div>;
}
// myTeamInfo.isOfficial = true; //css test
const startDate = new Date(myTeamInfo.agendaStartTime as string);
//아래 주석달린 부분은 api 변경시 추가 예정입니다.

return (
<div className={styles.Container} key={idx}>
<div className={agendastyles.agendaDateBox}>
<div className={agendastyles.agendaStartDateMonth}>
{fillZero(`${startDate.getMonth()}`, 2)}
</div>
<Link
href={`/agenda/${myTeamInfo.agendaKey}${
myTeamInfo.teamKey ? '/' + myTeamInfo.teamKey : ''
}`}
key={idx}
>
<div className={styles.Container} key={idx}>
<div className={agendastyles.agendaDateBox}>
<div className={agendastyles.agendaStartDateMonth}>
{fillZero(`${startDate.getMonth()}`, 2)}
</div>

<div className={agendastyles.agendaStartDateDay}>
{fillZero(`${startDate.getDate()}`, 2)}
</div>
</div>
<div className={styles.infoContainer}>
<div className={styles.teamInfoContainer}>
<h2 className={styles.teamTitle}>
팀이름 : {myTeamInfo.agendaTitle}
</h2>
{/* <div className={styles.agendaStatus}>
{myTeamInfo.isOfficial ? <AgendaTag tagName='공식' /> : ''}
</div> */}
<div className={agendastyles.agendaStartDateDay}>
{fillZero(`${startDate.getDate()}`, 2)}
</div>
</div>
<div className={styles.agendaInfoContainer}>
<h3 className={styles.agendaTitle}>
아젠다 : {myTeamInfo.agendaTitle}
</h3>
<div className={styles.agendaTagBox}>
{myTeamInfo.isOfficial ? <AgendaTag tagName='공식' /> : ''}
<div className={styles.infoContainer}>
<div className={styles.teamInfoContainer}>
{myTeamInfo.teamName ? (
<>
<h2 className={styles.teamTitle}>{myTeamInfo.teamName}</h2>
<div className={styles.agendaTagBox}>
{myTeamInfo.teamStatus === 'OPEN' ? (
<AgendaTag tagName='모집중' />
) : (
<AgendaTag tagName='확정팀' />
)}
</div>
</>
) : (
''
)}
</div>
<div className={styles.agendaInfoContainer}>
<h3 className={styles.agendaTitle}>{myTeamInfo.agendaTitle}</h3>
<div className={styles.agendaTagBox}>
{myTeamInfo.isOfficial ? <AgendaTag tagName='공식' /> : ''}
</div>
</div>
</div>
</div>
</div>
</Link>
);
};

Expand Down
22 changes: 13 additions & 9 deletions components/agenda/Profile/CurrentList.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import {
CurrentListProps,
CurrentItemProps,
} from 'types/agenda/profile/currentListTypes';
import Link from 'next/link';
import { MyTeamDataProps } from 'types/agenda/agendaDetail/agendaTypes';
import styles from 'styles/agenda/Profile/CurrentList.module.scss';
import MyTeamInfo from '../Home/MyTeamInfo';

const CurrentList = ({ currentListData, isHost }: CurrentListProps) => {
const CurrentList = ({
currentListData,
isHost,
}: {
currentListData: MyTeamDataProps[];
isHost: boolean;
}) => {
const listTitle = isHost ? '개최중 아젠다' : '참여중 아젠다';
return (
<div className={styles.currentListContainer}>
<div className={styles.currentListTitle}>{listTitle}</div>

<div className={styles.currentListItems}>
{currentListData.length !== 0 ? (
currentListData.map((data: CurrentItemProps) => (
<div key={data.agendaId} className={styles.currentItemWrapper}>
<div className={styles.teamName}>{data.agendaTitle}</div>
<div className={styles.title}>{data.teamName}</div>
currentListData.map((data: MyTeamDataProps, idx: number) => (
<div className={styles.myagendaItemContainer} key={idx}>
<MyTeamInfo myTeamInfo={data} key={idx} idx={idx} />
</div>
))
) : (
Expand Down
5 changes: 2 additions & 3 deletions components/agenda/Ticket/Ticket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const Ticket = ({ type }: { type: string }) => {
const { openModal } = useModal();

return (
<div className={styles.pageContainer}>
{' '}
<>
{type === 'page' ? (
<div className={styles.container}>
<h1 className={styles.h1}>내 티켓</h1>
Expand Down Expand Up @@ -87,7 +86,7 @@ const Ticket = ({ type }: { type: string }) => {
</div>
</div>
)}
</div>
</>
);
};

Expand Down
3 changes: 3 additions & 0 deletions components/agenda/agendaDetail/TabContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import AgendaAnnouncements from 'components/agenda/agendaDetail/tabs/AgendaAnnou
import AgendaConditions from 'components/agenda/agendaDetail/tabs/AgendaConditions';
import AgendaDescription from 'components/agenda/agendaDetail/tabs/AgendaDescription';
import AgendaParticipants from 'components/agenda/agendaDetail/tabs/AgendaParticipants';
import AgendaPoster from 'components/agenda/agendaDetail/tabs/AgendaPoster';
import styles from 'styles/agenda/agendaDetail/AgendaTab.module.scss';

export default function TabContent({
Expand All @@ -22,6 +23,8 @@ export default function TabContent({
return <AgendaAnnouncements isHost={isHost} />;
case tabs.CONDITIONS:
return <AgendaConditions agendaData={agendaData} />;
case tabs.POSTER:
return <AgendaPoster poster={agendaData.agendaPosterUrl} />;
default:
return null;
}
Expand Down
17 changes: 5 additions & 12 deletions components/agenda/agendaDetail/tabs/AgendaAnnouncements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,26 @@ import { AnnouncementProps } from 'types/agenda/agendaDetail/announcementTypes';
import AnnouncementItem from 'components/agenda/agendaDetail/tabs/AnnouncementItem';
import { UploadBtn } from 'components/agenda/button/UploadBtn';
import PageNation from 'components/Pagination';
// import useFetchGet from 'hooks/agenda/useFetchGet';
import usePageNation from 'hooks/agenda/usePageNation';
import styles from 'styles/agenda/agendaDetail/tabs/AgendaAnnouncements.module.scss';

export default function AgendaAnnouncements({ isHost }: { isHost: boolean }) {
const router = useRouter();
const { agendaKey } = router.query;

// !! page, size 변수로 변경
// const params = { agenda_key: agendaKey, page: 1, size: 20 };
// const content: AnnouncementProps[] | null = useFetchGet<
// AnnouncementProps[]
// >(`/announcement`, params).data;

const { content, PagaNationElementProps } = usePageNation<AnnouncementProps>({
url: `/announcement`,
params: { agenda_key: agendaKey },
});

if (!content) {
return <div>Loading...</div>;
}
const newAnnouncement = () => {
router.push(`/agenda/${agendaKey}/host/createAnnouncement`);
};

return (
<>
<div className={styles.announcementsList}>
{content &&
{content && content.length > 0 ? (
content.map((item) => (
<AnnouncementItem
key={item.id}
Expand All @@ -41,7 +31,10 @@ export default function AgendaAnnouncements({ isHost }: { isHost: boolean }) {
content={item.content}
createdAt={item.createdAt}
/>
))}
))
) : (
<div className={styles.container}>공지사항이 없습니다.</div>
)}
<PageNation {...PagaNationElementProps} />

{isHost ? (
Expand Down
4 changes: 2 additions & 2 deletions components/agenda/agendaDetail/tabs/AgendaDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from 'styles/agenda/agendaDetail/tabs/AgendaDescription.module.scs

export default function AgendaDescription({ agendaData }: AgendaProps) {
const {
agendaContents,
agendaContent,
agendaDeadLine,
agendaStartTime,
agendaEndTime,
Expand All @@ -18,7 +18,7 @@ export default function AgendaDescription({ agendaData }: AgendaProps) {
<div className={styles.descriptionTitle}>대회 정보</div>
<div className={styles.descriptionWarp}>
<div className={styles.descriptionItem}>
<h3>간단 설명</h3> {agendaContents}
<h3>간단 설명</h3> {agendaContent}
</div>
<div className={styles.descriptionItem}>
<h3>모집 완료 기간</h3> ~ {formatDate(agendaDeadLine)}
Expand Down
6 changes: 5 additions & 1 deletion components/agenda/agendaDetail/tabs/AgendaParticipants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export default function AgendaParticipants({
{isSoloTeam(agendaMinPeople, agendaMaxPeople) ? (
<ParticipantsList max={agendaMaxTeam} />
) : (
<ParticipantTeamList max={agendaMaxTeam} myTeam={myTeam} />
<ParticipantTeamList
maxTeam={agendaMaxTeam}
maxPeople={agendaMaxPeople}
myTeam={myTeam}
/>
)}
</div>
</div>
Expand Down
27 changes: 27 additions & 0 deletions components/agenda/agendaDetail/tabs/AgendaPoster.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Image from 'next/image';
import styles from 'styles/agenda/agendaDetail/AgendaTab.module.scss';

interface AgendaPosterProps {
poster: string | null | undefined;
}

const AgendaPoster = ({ poster }: AgendaPosterProps) => {
return (
<div className={styles.container}>
{poster ? (
<Image
className={styles.contentWarp}
src={poster}
alt='poster'
layout='responsive'
width={300}
height={300}
/>
) : (
<div>등록된 포스터가 없습니다.</div>
)}
</div>
);
};

export default AgendaPoster;
Loading

0 comments on commit 39659f4

Please sign in to comment.