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

static 데이터 정리 #32

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/data/invalid.png
Binary file added src/assets/data/layout/haminseop_layout.jpg
Binary file added src/assets/data/layout/playground_layout.jpg
Binary file added src/assets/data/layout/sixty_anniv_pub_layout.png
1,091 changes: 1,091 additions & 0 deletions src/resources/data/booth_list.ts

Large diffs are not rendered by default.

220 changes: 220 additions & 0 deletions src/resources/data/foodtruck_list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
import { FoodTruck } from "../../shared/types/asset_types";

export const FOODTRUCK_60TH_ANNIV_LIST: FoodTruck[] = [
new FoodTruck({
id: "cfa60e2f3e",
order: 1,
name: "위키스마일",
menu: ["분식"],
place: "60주년기념관",
}),
new FoodTruck({
id: "dd840a637b",
order: 2,
name: "체리블라썸",
menu: ["소떡소떡 외 기타"],
place: "60주년기념관",
}),
new FoodTruck({
id: "c8a7090348",
order: 3,
name: "뷰카페",
menu: ["크레페"],
place: "60주년기념관",
}),
new FoodTruck({
id: "ef7acfd49f",
order: 4,
name: "메이트럭",
menu: ["불초밥"],
place: "60주년기념관",
}),
new FoodTruck({
id: "9f676aeabe",
order: 5,
name: "오픈더키친",
menu: ["야끼소바"],
place: "60주년기념관",
}),
new FoodTruck({
id: "5eaf2e31d2",
order: 6,
name: "춘향전",
menu: ["김치전"],
place: "60주년기념관",
}),
new FoodTruck({
id: "acb1c8dfed",
order: 7,
name: "오올라",
menu: ["타코"],
place: "60주년기념관",
}),
new FoodTruck({
id: "07b72f1c8c",
order: 8,
name: "럭키비키",
menu: ["감자치즈볼"],
place: "60주년기념관",
}),
new FoodTruck({
id: "91e0c4b1cb",
order: 9,
name: "츄러스앤디저트",
menu: ["츄러스"],
place: "60주년기념관",
}),
new FoodTruck({
id: "64e499c2db",
order: 10,
name: "곱창좋은날",
menu: ["순대곱창"],
place: "60주년기념관",
}),
new FoodTruck({
id: "b9f1d2a1f8",
order: 11,
name: "푸드캐스팅",
menu: ["닭꼬치"],
place: "60주년기념관",
}),
new FoodTruck({
id: "a0dfb2e0a4",
order: 12,
name: "고스트",
menu: ["스테이크"],
place: "60주년기념관",
}),
new FoodTruck({
id: "42ff792b54",
order: 13,
name: "믹스",
menu: ["크림새우"],
place: "60주년기념관",
}),
new FoodTruck({
id: "7e66b6f57e",
order: 14,
name: "듀피에",
menu: ["피자"],
place: "60주년기념관",
}),
new FoodTruck({
id: "1d673ae5f7",
order: 15,
name: "듀피에",
menu: ["닭강정"],
place: "60주년기념관",
}),
new FoodTruck({
id: "b792fd7a32",
order: 16,
name: "그양반네",
menu: ["타코야끼"],
place: "60주년기념관",
}),
new FoodTruck({
id: "40c1e5aee2",
order: 17,
name: "곰두마리",
menu: ["닭강정"],
place: "60주년기념관",
}),
new FoodTruck({
id: "5f04b43167",
order: 18,
name: "아임스크림",
menu: ["아이스크림"],
place: "60주년기념관",
}),
new FoodTruck({
id: "dce6b5f90b",
order: 19,
name: "미스터블랙",
menu: ["흑돼지덮밥"],
place: "60주년기념관",
}),
];

export const FOODTRUCK_FUTURE_LIST: FoodTruck[] = [
new FoodTruck({
id: "dce6b5f90b",
order: 1,
name: "미스터블랙",
menu: ["흑돼지덮밥"],
place: "미래광장",
}),
new FoodTruck({
id: "40c1e5aee2",
order: 2,
name: "닭강정",
menu: ["닭강정"],
place: "미래광장",
}),
new FoodTruck({
id: "7e66b6f57e",
order: 3,
name: "진츄",
menu: ["소프트아이스크림"],
place: "미래광장",
}),
new FoodTruck({
id: "b792fd7a32",
order: 4,
name: "그양반네",
menu: ["타코야끼"],
place: "미래광장",
}),
];

