Skip to content

Commit

Permalink
Merge pull request #188 from softeerbootcamp4th/refactor/#187-enum
Browse files Browse the repository at this point in the history
[Refactor] as const 선언 -> 상수로 수정
  • Loading branch information
sooyeoniya authored Aug 22, 2024
2 parents 3dba62d + 3444b9f commit a6c3362
Show file tree
Hide file tree
Showing 22 changed files with 231 additions and 252 deletions.
10 changes: 5 additions & 5 deletions admin/src/constants/common.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const EVENT_STATUS = {
BEFORE: "BEFORE",
DURING: "DURING",
AFTER: "AFTER",
} as const;
export const enum EVENT_STATUS {
BEFORE = "BEFORE",
DURING = "DURING",
AFTER = "AFTER",
}

export const STATUS_MAP = {
[EVENT_STATUS.BEFORE]: "오픈 전",
Expand Down
6 changes: 3 additions & 3 deletions admin/src/constants/cookie.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const COOKIE_KEY = {
ACCESS_TOKEN: "token",
} as const;
export const enum COOKIE_KEY {
ACCESS_TOKEN = "token",
}
16 changes: 8 additions & 8 deletions admin/src/constants/rush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ export const EVENT_LIST_HEADER = [
"참여자 리스트 보기",
];

export const QUERY_OPTION = {
OPTION: "option",
PRIZE: "prize",
} as const;
export const enum QUERY_OPTION {
OPTION = "option",
PRIZE = "prize",
}

export const OPTION_POSITION = {
LEFT: "LEFT",
RIGHT: "RIGHT",
} as const;
export const enum OPTION_POSITION {
LEFT = "LEFT",
RIGHT = "RIGHT",
}
3 changes: 1 addition & 2 deletions admin/src/types/lottery.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { EVENT_STATUS } from "@/constants/common";

export type LotteryEventStatusType = (typeof EVENT_STATUS)[keyof typeof EVENT_STATUS];
export interface LotteryEventType {
startDate: string;
startTime: string;
endDate: string;
endTime: string;
appliedCount: number;
winnerCount: number;
status: LotteryEventStatusType;
status: EVENT_STATUS;
}

export interface LotteryExpectationsType {
Expand Down
15 changes: 6 additions & 9 deletions admin/src/types/rush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Dispatch } from "react";
import { EVENT_STATUS } from "@/constants/common";
import { OPTION_POSITION } from "@/constants/rush";

export type RushEventStatusType = (typeof EVENT_STATUS)[keyof typeof EVENT_STATUS];
export interface RushEventType {
rushEventId: number;
eventDate: string;
Expand All @@ -11,20 +10,18 @@ export interface RushEventType {
winnerCount: number;
prizeImageUrl: string;
prizeDescription: string;
status: RushEventStatusType;
status: EVENT_STATUS;
options: RushOptionType[];
}

type RushOptionPositionType = (typeof OPTION_POSITION)[keyof typeof OPTION_POSITION];

export interface RushOptionType {
optionId: number;
mainText: string;
subText: string;
resultMainText: string;
resultSubText: string;
imageUrl: string;
position: RushOptionPositionType;
position: OPTION_POSITION;
}

export interface RushPrizeType {
Expand All @@ -36,14 +33,14 @@ export interface RushEventStateType {
rushList: RushEventType[];
}

export const RUSH_ACTION = {
SET_EVENT_LIST: "SET_EVENT_LIST",
} as const;
export const enum RUSH_ACTION {
SET_EVENT_LIST = "SET_EVENT_LIST",
}

export type ImageType = { imgName: string; imgFile: File };

export type RushEventAction = {
type: typeof RUSH_ACTION.SET_EVENT_LIST;
type: RUSH_ACTION.SET_EVENT_LIST;
payload: RushEventType[];
};

Expand Down
142 changes: 70 additions & 72 deletions client/src/constants/CasperCustom/casper.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,63 @@
import { ColorOptionType, StickerOptionType } from "@/types/casperCustom";

export const CUSTOM_OPTION = {
EYES: "eyes",
EYES_DIRECTION: "eyesDirection",
MOUTH: "mouth",
COLOR: "color",
STICKER: "sticker",
} as const;
export const EYES_OPTION = {
"15INCH_ALLOY": "15inch-alloy",
"17INCH_ALLOY": "17inch-alloy",
PIXEL: "pixel",
ELECTRIC: "electric",
VACANT: "vacant",
SMILE: "smile",
CUTE: "cute",
HEART: "heart",
} as const;
export const POSITION_OPTION = {
LEFT: "left",
CENTER: "center",
RIGHT: "right",
} as const;
export const MOUTH_OPTION = {
SMILE: "smile",
CLOUDY: "cloudy",
MOCKING: "mocking",
LAUGH: "laugh",
EXPRESSIONLESS: "expressionless",
} as const;
export const COLOR_OPTION = {
C_CREAM: "#D8D2BC",
C_ORANGE: "#CA7349",
C_KHAKI: "#515868",
C_SILVER: "#AAAEB1",
C_BLACK: "#000000",
R_LIME: "#5CDD6A",
R_TEAL: "#1CD6BE",
R_LIGHTBLUE: "#11CCF2",
R_SKYBLUE: "#3FB6FF",
R_BLUE: "#638DFF",
R_INDIGO: "#797AF7",
R_DEEPPURPLE: "#A17CF6",
R_PURPLE: "#CE7BF0",
R_MAGENTA: "#FF6FB0",
R_RED: "#FF687A",
R_ORANGE: "#FF875C",
R_AMBER: "#FFD96B",
R_YELLOW: "#FEFF78",
} as const;
export const STICKER_OPTION = {
ELECTRIC: "electric",
CHARGE_MAX: "charge-max",
CHARGE_NONE: "charge-none",
LOVELY: "lovely",
TWINKLE: "twinkle",
} as const;
export const OPTION_TYPE = {
LIMITED: "limited",
BASIC: "basic",
} as const;
export const enum CUSTOM_OPTION {
EYES = "eyes",
EYES_DIRECTION = "eyesDirection",
MOUTH = "mouth",
COLOR = "color",
STICKER = "sticker",
}
export const enum EYES_OPTION {
"15INCH_ALLOY" = "15inch-alloy",
"17INCH_ALLOY" = "17inch-alloy",
PIXEL = "pixel",
ELECTRIC = "electric",
VACANT = "vacant",
SMILE = "smile",
CUTE = "cute",
HEART = "heart",
}
export const enum POSITION_OPTION {
LEFT = "left",
CENTER = "center",
RIGHT = "right",
}
export const enum MOUTH_OPTION {
SMILE = "smile",
CLOUDY = "cloudy",
MOCKING = "mocking",
LAUGH = "laugh",
EXPRESSIONLESS = "expressionless",
}
export const enum COLOR_OPTION {
C_CREAM = "#D8D2BC",
C_ORANGE = "#CA7349",
C_KHAKI = "#515868",
C_SILVER = "#AAAEB1",
C_BLACK = "#000000",
R_LIME = "#5CDD6A",
R_TEAL = "#1CD6BE",
R_LIGHTBLUE = "#11CCF2",
R_SKYBLUE = "#3FB6FF",
R_BLUE = "#638DFF",
R_INDIGO = "#797AF7",
R_DEEPPURPLE = "#A17CF6",
R_PURPLE = "#CE7BF0",
R_MAGENTA = "#FF6FB0",
R_RED = "#FF687A",
R_ORANGE = "#FF875C",
R_AMBER = "#FFD96B",
R_YELLOW = "#FEFF78",
}
export const enum STICKER_OPTION {
ELECTRIC = "electric",
CHARGE_MAX = "charge-max",
CHARGE_NONE = "charge-none",
LOVELY = "lovely",
TWINKLE = "twinkle",
}
export const enum OPTION_TYPE {
LIMITED = "limited",
BASIC = "basic",
}

export const COLOR_BACKGROUND_MAP = [
COLOR_OPTION.R_BLUE,
Expand Down Expand Up @@ -105,7 +103,7 @@ export const STICKER_COLOR_MAP = {
},
} as const;

export const COLOR_STICKER_EXCEPTION: Partial<Record<ColorOptionType, StickerOptionType>> = {
export const COLOR_STICKER_EXCEPTION: Partial<Record<COLOR_OPTION, STICKER_OPTION>> = {
[COLOR_OPTION.C_SILVER]: STICKER_OPTION.CHARGE_MAX,
[COLOR_OPTION.R_PURPLE]: STICKER_OPTION.CHARGE_MAX,
[COLOR_OPTION.R_ORANGE]: STICKER_OPTION.CHARGE_NONE,
Expand All @@ -119,11 +117,11 @@ export const COLOR_STICKER_EXCEPTION: Partial<Record<ColorOptionType, StickerOpt
[COLOR_OPTION.C_ORANGE]: STICKER_OPTION.TWINKLE,
};

export const CASPER_Z_INDEX = {
CASPER: 2,
UNDER_CASPER: 1,
UPPER_CASPER: 3,
} as const;
export const enum CASPER_Z_INDEX {
CASPER = 2,
UNDER_CASPER = 1,
UPPER_CASPER = 3,
}

export const CASPER_OPTION = {
[CUSTOM_OPTION.EYES]: [
Expand Down Expand Up @@ -305,10 +303,10 @@ export const OPTION_MAX_COUNT = {
[CUSTOM_OPTION.COLOR]: CASPER_OPTION[CUSTOM_OPTION.COLOR].length,
};

export const CASPER_SIZE_OPTION = {
LG: "lg",
SM: "sm",
} as const;
export const enum CASPER_SIZE_OPTION {
LG = "lg",
SM = "sm",
}

export const CASPER_CARD_SIZE = {
[CASPER_SIZE_OPTION.LG]: {
Expand Down
12 changes: 6 additions & 6 deletions client/src/constants/CasperCustom/customStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {
} from "@/features/CasperCustom/CasperCustomPanel/CasperCustomPanel";
import { CUSTOM_OPTION } from "./casper";

export const CUSTOM_STEP_OPTION = {
PROCESS: "process",
FORM: "form",
FINISHING: "finishing",
FINISH: "finish",
} as const;
export const enum CUSTOM_STEP_OPTION {
PROCESS = "process",
FORM = "form",
FINISHING = "finishing",
FINISH = "finish",
}
export const CUSTOM_STEP_OPTION_ARRAY = [
CUSTOM_STEP_OPTION.PROCESS,
CUSTOM_STEP_OPTION.FORM,
Expand Down
76 changes: 38 additions & 38 deletions client/src/constants/PageSections/sections.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
export const MAIN_SECTIONS = {
HEADLINE: "HEADLINE",
LOTTERY: "LOTTERY",
RUSH: "RUSH",
LEARN_MORE: "LEARN_MORE",
} as const;
export const enum MAIN_SECTIONS {
HEADLINE = "HEADLINE",
LOTTERY = "LOTTERY",
RUSH = "RUSH",
LEARN_MORE = "LEARN_MORE",
}

export const LOTTERY_SECTIONS = {
HEADLINE: "HEADLINE",
INTRO: "INTRO",
HEADLAMP: "HEADLAMP",
PIXEL_DESIGN: "PIXEL_DESIGN",
WHEEL_DESIGN: "WHEEL_DESIGN",
CUSTOM_DESIGN: "CUSTOM_DESIGN",
NEW_COLOR: "NEW_COLOR",
SMILE_BADGE: "SMILE_BADGE",
SHORT_CUT: "SHORT_CUT",
} as const;
export const enum LOTTERY_SECTIONS {
HEADLINE = "HEADLINE",
INTRO = "INTRO",
HEADLAMP = "HEADLAMP",
PIXEL_DESIGN = "PIXEL_DESIGN",
WHEEL_DESIGN = "WHEEL_DESIGN",
CUSTOM_DESIGN = "CUSTOM_DESIGN",
NEW_COLOR = "NEW_COLOR",
SMILE_BADGE = "SMILE_BADGE",
SHORT_CUT = "SHORT_CUT",
}

export const RUSH_SECTIONS = {
HEADLINE: "HEADLINE",
INTRO: "INTRO",
FAQ: "FAQ",
ELECTRIC_REASON: "ELECTRIC_REASON",
ELECTRIC_ADVANTAGE: "ELECTRIC_ADVANTAGE",
REASON_FIRST: "REASON_FIRST",
CASPER_FAR: "CASPER_FAR",
CASPER_FAST: "CASPER_FAST",
CASPER_COMFORTABLE: "CASPER_COMFORTABLE",
REASON_SECOND: "REASON_SECOND",
CASPER_WIDE: "CASPER_WIDE",
CASPER_CHARGE: "CASPER_CHARGE",
CASPER_SMART_KEY: "CASPER_SMART_KEY",
} as const;
export const enum RUSH_SECTIONS {
HEADLINE = "HEADLINE",
INTRO = "INTRO",
FAQ = "FAQ",
ELECTRIC_REASON = "ELECTRIC_REASON",
ELECTRIC_ADVANTAGE = "ELECTRIC_ADVANTAGE",
REASON_FIRST = "REASON_FIRST",
CASPER_FAR = "CASPER_FAR",
CASPER_FAST = "CASPER_FAST",
CASPER_COMFORTABLE = "CASPER_COMFORTABLE",
REASON_SECOND = "REASON_SECOND",
CASPER_WIDE = "CASPER_WIDE",
CASPER_CHARGE = "CASPER_CHARGE",
CASPER_SMART_KEY = "CASPER_SMART_KEY",
}

export const CASPER_CUSTOM_SECTIONS = {
CUSTOM: "CUSTOM",
} as const;
export const enum CASPER_CUSTOM_SECTIONS {
CUSTOM = "CUSTOM",
}

export const CASPER_SHOWCASE_SECTIONS = {
SHOWCASE: "SHOWCASE",
} as const;
export const enum CASPER_SHOWCASE_SECTIONS {
SHOWCASE = "SHOWCASE",
}
Loading

0 comments on commit a6c3362

Please sign in to comment.