Skip to content

Commit

Permalink
feat(time): add day status constant in region & add campus status con…
Browse files Browse the repository at this point in the history
…stants / types (#97)
  • Loading branch information
SWARVY committed Aug 17, 2024
1 parent 4dbe105 commit 3b3cb40
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
24 changes: 5 additions & 19 deletions apps/time/src/widgets/time-table/model/constants/period.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const DAY_PERIOD = {
export const DAY_PERIOD = {
'1': {
start: { hour: 9, minute: 0 },
end: { hour: 9, minute: 50 },
Expand Down Expand Up @@ -91,7 +91,7 @@ const DAY_PERIOD = {
},
} as const;

const NIGHT_PERIOD = {
export const NIGHT_PERIOD = {
'1': {
start: { hour: 17, minute: 50 },
end: { hour: 18, minute: 35 },
Expand Down Expand Up @@ -124,7 +124,7 @@ const NIGHT_PERIOD = {
},
} as const;

const DAY_PERIOD_ARRAY = Object.entries(DAY_PERIOD).sort(
export const DAY_PERIOD_ARRAY = Object.entries(DAY_PERIOD).sort(
([, periodA], [, periodB]) => {
const timeA = periodA.start.hour * 60 + periodA.start.minute;
const timeB = periodB.start.hour * 60 + periodB.start.minute;
Expand All @@ -133,7 +133,7 @@ const DAY_PERIOD_ARRAY = Object.entries(DAY_PERIOD).sort(
},
);

const NIGHT_PERIOD_ARRAY = Object.entries(NIGHT_PERIOD).sort(
export const NIGHT_PERIOD_ARRAY = Object.entries(NIGHT_PERIOD).sort(
([, periodA], [, periodB]) => {
const timeA = periodA.start.hour * 60 + periodA.start.minute;
const timeB = periodB.start.hour * 60 + periodB.start.minute;
Expand All @@ -142,18 +142,4 @@ const NIGHT_PERIOD_ARRAY = Object.entries(NIGHT_PERIOD).sort(
},
);

const DAY_STATUS = {
day: '주간',
night: '야간',
} as const;

const SPECIAL_PERIOD = ['이러닝', '교외수업', '사회봉사'] as const;

export {
DAY_PERIOD,
NIGHT_PERIOD,
SPECIAL_PERIOD,
DAY_PERIOD_ARRAY,
NIGHT_PERIOD_ARRAY,
DAY_STATUS,
};
export const SPECIAL_PERIOD = ['이러닝', '교외수업', '사회봉사'] as const;
16 changes: 16 additions & 0 deletions apps/time/src/widgets/time-table/model/constants/region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,20 @@ export const REGION = {
campus2: '서울',
} as const;

export const DAY_STATUS = {
day: '주간',
night: '야간',
} as const;

export const CAMPUS_STATUS = {
day: [
`${REGION.campus1}${DAY_STATUS.day}`,
`${REGION.campus2}${DAY_STATUS.day}`,
],
night: [
`${REGION.campus1}${DAY_STATUS.night}`,
`${REGION.campus2}${DAY_STATUS.night}`,
],
} as const;

export const REGION_VALUE_ARRAY = Object.values(REGION);
5 changes: 0 additions & 5 deletions apps/time/src/widgets/time-table/types/day-status.ts

This file was deleted.

8 changes: 7 additions & 1 deletion apps/time/src/widgets/time-table/types/region.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import { REGION } from '@/widgets/time-table';
import { CAMPUS_STATUS, DAY_STATUS, REGION } from '@/widgets/time-table';

export type Region = (typeof REGION)[keyof typeof REGION];

export type DayStatus = keyof typeof DAY_STATUS;

export type DayCampus = (typeof CAMPUS_STATUS.day)[number];

export type NightCampus = (typeof CAMPUS_STATUS.night)[number];

0 comments on commit 3b3cb40

Please sign in to comment.