@mantajs/dashboard 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
+
import * as MedusaIcons from "@medusajs/icons"
|
|
1
2
|
import {
|
|
2
|
-
BuildingStorefront,
|
|
3
|
-
Buildings,
|
|
4
3
|
ChevronDownMini,
|
|
5
|
-
CogSixTooth,
|
|
6
|
-
CurrencyDollar,
|
|
7
4
|
EllipsisHorizontal,
|
|
8
5
|
MagnifyingGlass,
|
|
9
6
|
MinusMini,
|
|
10
7
|
OpenRectArrowOut,
|
|
11
|
-
ReceiptPercent,
|
|
12
|
-
ShoppingCart,
|
|
13
|
-
SquaresPlus,
|
|
14
|
-
Tag,
|
|
15
|
-
Users,
|
|
16
8
|
} from "@medusajs/icons"
|
|
17
9
|
import { Avatar, Divider, DropdownMenu, Text, clx } from "@medusajs/ui"
|
|
18
10
|
import { Collapsible as RadixCollapsible } from "radix-ui"
|
|
@@ -33,16 +25,9 @@ import { useDocumentDirection } from "../../../hooks/use-document-direction"
|
|
|
33
25
|
import menuConfig from "virtual:dashboard/menu-config"
|
|
34
26
|
import type { MenuConfig } from "../../../vite-plugin/types"
|
|
35
27
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Buildings: <Buildings />,
|
|
40
|
-
Users: <Users />,
|
|
41
|
-
ReceiptPercent: <ReceiptPercent />,
|
|
42
|
-
CurrencyDollar: <CurrencyDollar />,
|
|
43
|
-
BuildingStorefront: <BuildingStorefront />,
|
|
44
|
-
CogSixTooth: <CogSixTooth />,
|
|
45
|
-
SquaresPlus: <SquaresPlus />,
|
|
28
|
+
const getIcon = (name: string): React.ReactNode => {
|
|
29
|
+
const IconComponent = (MedusaIcons as any)[name] || MedusaIcons.SquaresPlus
|
|
30
|
+
return <IconComponent />
|
|
46
31
|
}
|
|
47
32
|
|
|
48
33
|
export const MainLayout = () => {
|
|
@@ -192,21 +177,21 @@ const Header = () => {
|
|
|
192
177
|
}
|
|
193
178
|
|
|
194
179
|
const getDefaultMedusaRoutes = (t: (key: string) => string): Omit<INavItem, "pathname">[] => [
|
|
195
|
-
{ icon:
|
|
196
|
-
{ icon:
|
|
180
|
+
{ icon: getIcon("ShoppingCart"), label: t("orders.domain"), to: "/orders", items: [] },
|
|
181
|
+
{ icon: getIcon("Tag"), label: t("products.domain"), to: "/products", items: [
|
|
197
182
|
{ label: t("collections.domain"), to: "/collections" },
|
|
198
183
|
{ label: t("categories.domain"), to: "/categories" },
|
|
199
184
|
]},
|
|
200
|
-
{ icon:
|
|
185
|
+
{ icon: getIcon("Buildings"), label: t("inventory.domain"), to: "/inventory", items: [
|
|
201
186
|
{ label: t("reservations.domain"), to: "/reservations" },
|
|
202
187
|
]},
|
|
203
|
-
{ icon:
|
|
188
|
+
{ icon: getIcon("Users"), label: t("customers.domain"), to: "/customers", items: [
|
|
204
189
|
{ label: t("customerGroups.domain"), to: "/customer-groups" },
|
|
205
190
|
]},
|
|
206
|
-
{ icon:
|
|
191
|
+
{ icon: getIcon("ReceiptPercent"), label: t("promotions.domain"), to: "/promotions", items: [
|
|
207
192
|
{ label: t("campaigns.domain"), to: "/campaigns" },
|
|
208
193
|
]},
|
|
209
|
-
{ icon:
|
|
194
|
+
{ icon: getIcon("CurrencyDollar"), label: t("priceLists.domain"), to: "/price-lists" },
|
|
210
195
|
]
|
|
211
196
|
|
|
212
197
|
const useCoreRoutes = (): Omit<INavItem, "pathname">[] => {
|
|
@@ -217,7 +202,7 @@ const useCoreRoutes = (): Omit<INavItem, "pathname">[] => {
|
|
|
217
202
|
}
|
|
218
203
|
|
|
219
204
|
return (menuConfig as MenuConfig).items.map((item) => ({
|
|
220
|
-
icon:
|
|
205
|
+
icon: getIcon(item.icon),
|
|
221
206
|
label: item.useTranslation ? t(item.label) : item.label,
|
|
222
207
|
to: item.to,
|
|
223
208
|
items: item.items?.map((sub) => ({
|