Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 대시보드 페이지 timeline date issue 및 css 수정 #326

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/page/dashboard/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Flex from '@/common/component/Flex/Flex';
import { contentBoxStyle, handoverBoxStyle } from '@/page/dashboard/DashboardPage.style';
import FileSection from '@/page/dashboard/component/File/FileSection';
import HandoverSection from '@/page/dashboard/component/Handover/HandoverSection';
import TimelineSection from '@/page/dashboard/component/Timeline/TimelineSection';
import TimelineSection from '@/page/dashboard/component/Timeline';

import ContentBox from '@/shared/component/ContentBox/ContentBox';
import { PATH } from '@/shared/constant/path';
Expand Down
16 changes: 16 additions & 0 deletions src/page/dashboard/component/Handover/ListItem/ListItem.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { css } from '@emotion/react';

import { theme } from '@/common/style/theme/theme';

import { alignColor } from '@/page/dashboard/util/color';

export const containerStyle = css({
flexDirection: 'column',
alignItems: 'center',
Expand All @@ -12,6 +14,8 @@ export const containerStyle = css({
backgroundColor: theme.colors.gray_100,
borderRadius: '8px',

cursor: 'pointer',

':hover': {
backgroundColor: theme.colors.gray_200,

Expand Down Expand Up @@ -51,3 +55,15 @@ export const detailStyle = css({

gap: '0.4rem',
});

export const tagStyle = (color: string) =>
css({
maxWidth: '18rem',

color: alignColor(color),

whiteSpace: 'nowrap',
overflow: 'hidden',

textOverflow: 'ellipsis',
});
10 changes: 2 additions & 8 deletions src/page/dashboard/component/Handover/ListItem/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
contentStyle,
detailContainerStyle,
detailStyle,
tagStyle,
titleStyle,
} from '@/page/dashboard/component/Handover/ListItem/ListItem.style';
import { ListTag } from '@/page/dashboard/type/listTag';
import { getVisibleTags } from '@/page/dashboard/util/alignTags';
import { alignColor } from '@/page/dashboard/util/color';

export interface ListItemProps extends HTMLAttributes<HTMLDivElement> {
title: string;
Expand All @@ -41,13 +41,7 @@ const ListItem = ({ title, content, date, tags = [], ...props }: ListItemProps)
<div ref={tagContanierRef} css={[detailStyle, { display: 'flex', overflow: 'hidden' }]}>
{visibleTags.map((tag) => {
return (
<Tag
key={tag.tagId}
css={{
color: alignColor(tag.bgColor),
whiteSpace: 'nowrap',
}}
bgColor={tag.bgColor}>
<Tag key={tag.tagId} css={tagStyle(tag.bgColor)} bgColor={tag.bgColor}>
{tag.content}
</Tag>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import { useNavigate } from 'react-router-dom';

import DateProvider from '@/page/archiving/index/DateProvider';
import { useDateContext } from '@/page/archiving/index/DateProvider';
import Day from '@/page/archiving/index/component/TimeLine/Day/Day';
import { dayBodyStyle } from '@/page/archiving/index/component/TimeLine/Day/Day.style';
import TimeBlock from '@/page/archiving/index/component/TimeLine/TimeBlock/TimeBlock';
import TimeLineHeader from '@/page/archiving/index/component/TimeLine/TimeLineHeader/TimeLineHeader';
import { useGetTimeBlockQuery } from '@/page/archiving/index/hook/api/useGetTimeBlockQuery';
import { useDate } from '@/page/archiving/index/hook/common/useDate';
import { Block } from '@/page/archiving/index/type/blockType';
import { alignBlocks, createTimeBlock } from '@/page/archiving/index/util/block';
import { timelineContentStyle } from '@/page/dashboard/component/Timeline/TimelineSection.style';
import { timelineContentStyle } from '@/page/dashboard/component/Timeline/Timeline/TimelineinDash.style';

import { PATH } from '@/shared/constant/path';

const TimelineSection = () => {
const TimelineinDash = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

파스칼 케이스로 작성해주세용 !
그리고 컴포넌트명은 폴더구조가 이미 분리되어 있기 때문에 Timeline으로 해도 괜찮을 것 같은데 어떻게 생각하실까요 ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

인정합니다!! 💯

const navigate = useNavigate();

const teamId = localStorage.getItem('teamId');
const { currentYear, currentMonth, endDay } = useDate(teamId!);

const { currentYear, currentMonth, endDay } = useDateContext();

const { data } = useGetTimeBlockQuery(+teamId!, 'executive', currentYear, currentMonth);

const timeBlocks: Block[] = data.timeBlocks;
const blockFloors = alignBlocks(timeBlocks, endDay, currentMonth, currentYear);

return (
<DateProvider teamId={teamId!}>
<TimeLineHeader />
<>
<Day />
<div css={[dayBodyStyle(endDay.getDate()), timelineContentStyle]}>
{timeBlocks.map((block) => {
Expand Down Expand Up @@ -54,8 +52,8 @@ const TimelineSection = () => {
);
})}
</div>
</DateProvider>
</>
);
};

export default TimelineSection;
export default TimelineinDash;
20 changes: 20 additions & 0 deletions src/page/dashboard/component/Timeline/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Suspense } from 'react';

import DateProvider from '@/page/archiving/index/DateProvider';
import TimeLineHeader from '@/page/archiving/index/component/TimeLine/TimeLineHeader/TimeLineHeader';
import TimelineinDash from '@/page/dashboard/component/Timeline/Timeline/TimelineinDash';

const TimelineSection = () => {
const teamId = localStorage.getItem('teamId');

return (
<DateProvider teamId={teamId!}>
<TimeLineHeader />
<Suspense>
<TimelineinDash />
</Suspense>
</DateProvider>
);
};

export default TimelineSection;
58 changes: 29 additions & 29 deletions src/page/dashboard/constant/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export const Notes: Note[] = [
content: '티키의 3번째 정기 회의록입니다.티키의 3번째 정기 회의록입니다.',
date: new Date(),
tags: [
{ tagId: 1, content: 'OT준비', bgColor: '#E2E8F8' },
{ tagId: 2, content: '먀옹', bgColor: '#F8E2CB' },
{ tagId: 3, content: '매옹', bgColor: '#F8E2CB' },
{ tagId: 4, content: '난나난', bgColor: '#F8E2CB' },
{ tagId: 0, content: 'OT준비', bgColor: '#E2E8F8' },
{ tagId: 1, content: '먀옹', bgColor: '#F8E2CB' },
{ tagId: 2, content: '매옹', bgColor: '#F8E2CB' },
{ tagId: 3, content: '난나난', bgColor: '#F8E2CB' },
],
},
{
Expand All @@ -19,10 +19,10 @@ export const Notes: Note[] = [
content: '티키의 3번째 정기 회의록입니다.티키의 3번째 정기 회의록입니다.',
date: new Date(),
tags: [
{ tagId: 1, content: '고양이', bgColor: '#F8E2CB' },
{ tagId: 2, content: 'D.C.', bgColor: '#F8E1F5' },
{ tagId: 3, content: 'DormCat', bgColor: '#C4F2E5' },
{ tagId: 4, content: 'I love', bgColor: '#F8E2CB' },
{ tagId: 0, content: '고양이고양이고양이고양이고양이고양이고양이고양이', bgColor: '#F8E2CB' },
{ tagId: 1, content: 'D.C.', bgColor: '#F8E1F5' },
{ tagId: 2, content: 'DormCat', bgColor: '#C4F2E5' },
{ tagId: 3, content: 'I love', bgColor: '#F8E2CB' },
],
},
{
Expand All @@ -31,12 +31,12 @@ export const Notes: Note[] = [
content: '티키의 3번째 정기 회의록입니다.티키의 3번째 정기 회의록입니다.',
date: new Date(),
tags: [
{ tagId: 1, content: '귀여운', bgColor: '#F8E1F5' },
{ tagId: 2, content: '봄 MT', bgColor: '#F8E1F5' },
{ tagId: 3, content: '가을 MT', bgColor: '#F8E1F5' },
{ tagId: 4, content: '학과 엠티', bgColor: '#F8E1F5' },
{ tagId: 5, content: '집부 엠티', bgColor: '#F8E1F5' },
{ tagId: 6, content: '공대 엠티', bgColor: '#F8E1F5' },
{ tagId: 0, content: '귀여운', bgColor: '#F8E1F5' },
{ tagId: 1, content: '봄 MT', bgColor: '#F8E1F5' },
{ tagId: 2, content: '가을 MT', bgColor: '#F8E1F5' },
{ tagId: 3, content: '학과 엠티', bgColor: '#F8E1F5' },
{ tagId: 4, content: '집부 엠티', bgColor: '#F8E1F5' },
{ tagId: 5, content: '공대 엠티', bgColor: '#F8E1F5' },
],
},
{
Expand All @@ -45,31 +45,31 @@ export const Notes: Note[] = [
content: '티키의 3번째 정기 회의록입니다.티키의 3번째 정기 회의록입니다.',
date: new Date(),
tags: [
{ tagId: 1, content: '낄낄', bgColor: '#DCD8FA' },
{ tagId: 2, content: '엠티 기간', bgColor: '#F8E2CB' },
{ tagId: 3, content: '엠티 준비 위원회 회의', bgColor: '#DCD8FA' },
{ tagId: 4, content: '엠엠', bgColor: '#F8E2CB' },
{ tagId: 5, content: 'study', bgColor: '#DCD8FA' },
{ tagId: 6, content: 'event', bgColor: '#F8E2CB' },
{ tagId: 7, content: 'study', bgColor: '#DCD8FA' },
{ tagId: 8, content: 'event', bgColor: '#F8E2CB' },
{ tagId: 0, content: '낄낄', bgColor: '#DCD8FA' },
{ tagId: 1, content: '엠티 기간', bgColor: '#F8E2CB' },
{ tagId: 2, content: '엠티 준비 위원회 회의', bgColor: '#DCD8FA' },
{ tagId: 3, content: '엠엠', bgColor: '#F8E2CB' },
{ tagId: 4, content: 'study', bgColor: '#DCD8FA' },
{ tagId: 5, content: 'event', bgColor: '#F8E2CB' },
{ tagId: 6, content: 'study', bgColor: '#DCD8FA' },
{ tagId: 7, content: 'event', bgColor: '#F8E2CB' },
],
},
{
noteId: 5,
title: '3차 정기 회의',
content: '티키의 3번째 정기 회의록입니다.티키의 3번째 정기 회의록입니다.',
date: new Date(),
tags: [{ tagId: 1, content: '시험기간', bgColor: '#F8E1F5' }],
tags: [{ tagId: 0, content: '시험기간', bgColor: '#F8E1F5' }],
},
{
noteId: 6,
title: '3차 정기 회의',
content: '티키의 3번째 정기 회의록입니다.티키의 3번째 정기 회의록입니다.',
date: new Date(),
tags: [
{ tagId: 1, content: 'study', bgColor: '#F8E1F5' },
{ tagId: 2, content: 'notice', bgColor: '#C4F2E5' },
{ tagId: 0, content: 'study', bgColor: '#F8E1F5' },
{ tagId: 1, content: 'notice', bgColor: '#C4F2E5' },
],
},
{
Expand All @@ -78,10 +78,10 @@ export const Notes: Note[] = [
content: '티키의 3번째 정기 회의록입니다.티키의 3번째 정기 회의록입니다.',
date: new Date(),
tags: [
{ tagId: 1, content: 'recruiting', bgColor: '#E2E8F8' },
{ tagId: 0, content: 'recruiting', bgColor: '#E2E8F8' },
{ tagId: 1, content: 'event', bgColor: '#F8E2CB' },
{ tagId: 2, content: 'event', bgColor: '#F8E2CB' },
{ tagId: 3, content: 'event', bgColor: '#F8E2CB' },
{ tagId: 4, content: 'event', bgColor: '#F8E2CB' },
],
},
{
Expand All @@ -90,8 +90,8 @@ export const Notes: Note[] = [
content: '티키의 3번째 정기 회의록입니다.티키의 3번째 정기 회의록입니다.',
date: new Date(),
tags: [
{ tagId: 1, content: 'study', bgColor: '#F8E1F5' },
{ tagId: 2, content: 'notice', bgColor: '#C4F2E5' },
{ tagId: 0, content: 'study', bgColor: '#F8E1F5' },
{ tagId: 1, content: 'notice', bgColor: '#C4F2E5' },
],
},
];
7 changes: 6 additions & 1 deletion src/page/dashboard/util/alignTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ export const getVisibleTags = (tags: ListTag[], maxWidth: number, tagGap: number
document.body.removeChild(tempElement);

//현재 태그까지 추가 후 너비 초과 검사
if (totalWidth + tagWidth * 2 + tagGap > maxWidth) break;
if (totalWidth + tagWidth * 2 + tagGap > maxWidth) {
if (tag.tagId == 0) {
visibleTags.push(tag);
}
break;
}
totalWidth += tagWidth * 2 + tagGap;
visibleTags.push(tag);
}
Expand Down