-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategories.ts
157 lines (152 loc) · 3.74 KB
/
categories.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import {
type Icon,
IconBarbell,
IconBed,
IconBuilding,
IconBuildingBank,
IconBuildingCarousel,
IconBuildingHospital,
IconBuildingPavilion,
IconChefHat,
IconCurrencyYuan,
IconGlassFull,
IconHomeSearch,
IconIceCream,
IconMedicalCross,
type IconProps,
IconShield,
IconShoppingBag,
IconToolsKitchen2,
IconTrees,
IconVaccineBottle,
IconWalk,
} from "@tabler/icons-react";
import { type ForwardRefExoticComponent, type RefAttributes } from "react";
import { type Category } from "./schema";
const categories: Category[] = [
{ id: "park", name: "Park", colors: { light: "#5CE54B", dark: "#22AB30" } },
{
id: "amusement-park",
name: "Amusement Park",
colors: { light: "#E29FEE", dark: "#9C51C9" },
parentId: "park",
},
{
id: "walkway",
name: "Walkway",
colors: { light: "#8192E4", dark: "#657DDE" },
parentId: "park",
},
{
id: "health",
name: "Health",
colors: { light: "#FF8098", dark: "#FB4467" }, // or #FF315F
},
{
id: "hospital",
name: "Hospital",
colors: { light: "#FF8098", dark: "#FB4467" }, // or #FF315F
parentId: "health",
},
{
id: "pharmacy",
name: "Pharmacy",
colors: { light: "#FF8098", dark: "#FB4467" }, // or #FF315F
parentId: "health",
},
{
id: "food",
name: "Food",
colors: { light: "#FFB47C", dark: "#E8662A" }, // From `restaurant` and `fast-food`
},
{
id: "restaurant",
name: "Restaurant",
colors: { light: "#FFB47C", dark: "#E8662A" },
parentId: "food",
},
{
id: "fast-food",
name: "Fast Food",
colors: { light: "#FFB47C", dark: "#E8662A" },
parentId: "food",
},
{
id: "beverage",
name: "Beverage",
colors: { light: "#E29FEE", dark: "#9C51C9" },
parentId: "food",
},
{
id: "fitness",
name: "Fitness",
colors: { light: "#8CD7F9", dark: "#2295E3" },
},
{
id: "shopping-mall",
name: "Shopping Mall",
colors: { light: "#E29FEE", dark: "#9C51C9" },
},
{ id: "hotel", name: "Hotel", colors: { light: "#EE99F3", dark: "#A846D0" } },
{
id: "scenery",
name: "Scenery",
colors: { light: "#FCA898", dark: "#C75745" },
},
{ id: "other", name: "Other", colors: { light: "#B6C4D0", dark: "#7F92A1" } },
{
id: "bank",
name: "Bank",
colors: { light: "#B3C4D1", dark: "#7B92A3" },
parentId: "other",
},
{
id: "atm",
name: "ATM",
colors: { light: "#B3C4D1", dark: "#7B92A3" },
parentId: "other",
},
{
id: "police",
name: "Police",
colors: { light: "#B3C4D1", dark: "#7B92A3" },
parentId: "other",
},
{
id: "apartment-rental",
name: "Apartment Rental",
colors: { light: "#B6C4D0", dark: "#7F92A1" },
markerIcon: "other",
parentId: "other",
},
];
export default categories;
export const categoryIcons: Record<
string,
ForwardRefExoticComponent<Omit<IconProps, "ref"> & RefAttributes<Icon>>
> = {
park: IconTrees,
"amusement-park": IconBuildingCarousel,
walkway: IconWalk,
health: IconMedicalCross,
hospital: IconBuildingHospital,
pharmacy: IconVaccineBottle,
food: IconToolsKitchen2,
restaurant: IconChefHat,
"fast-food": IconIceCream,
beverage: IconGlassFull,
fitness: IconBarbell,
"shopping-mall": IconShoppingBag,
hotel: IconBed,
scenery: IconBuildingPavilion,
other: IconBuilding,
bank: IconBuildingBank,
atm: IconCurrencyYuan,
police: IconShield,
"apartment-rental": IconHomeSearch,
};
export function getCategoryMarkerIcon(categoryId: string, quality: number = 2) {
const category = categories.find(({ id }) => id === categoryId);
if (!category) throw new Error(`Category "${categoryId}" does not exist`);
return `/assets/${quality === 1 ? "markers" : `markers-${quality}x`}/${category.markerIcon ?? category.id}.png`;
}