Skip to content

Commit

Permalink
Merge pull request #1509 from 42organization/Feat/#1469-profile-page-api
Browse files Browse the repository at this point in the history
[Feat] profile page 작업
  • Loading branch information
irenee-14 authored Aug 30, 2024
2 parents 42e84e0 + 4ed5778 commit 2af3b20
Show file tree
Hide file tree
Showing 26 changed files with 1,029 additions and 387 deletions.
2 changes: 1 addition & 1 deletion components/agenda/Layout/MenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const MenuBar = ({ headerstate }: { headerstate: HeaderContextState }) => {
>
<MenuBarContent
content={`Hello. ${user?.intraId}`}
href='/agenda/profile'
href={`/agenda/profile/${user?.intraId}`}
as='h2'
/>
<MenuBarContent content='Agenda' href='/agenda' as='h1' />
Expand Down
22 changes: 0 additions & 22 deletions components/agenda/Profile/AgendaHistory.tsx

This file was deleted.

31 changes: 31 additions & 0 deletions components/agenda/Profile/CurrentList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {
CurrentListProps,
CurrentItemProps,
} from 'types/agenda/profile/currentListTypes';
import styles from 'styles/agenda/Profile/CurrentList.module.scss';

const CurrentList = ({ currentListData, isHost }: CurrentListProps) => {
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>
</div>
))
) : (
<div className={styles.currentTeamEmpty}>
참여중 아젠다가 없습니다.
</div>
)}
</div>
</div>
);
};

export default CurrentList;
27 changes: 0 additions & 27 deletions components/agenda/Profile/CurrentTeam.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions components/agenda/Profile/CurrentTeamItem.tsx

This file was deleted.

68 changes: 0 additions & 68 deletions components/agenda/Profile/HistoryItem.tsx

This file was deleted.

126 changes: 126 additions & 0 deletions components/agenda/Profile/HistoryList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import Link from 'next/link';
import {
HistoryListProps,
HistoryItemProps,
} from 'types/agenda/profile/historyListTypes';
import AgendaTag from 'components/agenda/utils/AgendaTag';
import { countHistoryCoalitions } from 'components/agenda/utils/coalition/countCoalitions';
import ColorList from 'components/agenda/utils/ColorList';
import TeamIcon from 'public/image/agenda/rock-and-roll-hand.svg';
import TimeIcon from 'public/image/agenda/Time.svg';
import styles from 'styles/agenda/Profile/HistoryList.module.scss';

const parsingHistoryData = (historyData: HistoryItemProps) => {
const historyTeamMates = historyData.teamMates || null;
const totalPeople = historyData.teamMates ? historyData.teamMates.length : 0;
const peopleCount = historyData.teamMates
? countHistoryCoalitions(historyData.teamMates)
: {};
const startTime = historyData.agendaStartTime.slice(0, 10);
const endTime = historyData.agendaEndTime.slice(0, 10);

let timeString = '';
if (startTime === endTime) timeString += startTime;
else timeString = startTime + ' ~ ' + endTime;

return {
historyTeamMates,
totalPeople,
peopleCount,
startTime,
endTime,
timeString,
};
};

const HistoryList = ({ historyListData, isHost }: HistoryListProps) => {
const historyTitle = isHost ? '아젠다 개최 기록' : '아젠다 참여 기록';

return (
<div className={styles.agendaHistory}>
<div className={styles.historyTitleText}>{historyTitle}</div>
<div className={styles.historyItems}>
{historyListData.length > 0 ? (
historyListData.map((historyData: HistoryItemProps) => {
const {
historyTeamMates,
totalPeople,
peopleCount,
startTime,
endTime,
timeString,
} = parsingHistoryData(historyData);

return (
<Link
href={`/agenda/${historyData.agendaKey}`}
className={styles.historyItem}
key={historyData.agendaId}
>
<div className={styles.agendaTitle}>
{historyData.agendaTitle}
</div>

<div className={styles.tagWrapper}>
{/* PROGRESS : tag mapping */}
{historyData.isOfficial ? (
<AgendaTag tagName='공식' />
) : (
<AgendaTag tagName='비공식' />
)}
<AgendaTag tagName='팀' />
</div>

<div className={styles.timeWrapper}>
<div className={styles.imageWrapper}>
<TimeIcon />
</div>

<div className={styles.timeContent}>{timeString}</div>
</div>

{/* Team 정보 UI / host 경우 ❌ */}
{historyTeamMates && historyTeamMates.length > 0 ? (
<>
<hr className={styles.divider} />

<div className={styles.teamName}>
{historyData.teamName}
</div>

<div className={styles.teamIntraIdWrapper}>
<div className={styles.imageWrapper}>
<TeamIcon />
</div>

{/* intra id mapping */}
<div className={styles.intraIdWrapper}>
{historyTeamMates.map((mate) => (
<div key={`${historyData.agendaId}-${mate.intraId}`}>
{mate.intraId}
</div>
))}
</div>
</div>

{/* coalition color mapping */}
<div className={styles.coalitionWrapper}>
<ColorList
peopleCount={peopleCount}
totalPeople={totalPeople}
/>
</div>
</>
) : null}
</Link>
);
})
) : (
<div className={styles.historyEmpty}>아젠다 기록이 없습니다.</div>
)}
</div>
</div>
);
};

export default HistoryList;
Loading

0 comments on commit 2af3b20

Please sign in to comment.