Skip to content

Commit

Permalink
Merge pull request #1526 from 42organization/fix/#1465-myagenda-api-u…
Browse files Browse the repository at this point in the history
…pdate

[Fix] myagenda api 업데이트 된 부분 반영 #1465
  • Loading branch information
cweedlee authored Sep 3, 2024
2 parents b38bcdc + 4ca6df3 commit 3e54d12
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 68 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
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
10 changes: 7 additions & 3 deletions pages/agenda/profile/[intraId]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRouter } from 'next/router';
import { CurrentItemProps } from 'types/agenda/profile/currentListTypes';
import { MyTeamDataProps } from 'types/agenda/agendaDetail/agendaTypes';
import { HistoryItemProps } from 'types/agenda/profile/historyListTypes';
import { ProfileDataProps } from 'types/agenda/profile/profileDataTypes';
import AgendaUserSearchBar from 'components/agenda/Profile/AgendaUserSearchBar';
Expand All @@ -25,24 +25,28 @@ const AgendaProfile = () => {
isMyProfile ? '/profile' : `/profile/${intraId}`
);

// host current
const {
content: hostCurrentListData,
PagaNationElementProps: PagaNationHostCurrent,
} = usePageNation<HistoryItemProps>({
} = usePageNation<MyTeamDataProps>({
url: `/host/current/list/${intraId}`,
});

const currentListData = useFetchGet<CurrentItemProps[]>(
// current team
const currentListData = useFetchGet<MyTeamDataProps[]>(
'/profile/current/list'
).data;

// host history
const {
content: hostHistoryListData,
PagaNationElementProps: PagaNationHostHistory,
} = usePageNation<HistoryItemProps>({
url: `/host/history/list/${intraId}`,
});

// history
const {
content: historyListData,
PagaNationElementProps: PagaNationHistory,
Expand Down
8 changes: 6 additions & 2 deletions pages/agenda/ticket/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Ticket from 'components/agenda/Ticket/Ticket';

import styles from 'styles/agenda/Ticket/Ticket.module.scss';
const ticket = () => {
return <Ticket type='page' />;
return (
<div className={styles.pageContainer}>
<Ticket type='page' />;
</div>
);
};

export default ticket;
6 changes: 6 additions & 0 deletions styles/agenda/Home/MyTeamInfo.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

.Container {
display: flex;
max-width: 100%;
padding: 0.5rem 1rem;
background-color: var(--box-bg-1);
border: var(--default-border);
border-radius: $radius-medium;
box-shadow: var(--default-box-shadow);
gap: 1rem;
}

Expand Down
6 changes: 3 additions & 3 deletions types/agenda/agendaDetail/agendaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export interface MyTeamDataProps {
agendaTitle: string;
agendaLocation: string; // ENUM 상단참고
agendaStartTime?: Date | string;
teamStatus: string;
teamKey: string; // 내 팀 조회를 위한 key
teamStatus?: string;
teamKey?: string; // 내 팀 조회를 위한 key
isOfficial: boolean; //공식대회여부
teamName: string; //fe 추가 0728 : 와이어프레임 참고
teamName?: string; //fe 추가 0728 : 와이어프레임 참고
}
13 changes: 0 additions & 13 deletions types/agenda/profile/currentListTypes.ts

This file was deleted.

0 comments on commit 3e54d12

Please sign in to comment.