export const FOODTRUCK_HAMINSEOP_LIST: FoodTruck[] = [
new FoodTruck({
id: "dce6b5f90b1",
order: 1,
name: "미스터블랙",
menu: ["흑돼지덮밥"],
place: "미래광장",
}),
new FoodTruck({
id: "40c1e5aee21",
order: 2,
name: "닭강정",
menu: ["닭강정"],
place: "미래광장",
}),
new FoodTruck({
id: "7e66b6f57e1",
order: 3,
name: "진츄",
menu: ["소프트아이스크림"],
place: "미래광장",
}),
new FoodTruck({
id: "b792fd7a321",
order: 4,
name: "그양반네",
menu: ["타코야끼"],
place: "미래광장",
}),
new FoodTruck({
id: "random1",
order: 5,
name: "랜덤",
menu: ["랜덤"],
place: "미래광장",
}),
new FoodTruck({
id: "random2",
order: 6,
name: "랜덤",
menu: ["랜덤"],
place: "미래광장",
}),
new FoodTruck({
id: "random3",
order: 7,
name: "랜덤",
menu: ["랜덤"],
place: "미래광장",
}),
];
101 changes: 101 additions & 0 deletions src/shared/types/asset_types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
const invalidImg = new URL("../../assets/data/invalid.png", import.meta.url).href;

export type BoothPlaceType = "대운중앙노랑" | "대운상단초록" | "대운하단분홍" | "함인섭";
export type FoodtruckPlaceType = "60주년기념관" | "미래광장" | "함인섭광장";

export class Asset {
id: string;
order: number;
name: string;
date: number[] = [23, 24, 25];
visible: boolean = true;

constructor({
id,
order,
name,
visible,
date = [23, 24, 25],
}: {
id: string;
order: number;
name: string;
visible?: boolean;
date?: number[];
}) {
this.id = id;
this.order = order;
this.name = name;
this.visible = visible ?? true;
this.date = date;
}
}

export class FoodTruck extends Asset {
menu: string[];
place: FoodtruckPlaceType;
constructor({
id,
order,
name,
menu,
place,
visible,
date = [23, 24, 25],
}: {
id: string;
order: number;
name: string;
menu: string[];
place: FoodtruckPlaceType;
visible?: boolean;
date?: number[];
}) {
super({ id, order, name, visible, date });
this.menu = menu;
this.place = place;
}
}

export interface SaleItems {
item: string;
price: { min: number | null; max: number | null } | null;
}

export class Booth extends Asset {
description: string;
saleItems: SaleItems[];
place: BoothPlaceType;
image: string;
constructor({
id,
order,
name,
description,
saleItems,
place,
imageName,
visible,
date = [23, 24, 25],
}: {
id: string;
order: number;
name: string;
description: string;
saleItems: SaleItems[];
place: BoothPlaceType;
imageName?: string;
visible?: boolean;
date?: number[];
}) {
super({ id, order, name, visible, date });
this.description = description;
this.saleItems = saleItems;
this.place = place;
this.image = new URL(
`../../assets/data/booth_image/${place === "함인섭" ? "haminseop" : "playground/" + (place === "대운중앙노랑" ? "middle_yellow_line" : place === "대운상단초록" ? "top_green_line" : "bottom_pink_line")}/${imageName ?? this.id}.jpg`,
import.meta.url,
).href;
if (this.image.endsWith("undefined")) this.image = invalidImg;
}
}
20 changes: 20 additions & 0 deletions src/shared/util/functions.ts
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 메서드의 목적을 구체적으로 명시해 주시면 더 좋을 거 같습니다!

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Asset } from "../types/asset_types";

export const availableAsset = <T extends Asset>(assets: T[]) => {
if (assets.length === 0) throw new Error("No assets");
if (assets.find((v) => v.date === undefined)) return assets[0];

const START_DATE = 23;
const END_DATE = 25;
const now = new Date();
const options = { timeZone: "Asia/Seoul" };
const seoulDate = new Date(now.toLocaleString("en-US", options));
const curDay = seoulDate.getDate();

if (curDay < START_DATE) {
return assets.sort((a, b) => a.date![0] - b.date![0])[0];
} else if (curDay > END_DATE) {
return assets.sort((a, b) => b.date![0] - a.date![0])[0];
}
return assets.find((v) => v.date!.includes(curDay)) ?? assets[0];
};