Skip to content

Commit

Permalink
Merge pull request #248 from boostcampwm-2021/develop
Browse files Browse the repository at this point in the history
release
  • Loading branch information
mminjg authored Dec 3, 2021
2 parents 988b344 + c4287ea commit 1f084da
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 55 deletions.
5 changes: 3 additions & 2 deletions frontend/src/components/Calendar/CalendarHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import moment from 'moment';
import { useResetRecoilState, useSetRecoilState } from 'recoil';

import { ModalMode, ModalSchedule } from '@stores/calendar';
import { DateInfoType, weekContentNumber } from '@src/types/calendar';
import { DateInfoType } from '@src/types/calendar';
import { WeekContentNumber } from '@utils/constants';

import { FaChevronLeft, FaChevronRight, FaCalendarAlt, FaRegCalendarPlus } from 'react-icons/fa';
import {
Expand Down Expand Up @@ -47,7 +48,7 @@ const CalendarHeader: React.FC<Props> = ({
};

const nextDateInfo = () => {
const date = moment(dateInfo.weeklyStartDate).add(weekContentNumber.WEEK_NUMBER, 'days');
const date = moment(dateInfo.weeklyStartDate).add(WeekContentNumber.WEEK_NUMBER, 'days');
return { year: date.year(), month: date.month() };
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { v4 as uuidv4 } from 'uuid';
import { DateInfoType, ScheduleType, weekContentNumber } from '@src/types/calendar';
import { DateInfoType, ScheduleType } from '@src/types/calendar';
import { WeekContentNumber } from '@utils/constants';
import Week from './Week';
import { ContentContainer } from './style';

Expand All @@ -24,7 +25,7 @@ const MonthContent: React.FC<Props> = ({ dateInfo, schedules, handleModalOpen })
week.push(0);
});
// 1일뢀터 첫주 λ§ˆμ§€λ§‰κΉŒμ§€
[...Array(weekContentNumber.WEEK_NUMBER - firstDay)].forEach(() => {
[...Array(WeekContentNumber.WEEK_NUMBER - firstDay)].forEach(() => {
week.push(curDay);
curDay += 1;
});
Expand All @@ -35,7 +36,7 @@ const MonthContent: React.FC<Props> = ({ dateInfo, schedules, handleModalOpen })
const week: number[] = [];
let day = curDay;
// 무쑰건 1μ£Όλ₯Ό μ±„μš°λ„λ‘
[...Array(weekContentNumber.WEEK_NUMBER)].forEach(() => {
[...Array(WeekContentNumber.WEEK_NUMBER)].forEach(() => {
if (day <= lastDay) {
week.push(day);
day += 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useRef, useState } from 'react';
import { v4 as uuidv4 } from 'uuid';
import { DateInfoType, weekContentNumber, ScheduleType, TimeType } from '@src/types/calendar';
import { DateInfoType, ScheduleType, TimeType } from '@src/types/calendar';
import { WeekContentNumber } from '@utils/constants';
import { isTodayDate, isSameDate } from '@utils/calendar';
import ScheduleItem from '../ScheduleItem';
import { Container, TimeContainer, DaysContainer, DayContainer, TimeBlock, CurrTimeLine } from './style';
Expand All @@ -25,7 +26,7 @@ const {
TIME_LIST,
WEEK_NUMBER,
DAY_TIME_NUMBER,
} = weekContentNumber;
} = WeekContentNumber;

const TimeListGenerator: React.FC<TimeListProps> = ({ timeList, renderItem }) => {
return <TimeContainer>{timeList.map((item: { hour: number; text: string }) => renderItem(item))}</TimeContainer>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import moment from 'moment';
import { v4 as uuidv4 } from 'uuid';
import { DateInfoType, DayCode, weekContentNumber } from '@src/types/calendar';
import { WeekContentNumber, DayCode } from '@utils/constants';
import { DateInfoType } from '@src/types/calendar';
import { Container, DayContainer } from './style';

interface Props {
dateInfo: DateInfoType;
}

const WeekHeader: React.FC<Props> = ({ dateInfo }) => {
const dayInfo = [...Array(weekContentNumber.WEEK_NUMBER)].map((v, i) => {
const dayInfo = [...Array(WeekContentNumber.WEEK_NUMBER)].map((v, i) => {
const tDate = new Date(dateInfo.weeklyStartDate);
tDate.setDate(tDate.getDate() + i);
return { day: i, date: tDate.getDate() };
Expand Down
46 changes: 0 additions & 46 deletions frontend/src/types/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,49 +56,3 @@ export interface TimeType {
hour: number;
text: string;
}

export enum DayCode {
'μΌμš”μΌ' = 0,
'μ›”μš”μΌ' = 1,
'ν™”μš”μΌ' = 2,
'μˆ˜μš”μΌ' = 3,
'λͺ©μš”일' = 4,
'κΈˆμš”μΌ' = 5,
'ν† μš”μΌ' = 6,
}

export const weekContentNumber: any = {
MSEC_TO_HOUR: 60000,
HALF_HOUR_TO_MIN: 30,
HOUR_TO_MIN: 60,
LINE_SPACE_PX: 2.5 * 16,
EXTRA_SPACE_PX: 10,
WEEK_NUMBER: 7,
DAY_TIME_NUMBER: 48,
TIME_LIST: [
{ hour: 12, text: 'μ˜€μ „' },
{ hour: 1, text: 'μ˜€μ „' },
{ hour: 2, text: 'μ˜€μ „' },
{ hour: 3, text: 'μ˜€μ „' },
{ hour: 4, text: 'μ˜€μ „' },
{ hour: 5, text: 'μ˜€μ „' },
{ hour: 6, text: 'μ˜€μ „' },
{ hour: 7, text: 'μ˜€μ „' },
{ hour: 8, text: 'μ˜€μ „' },
{ hour: 9, text: 'μ˜€μ „' },
{ hour: 10, text: 'μ˜€ν›„' },
{ hour: 11, text: 'μ˜€ν›„' },
{ hour: 12, text: 'μ˜€ν›„' },
{ hour: 1, text: 'μ˜€ν›„' },
{ hour: 2, text: 'μ˜€ν›„' },
{ hour: 3, text: 'μ˜€ν›„' },
{ hour: 4, text: 'μ˜€ν›„' },
{ hour: 5, text: 'μ˜€ν›„' },
{ hour: 6, text: 'μ˜€ν›„' },
{ hour: 7, text: 'μ˜€ν›„' },
{ hour: 8, text: 'μ˜€ν›„' },
{ hour: 9, text: 'μ˜€ν›„' },
{ hour: 10, text: 'μ˜€ν›„' },
{ hour: 11, text: 'μ˜€ν›„' },
],
};
47 changes: 47 additions & 0 deletions frontend/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,52 @@ const MODAL_THEME = {

const NOBODY = -1;

enum DayCode {
'μΌμš”μΌ' = 0,
'μ›”μš”μΌ' = 1,
'ν™”μš”μΌ' = 2,
'μˆ˜μš”μΌ' = 3,
'λͺ©μš”일' = 4,
'κΈˆμš”μΌ' = 5,
'ν† μš”μΌ' = 6,
}

const WeekContentNumber: any = {
MSEC_TO_HOUR: 60000,
HALF_HOUR_TO_MIN: 30,
HOUR_TO_MIN: 60,
LINE_SPACE_PX: 2.5 * 16,
EXTRA_SPACE_PX: 10,
WEEK_NUMBER: 7,
DAY_TIME_NUMBER: 48,
TIME_LIST: [
{ hour: 12, text: 'μ˜€μ „' },
{ hour: 1, text: 'μ˜€μ „' },
{ hour: 2, text: 'μ˜€μ „' },
{ hour: 3, text: 'μ˜€μ „' },
{ hour: 4, text: 'μ˜€μ „' },
{ hour: 5, text: 'μ˜€μ „' },
{ hour: 6, text: 'μ˜€μ „' },
{ hour: 7, text: 'μ˜€μ „' },
{ hour: 8, text: 'μ˜€μ „' },
{ hour: 9, text: 'μ˜€μ „' },
{ hour: 10, text: 'μ˜€μ „' },
{ hour: 11, text: 'μ˜€μ „' },
{ hour: 12, text: 'μ˜€ν›„' },
{ hour: 1, text: 'μ˜€ν›„' },
{ hour: 2, text: 'μ˜€ν›„' },
{ hour: 3, text: 'μ˜€ν›„' },
{ hour: 4, text: 'μ˜€ν›„' },
{ hour: 5, text: 'μ˜€ν›„' },
{ hour: 6, text: 'μ˜€ν›„' },
{ hour: 7, text: 'μ˜€ν›„' },
{ hour: 8, text: 'μ˜€ν›„' },
{ hour: 9, text: 'μ˜€ν›„' },
{ hour: 10, text: 'μ˜€ν›„' },
{ hour: 11, text: 'μ˜€ν›„' },
],
};

export { ColorCode, Font, PrimaryPalette, SecondaryPalette, TeamCard, Role, RoleArr };
export { REM, NAVBAR, HEADER, CANVAS, POSTIT, MODAL_THEME, NOBODY };
export { DayCode, WeekContentNumber };

0 comments on commit 1f084da

Please sign in to comment.