@natoora-libs/drawer-menu 0.0.1

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/dist/index.cjs ADDED
@@ -0,0 +1,951 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/index.ts
30
+ var src_exports = {};
31
+ __export(src_exports, {
32
+ LeftDrawer: () => LeftDrawer_default
33
+ });
34
+ module.exports = __toCommonJS(src_exports);
35
+
36
+ // src/components/LeftDrawer/LeftDrawer.tsx
37
+ var import_react2 = require("react");
38
+ var import_react_router = require("react-router");
39
+ var import_icons_material = require("@mui/icons-material");
40
+ var import_material = require("@mui/material");
41
+ var import_Icon = __toESM(require("@mui/material/Icon"), 1);
42
+ var import_components2 = require("@natoora-libs/core/components");
43
+ var import_mui = require("tss-react/mui");
44
+
45
+ // src/resources/styles/colors/darkPalette.ts
46
+ var darkPalette = {
47
+ // General colors
48
+ white: "#FFFFFF",
49
+ black: "#000000",
50
+ // Neutral
51
+ neutral50: "#1C1B1A",
52
+ neutral100: "#1F1F1F",
53
+ neutral150: "#262626",
54
+ neutral200: "#2E2E2E",
55
+ neutral250: "#383838",
56
+ neutral300: "#424242",
57
+ neutral400: "#4C4C4C",
58
+ neutral500: "#666666",
59
+ neutral600: "#808080",
60
+ neutral700: "#A3A3A3",
61
+ neutral750: "#B3B3B3",
62
+ neutral800: "#CCCCCC",
63
+ neutral900: "#F5F5F5",
64
+ // Input and contrast
65
+ contrast: "#FFFFFF",
66
+ constrastOpacity50: "rgba(255,255,255,0.5)",
67
+ // Icon and Material UI colors
68
+ iconSearch: "#B0B0B0",
69
+ default: "#444444",
70
+ muiPrimary: "#E9FB62",
71
+ muiPrimaryBlack: "#FFFFFF",
72
+ lightMuiPrimaryColorBackground: "#e9fb6214",
73
+ lightBlueBackground: "#e9fb6214",
74
+ muiPrimaryAlternate: "#07BAF1",
75
+ muiPrimaryHover: "#1890d5",
76
+ muiSecondary: "#DE5B99",
77
+ muiSecondaryAlternate: "#EC613C",
78
+ muiSuccess: "#66BB6A",
79
+ muiSuccessAlternate: "#81C784",
80
+ // Transparency variants
81
+ blackOpacity10: "inherit",
82
+ blackOpacity20: "inherit",
83
+ blackOpacity30: "inherit",
84
+ blackOpacity50: "inherit",
85
+ blackOpacity80: "inherit",
86
+ primaryOpacity10: "rgba(233, 251, 98, 0.10)",
87
+ primaryOpacity20: "rgba(233, 251, 98, 0.20)",
88
+ primaryOpacity30: "rgba(233, 251, 98, 0.30)",
89
+ secondaryAlternateOpacity30: "rgba(236, 97, 60, .3)",
90
+ blueOpacity08: "rgba(25, 118, 210, 0.08)",
91
+ whiteOpacity10: "rgba(255,255,255,0.1)",
92
+ whiteOpacity20: "rgba(255,255,255,0.2)",
93
+ whiteOpacity40: "rgba(255,255,255,0.4)",
94
+ // Table rows and top bar
95
+ topBar: "#2e3133",
96
+ // Button colors
97
+ // Round Button (default)
98
+ buttonHoverBackground: "rgba(255, 255, 255, 0.08)",
99
+ // Active Button
100
+ buttonActiveText: "#E9FB62",
101
+ // Contrast Button
102
+ buttonContrastBorder: "#CECECE",
103
+ buttonContrastText: "#CECECE",
104
+ // Error Button
105
+ error: "#EF5350"
106
+ };
107
+ var darkPalette_default = darkPalette;
108
+
109
+ // src/resources/styles/colors/lightPalette.ts
110
+ var lightPalette = {
111
+ // General colors
112
+ white: "#FFFFFF",
113
+ black: "#000000",
114
+ // Neutral
115
+ neutral50: "#F0EBE6",
116
+ neutral100: "#FAFAFA",
117
+ neutral150: "#F4F4F4",
118
+ neutral200: "#F1F1F1",
119
+ neutral250: "#ECECEC",
120
+ neutral300: "#E0E0E0",
121
+ neutral400: "#C8C8C8",
122
+ neutral500: "#BDBDBD",
123
+ neutral600: "#999999",
124
+ neutral700: "#878787",
125
+ neutral750: "#6c6c6c",
126
+ neutral800: "#555555",
127
+ neutral900: "#4D4D4D",
128
+ // Input and contrast
129
+ contrast: "#000000",
130
+ constrastOpacity50: "rgba(0,0,0,0.5)",
131
+ // Icon and Material UI colors
132
+ iconSearch: "#606060",
133
+ default: "#E0E0E0",
134
+ muiPrimary: "#0781CE",
135
+ muiPrimaryBlack: "#000000",
136
+ lightMuiPrimaryColorBackground: "#eff4fb",
137
+ lightBlueBackground: "#eff4fb",
138
+ muiPrimaryAlternate: "#07BAF1",
139
+ muiPrimaryHover: "#1565c0",
140
+ muiSecondary: "#A42966",
141
+ muiSecondaryAlternate: "#EC613C",
142
+ muiSuccess: "#4caf50",
143
+ muiSuccessAlternate: "#357a38",
144
+ // Transparency variants
145
+ blackOpacity10: "rgba(0,0,0,0.1)",
146
+ blackOpacity20: "rgba(0,0,0,0.2)",
147
+ blackOpacity30: "rgba(0,0,0,0.3)",
148
+ blackOpacity50: "rgba(0,0,0,0.5)",
149
+ blackOpacity80: "rgba(0,0,0,0.8)",
150
+ primaryOpacity10: "rgba(7, 129, 206, 0.10)",
151
+ primaryOpacity20: "rgba(7, 129, 206, 0.20)",
152
+ primaryOpacity30: "rgba(7, 129, 206, 0.30)",
153
+ secondaryAlternateOpacity30: "rgba(236, 97, 60, 0.3)",
154
+ blueOpacity08: "rgba(25, 118, 210, 0.08)",
155
+ whiteOpacity10: "rgba(255,255,255,0.1)",
156
+ whiteOpacity20: "rgba(255,255,255,0.2)",
157
+ whiteOpacity40: "rgba(255,255,255,0.4)",
158
+ // Table rows and top bar
159
+ topBar: "#2e3133",
160
+ // Button colors
161
+ // Round Button (default)
162
+ buttonHoverBackground: "rgba(0, 0, 0, 0.04)",
163
+ // Active Button
164
+ buttonActiveText: "#0781CE",
165
+ // Contrast Button
166
+ buttonContrastBorder: "#CECECE",
167
+ buttonContrastText: "#CECECE",
168
+ // Error Button
169
+ error: "#D32F2F"
170
+ };
171
+ var lightPalette_default = lightPalette;
172
+
173
+ // src/resources/styles/colors.ts
174
+ var stylesheet = localStorage.getItem("@stylesheet");
175
+ var isDarkModeEnabled = stylesheet === "styles/style-dark.css";
176
+ var palette = isDarkModeEnabled ? darkPalette_default : lightPalette_default;
177
+ var colors = {
178
+ white: palette.white,
179
+ black: palette.black,
180
+ neutral50: palette.neutral50,
181
+ neutral100: palette.neutral100,
182
+ neutral150: palette.neutral150,
183
+ neutral200: palette.neutral200,
184
+ neutral250: palette.neutral250,
185
+ neutral300: palette.neutral300,
186
+ neutral400: palette.neutral400,
187
+ neutral500: palette.neutral500,
188
+ neutral600: palette.neutral600,
189
+ neutral700: palette.neutral700,
190
+ neutral750: palette.neutral750,
191
+ neutral800: palette.neutral800,
192
+ neutral900: palette.neutral900,
193
+ // Input and contrast
194
+ contrast: palette.contrast,
195
+ constrastOpacity50: palette.constrastOpacity50,
196
+ iconSearch: palette.iconSearch,
197
+ default: palette.default,
198
+ muiPrimary: palette.muiPrimary,
199
+ muiPrimaryBlack: palette.muiPrimaryBlack,
200
+ lightMuiPrimaryColorBackground: palette.lightMuiPrimaryColorBackground,
201
+ lightBlueBackground: palette.lightBlueBackground,
202
+ muiPrimaryAlternate: palette.muiPrimaryAlternate,
203
+ muiPrimaryHover: palette.muiPrimaryHover,
204
+ muiSecondary: palette.muiSecondary,
205
+ muiSecondaryAlternate: palette.muiSecondaryAlternate,
206
+ muiSuccess: palette.muiSuccess,
207
+ muiSuccessAlternate: palette.muiSuccessAlternate,
208
+ // Transparency
209
+ blackOpacity10: palette.blackOpacity10,
210
+ blackOpacity20: palette.blackOpacity20,
211
+ blackOpacity30: palette.blackOpacity30,
212
+ blackOpacity50: palette.blackOpacity50,
213
+ blackOpacity80: palette.blackOpacity80,
214
+ primaryOpacity10: palette.primaryOpacity10,
215
+ primaryOpacity20: palette.primaryOpacity20,
216
+ primaryOpacity30: palette.primaryOpacity30,
217
+ secondaryAlternateOpacity30: palette.secondaryAlternateOpacity30,
218
+ blueOpacity08: palette.blueOpacity08,
219
+ whiteOpacity10: palette.whiteOpacity10,
220
+ whiteOpacity20: palette.whiteOpacity20,
221
+ whiteOpacity40: palette.whiteOpacity40,
222
+ topBar: palette.topBar,
223
+ error: palette.error,
224
+ roundButton: {
225
+ default: {
226
+ border: palette.neutral600,
227
+ color: palette.contrast,
228
+ disabled: {
229
+ color: palette.blackOpacity20
230
+ },
231
+ hover: {
232
+ background: palette.buttonHoverBackground
233
+ }
234
+ },
235
+ filled: {
236
+ background: palette.neutral100,
237
+ color: palette.blackOpacity80,
238
+ hover: {
239
+ background: palette.neutral250
240
+ }
241
+ },
242
+ active: {
243
+ color: palette.buttonActiveText,
244
+ hover: {
245
+ background: palette.primaryOpacity20
246
+ }
247
+ },
248
+ contrast: {
249
+ border: palette.buttonContrastBorder,
250
+ color: palette.buttonContrastText,
251
+ hover: {
252
+ background: palette.whiteOpacity10
253
+ }
254
+ },
255
+ tableButton: {
256
+ color: palette.neutral800
257
+ },
258
+ focused: {
259
+ background: palette.primaryOpacity20,
260
+ color: palette.buttonActiveText,
261
+ hover: {
262
+ background: palette.primaryOpacity30
263
+ }
264
+ },
265
+ error: palette.error
266
+ },
267
+ movementCard: {
268
+ default: {
269
+ background: palette.neutral100
270
+ },
271
+ disabled: {
272
+ background: palette.neutral250
273
+ },
274
+ pill: {
275
+ color: palette.neutral200,
276
+ background: palette.neutral600
277
+ }
278
+ },
279
+ rowProductCard: {
280
+ locationSubtitle: palette.neutral800
281
+ }
282
+ };
283
+
284
+ // src/config/drawerAppList.tsx
285
+ var import_react = require("react");
286
+ var import_components = require("@natoora-libs/core/components");
287
+
288
+ // src/config/features.ts
289
+ var featureNames = {
290
+ ACCOUNTS: "accounts",
291
+ ADMIN: "admin",
292
+ AIRCALL: "aircall",
293
+ BULK_UPDATE: "product_bulk_update",
294
+ CONTENT_MANAGEMENT: "content_management",
295
+ CUSTOMERS: "customers",
296
+ GOODS_IN: "goods_in",
297
+ KANBAN: "kanban_cards",
298
+ LOCATIONS: "locations",
299
+ NOTIFICATIONS: "notifications",
300
+ OPS_METRICS: "ops_metrics",
301
+ ORDERS: "orders",
302
+ PICKING_STATIONS: "picking_stations",
303
+ PRICE_LIST: "price_list",
304
+ PRODUCTS: "products",
305
+ PROMO_CODES: "promo_codes",
306
+ PURCHASE_ORDERS: "purchase_orders",
307
+ QUALITY_CONTROL: "quality_control",
308
+ REPORTS: "reports",
309
+ RETAIL: "retail",
310
+ RETURNS: "returns",
311
+ SEARCH_CATEGORIES: "search_categories",
312
+ SERVICE_DELIVERY: "service_delivery",
313
+ SPECIAL_PRICES: "special_prices",
314
+ STOCK: "stock",
315
+ STOCK_MOVEMENTS: "stock_movements",
316
+ SUPPLIERS: "suppliers",
317
+ SUPPLIER_PRICES: "supplier_prices",
318
+ USER_MANAGEMENT: "users"
319
+ };
320
+ function featuresAreEnabled({
321
+ enabledFeatures,
322
+ featureNames: featureNames2,
323
+ requireAll = true
324
+ }) {
325
+ const storedPermissions = localStorage.getItem("permissions") || "";
326
+ let enabled = false;
327
+ if (requireAll) {
328
+ enabled = featureNames2.every(
329
+ (feature) => enabledFeatures.includes(feature) && storedPermissions.includes(`${feature}_read`)
330
+ );
331
+ } else {
332
+ enabled = featureNames2.some(
333
+ (feature) => enabledFeatures.includes(feature) && storedPermissions.includes(`${feature}_read`)
334
+ );
335
+ }
336
+ return enabled;
337
+ }
338
+
339
+ // src/config/drawerAppList.tsx
340
+ var import_jsx_runtime = require("react/jsx-runtime");
341
+ var drawerAppList = [
342
+ {
343
+ groupName: "Home",
344
+ apps: [
345
+ {
346
+ name: "Home",
347
+ routeName: "home",
348
+ alwaysDisplay: true,
349
+ featureNames: [],
350
+ pinned: null,
351
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconHome, {}),
352
+ url: "/#/",
353
+ shouldReload: true
354
+ }
355
+ ]
356
+ },
357
+ {
358
+ groupName: "App",
359
+ apps: [
360
+ {
361
+ name: "Notifications",
362
+ routeName: "appNotifications",
363
+ alwaysDisplay: false,
364
+ featureNames: [featureNames.NOTIFICATIONS],
365
+ pinned: "notifications",
366
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconNotification, {}),
367
+ url: "/#/notifications",
368
+ shouldReload: true
369
+ },
370
+ {
371
+ name: "Promo Codes",
372
+ routeName: "promo_codes",
373
+ alwaysDisplay: false,
374
+ featureNames: [featureNames.PROMO_CODES],
375
+ pinned: "promo_codes",
376
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconPromoCode, {}),
377
+ url: "/promo_codes"
378
+ },
379
+ {
380
+ name: "Search Categories",
381
+ routeName: "search-categories",
382
+ alwaysDisplay: false,
383
+ featureNames: [featureNames.SEARCH_CATEGORIES],
384
+ pinned: "search_categories",
385
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconSearchCategories, {}),
386
+ url: "/search-categories"
387
+ },
388
+ {
389
+ name: "Content Management",
390
+ routeName: "content-management",
391
+ alwaysDisplay: false,
392
+ featureNames: [featureNames.CONTENT_MANAGEMENT],
393
+ pinned: "content_management",
394
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconContentManagement, {}),
395
+ url: "/content-management"
396
+ }
397
+ ]
398
+ },
399
+ {
400
+ groupName: "Customer Service",
401
+ apps: [
402
+ {
403
+ name: "Aircall",
404
+ routeName: "recordedcalls",
405
+ alwaysDisplay: false,
406
+ featureNames: [featureNames.AIRCALL],
407
+ pinned: "aircall",
408
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconPhone, {}),
409
+ url: "/air-call"
410
+ },
411
+ {
412
+ name: "Customers",
413
+ routeName: "customers",
414
+ alwaysDisplay: false,
415
+ featureNames: [featureNames.CUSTOMERS],
416
+ pinned: "customers",
417
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconAccount, {}),
418
+ url: "/customers",
419
+ children: [
420
+ {
421
+ name: "Sites",
422
+ routeName: "customer-sites",
423
+ pinned: "customer-sites",
424
+ url: "/customers/sites"
425
+ },
426
+ {
427
+ name: "Groups",
428
+ routeName: "customer-groups",
429
+ pinned: "customer-groups",
430
+ url: "/customers/groups"
431
+ }
432
+ ]
433
+ },
434
+ {
435
+ name: "Orders",
436
+ routeName: "orders",
437
+ alwaysDisplay: false,
438
+ featureNames: [featureNames.ORDERS],
439
+ pinned: "orders",
440
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconOrders, {}),
441
+ url: "/#/orders",
442
+ shouldReload: true
443
+ },
444
+ {
445
+ name: "Price Lists",
446
+ routeName: "price_list",
447
+ alwaysDisplay: false,
448
+ featureNames: [featureNames.PRICE_LIST],
449
+ pinned: "price_list",
450
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconPriceList, {}),
451
+ url: "/#/price-list",
452
+ shouldReload: true
453
+ },
454
+ {
455
+ name: "Special Prices",
456
+ routeName: "special_prices",
457
+ alwaysDisplay: false,
458
+ featureNames: [featureNames.SPECIAL_PRICES],
459
+ pinned: "special_prices",
460
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconSpecialPrice, {}),
461
+ url: "/#/pricing/special-prices",
462
+ shouldReload: true
463
+ }
464
+ ]
465
+ },
466
+ {
467
+ groupName: "Buying",
468
+ apps: [
469
+ {
470
+ name: "Purchase Orders",
471
+ routeName: "purchaseOrders",
472
+ alwaysDisplay: false,
473
+ featureNames: [featureNames.PURCHASE_ORDERS],
474
+ pinned: "purchase_orders",
475
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconBuying, {}),
476
+ url: "/react/purchase-orders",
477
+ shouldReload: true
478
+ },
479
+ {
480
+ name: "Products",
481
+ routeName: "products",
482
+ alwaysDisplay: false,
483
+ featureNames: [featureNames.PRODUCTS],
484
+ pinned: "products",
485
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconProducts, {}),
486
+ url: "/#/product-base-list",
487
+ shouldReload: true
488
+ },
489
+ {
490
+ name: "Suppliers",
491
+ routeName: "suppliers",
492
+ alwaysDisplay: false,
493
+ featureNames: [featureNames.SUPPLIERS],
494
+ pinned: "suppliers",
495
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconSupplier, {}),
496
+ url: "/suppliers"
497
+ },
498
+ {
499
+ name: "Supplier Prices",
500
+ routeName: "supplier_prices",
501
+ alwaysDisplay: false,
502
+ featureNames: [featureNames.SUPPLIER_PRICES],
503
+ pinned: "supplier_prices",
504
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconSupplierPrices, {}),
505
+ url: "/#/supplier-prices",
506
+ shouldReload: true
507
+ },
508
+ {
509
+ name: "Product Bulk Update",
510
+ routeName: "bulk-update",
511
+ alwaysDisplay: false,
512
+ featureNames: [featureNames.BULK_UPDATE],
513
+ pinned: "product_bulk_update",
514
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconImport, {}),
515
+ url: "/bulk_update"
516
+ }
517
+ ]
518
+ },
519
+ {
520
+ groupName: "Operations",
521
+ apps: [
522
+ {
523
+ name: "Retail",
524
+ routeName: "retail",
525
+ alwaysDisplay: false,
526
+ featureNames: [featureNames.RETAIL],
527
+ pinned: "retail",
528
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconRetail, {}),
529
+ url: "/#/retail/product-availability",
530
+ shouldReload: true
531
+ },
532
+ {
533
+ name: "Goods In",
534
+ routeName: "goodsin-list",
535
+ alwaysDisplay: false,
536
+ featureNames: [featureNames.GOODS_IN],
537
+ pinned: "goods_in",
538
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconGoodsin, {}),
539
+ url: "/goodsin-list"
540
+ },
541
+ {
542
+ name: "Returns",
543
+ routeName: "goods-in-list",
544
+ alwaysDisplay: false,
545
+ featureNames: [featureNames.RETURNS],
546
+ pinned: "returns",
547
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconGoodsin, {}),
548
+ url: "/returns"
549
+ },
550
+ {
551
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconLocation, {}),
552
+ name: "Stock and Locations",
553
+ pinned: "stock",
554
+ routeName: "locations",
555
+ featureNames: [featureNames.STOCK, featureNames.LOCATIONS],
556
+ alwaysDisplay: false,
557
+ url: "/locations",
558
+ children: [
559
+ {
560
+ name: "Movements",
561
+ routeName: "movements",
562
+ url: "/movements",
563
+ featureName: featureNames.STOCK_MOVEMENTS
564
+ }
565
+ ]
566
+ },
567
+ {
568
+ name: "Kanban Cards",
569
+ routeName: "kanban",
570
+ alwaysDisplay: false,
571
+ featureNames: [featureNames.KANBAN],
572
+ pinned: "kanban_cards",
573
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconVkc, {}),
574
+ url: "/#/kanban",
575
+ shouldReload: true
576
+ },
577
+ {
578
+ name: "Picking Stations",
579
+ routeName: "picking",
580
+ alwaysDisplay: false,
581
+ featureNames: [featureNames.PICKING_STATIONS],
582
+ pinned: "picking_stations",
583
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconScales, {}),
584
+ url: "/#/pickingstation",
585
+ shouldReload: true
586
+ },
587
+ {
588
+ name: "Quality Control",
589
+ routeName: "qualityControl",
590
+ alwaysDisplay: false,
591
+ featureNames: [featureNames.QUALITY_CONTROL],
592
+ pinned: "quality_control",
593
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconQc, {}),
594
+ url: "/#/quality-control",
595
+ shouldReload: true
596
+ },
597
+ {
598
+ name: "Service Delivery",
599
+ routeName: "runs",
600
+ alwaysDisplay: false,
601
+ featureNames: [featureNames.SERVICE_DELIVERY],
602
+ pinned: "service_delivery",
603
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconRuns, {}),
604
+ url: "/#/runs",
605
+ shouldReload: true
606
+ },
607
+ {
608
+ name: "Ops Metrics",
609
+ routeName: "ops-metrics",
610
+ alwaysDisplay: false,
611
+ featureNames: [featureNames.OPS_METRICS],
612
+ pinned: "ops_metrics",
613
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconOpsMetrics, {}),
614
+ url: "/ops-metrics"
615
+ }
616
+ ]
617
+ },
618
+ {
619
+ groupName: "Tools",
620
+ apps: [
621
+ {
622
+ name: "Accounts",
623
+ routeName: "accounts",
624
+ alwaysDisplay: false,
625
+ featureNames: [featureNames.ACCOUNTS],
626
+ pinned: "accounts",
627
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconAccounts, {}),
628
+ url: "/#/accounts",
629
+ shouldReload: true
630
+ },
631
+ {
632
+ name: "Reports",
633
+ routeName: "reports",
634
+ alwaysDisplay: false,
635
+ featureNames: [featureNames.REPORTS],
636
+ pinned: "reports",
637
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconReports, {}),
638
+ url: "/#/reports",
639
+ shouldReload: true
640
+ }
641
+ ]
642
+ },
643
+ {
644
+ groupName: "Settings",
645
+ apps: [
646
+ {
647
+ name: "Admin",
648
+ routeName: "admin",
649
+ alwaysDisplay: false,
650
+ featureNames: [featureNames.ADMIN],
651
+ pinned: "admin",
652
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconSetting, {}),
653
+ url: "/#/admin",
654
+ shouldReload: true
655
+ },
656
+ {
657
+ name: "User Management",
658
+ routeName: "user-management",
659
+ alwaysDisplay: false,
660
+ featureNames: [featureNames.USER_MANAGEMENT],
661
+ pinned: "users",
662
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconUserManagement, {}),
663
+ url: "/user-management"
664
+ },
665
+ {
666
+ name: "Logout",
667
+ routeName: "logout",
668
+ alwaysDisplay: true,
669
+ featureNames: [],
670
+ pinned: null,
671
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconLogin, {}),
672
+ url: "/logout"
673
+ }
674
+ ]
675
+ },
676
+ {
677
+ groupName: "Release Notes",
678
+ apps: [
679
+ {
680
+ name: "Release Notes",
681
+ routeName: "release-notes",
682
+ alwaysDisplay: true,
683
+ featureNames: [],
684
+ pinned: null,
685
+ // icon: <icons.SvgIconReleaseNote />,
686
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.icons.SvgIconLogin, {}),
687
+ url: "/release-notes"
688
+ }
689
+ ]
690
+ }
691
+ ];
692
+ var useGetDrawerAppList = (enabledFeatures) => {
693
+ return (0, import_react.useMemo)(() => {
694
+ if (!enabledFeatures?.length) {
695
+ return [];
696
+ }
697
+ return drawerAppList.map((group) => {
698
+ const enabledApps = group.apps.filter(
699
+ (app) => app.alwaysDisplay || featuresAreEnabled({
700
+ enabledFeatures,
701
+ featureNames: app.featureNames,
702
+ requireAll: false
703
+ })
704
+ ).map((app) => {
705
+ if (app.children) {
706
+ const filteredChildren = app.children.filter(
707
+ (child) => {
708
+ if (child.featureName) {
709
+ return enabledFeatures.includes(child.featureName);
710
+ }
711
+ return true;
712
+ }
713
+ );
714
+ return { ...app, children: filteredChildren };
715
+ }
716
+ return app;
717
+ });
718
+ return { ...group, apps: enabledApps };
719
+ }).filter((group) => group.apps.length > 0);
720
+ }, [enabledFeatures]);
721
+ };
722
+
723
+ // src/components/LeftDrawer/LeftDrawer.tsx
724
+ var import_jsx_runtime2 = require("react/jsx-runtime");
725
+ var useStyles = (0, import_mui.makeStyles)()((theme) => ({
726
+ subheader: {
727
+ textTransform: "uppercase",
728
+ fontSize: theme.spacing(1.5)
729
+ },
730
+ menuButton: {
731
+ marginRight: theme.spacing(2)
732
+ },
733
+ inputRoot: {
734
+ color: "inherit"
735
+ },
736
+ inputInput: {
737
+ transition: theme.transitions.create("width"),
738
+ width: "100%"
739
+ },
740
+ topBar: {
741
+ backgroundColor: theme.palette.secondary.dark,
742
+ width: theme.spacing(40),
743
+ padding: theme.spacing(2),
744
+ display: "flex",
745
+ alignItems: "end",
746
+ justifyContent: "space-between"
747
+ },
748
+ drawer: {
749
+ alignContent: "space-between",
750
+ flexDirection: "column",
751
+ minWidth: theme.spacing(80)
752
+ },
753
+ drawerBody: {
754
+ minWidth: "300px",
755
+ flexGrow: 1,
756
+ padding: theme.spacing(3)
757
+ },
758
+ drawerItem: {
759
+ width: "300px",
760
+ marginBottom: theme.spacing(1)
761
+ },
762
+ button: {
763
+ color: theme.palette.primary.contrastText
764
+ },
765
+ iconMenu: {
766
+ height: "40px",
767
+ width: "40px",
768
+ opacity: 1,
769
+ fill: colors.neutral700
770
+ },
771
+ pinIcon: {
772
+ height: "16px",
773
+ width: "16px",
774
+ fill: colors.neutral700,
775
+ opacity: 0.5,
776
+ "&:hover": {
777
+ opacity: 1,
778
+ cursor: "pointer"
779
+ }
780
+ },
781
+ expandIcon: {
782
+ height: "22px",
783
+ width: "22px",
784
+ fill: colors.neutral700
785
+ },
786
+ nested: {
787
+ paddingLeft: theme.spacing(6),
788
+ border: colors.neutral200
789
+ },
790
+ appName: {
791
+ "& .MuiTypography-body2": {
792
+ fontWeight: 700
793
+ }
794
+ }
795
+ }));
796
+ var LeftDrawer = ({
797
+ enabledFeatures,
798
+ pinnedApps,
799
+ open,
800
+ user,
801
+ handleClose,
802
+ handleOpen,
803
+ onLogout,
804
+ onTogglePinnedApp
805
+ }) => {
806
+ const navigate = (0, import_react_router.useNavigate)();
807
+ const [openCollapse, setOpenCollapse] = (0, import_react2.useState)({});
808
+ const drawerAppList2 = useGetDrawerAppList(enabledFeatures);
809
+ const { classes } = useStyles();
810
+ const navigateTo = (url, shouldReload) => {
811
+ if (shouldReload) {
812
+ const fullUrl = `${window.location.origin}${url}`;
813
+ window.location.href = fullUrl;
814
+ return;
815
+ }
816
+ return navigate(url);
817
+ };
818
+ console.log({ drawerAppList: drawerAppList2 });
819
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
820
+ import_material.SwipeableDrawer,
821
+ {
822
+ className: classes.drawer,
823
+ id: "primary-menu",
824
+ onClose: handleClose,
825
+ onOpen: handleOpen,
826
+ open,
827
+ children: [
828
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.AppBar, { position: "static", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material.Toolbar, { className: classes.topBar, children: [
829
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
830
+ import_components2.UserBust,
831
+ {
832
+ user,
833
+ avatarProps: { height: 50, width: 50 },
834
+ typographyProps: {
835
+ name: { variant: "subtitle1", component: "div" },
836
+ username: { variant: "caption", component: "div" }
837
+ }
838
+ }
839
+ ),
840
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
841
+ import_components2.RoundButton,
842
+ {
843
+ icon: "edit",
844
+ isContrast: true,
845
+ onClick: () => navigateTo(`/#/user-settings`, true),
846
+ size: "small",
847
+ tooltip: "User Settings"
848
+ }
849
+ )
850
+ ] }) }),
851
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.List, { children: drawerAppList2.map((group) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react2.Fragment, { children: [
852
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.ListSubheader, { disableSticky: true, className: classes.subheader, children: group.groupName }),
853
+ group.apps.map((app) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react2.Fragment, { children: [
854
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
855
+ import_material.ListItem,
856
+ {
857
+ title: app.url,
858
+ onClick: () => {
859
+ if (app.routeName === "logout") {
860
+ return onLogout();
861
+ }
862
+ return navigateTo(app.url, app.shouldReload);
863
+ },
864
+ children: [
865
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Icon.default, { className: classes.iconMenu, children: app.icon }) }),
866
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
867
+ import_material.ListItemText,
868
+ {
869
+ className: classes.appName,
870
+ primary: app.name,
871
+ slotProps: { primary: { variant: "body2" } }
872
+ }
873
+ ),
874
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
875
+ import_material.Box,
876
+ {
877
+ display: "flex",
878
+ gap: 2,
879
+ alignItems: "center",
880
+ justifyContent: "center",
881
+ children: [
882
+ app.children?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
883
+ import_icons_material.ExpandLess,
884
+ {
885
+ className: classes.expandIcon,
886
+ style: {
887
+ rotate: openCollapse[app.routeName] ? "0deg" : "180deg"
888
+ },
889
+ "data-testid": "svg-close-collapse",
890
+ onClick: (event) => {
891
+ event.stopPropagation();
892
+ setOpenCollapse({
893
+ ...openCollapse,
894
+ [app.routeName]: !openCollapse[app.routeName]
895
+ });
896
+ }
897
+ }
898
+ ),
899
+ app.pinned && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
900
+ import_icons_material.PushPinOutlined,
901
+ {
902
+ className: classes.pinIcon,
903
+ style: { opacity: pinnedApps[app.pinned] ? 1 : 0.3 },
904
+ onClick: (event) => {
905
+ event.stopPropagation();
906
+ onTogglePinnedApp(
907
+ app.pinned,
908
+ !pinnedApps[app.pinned]
909
+ );
910
+ }
911
+ }
912
+ )
913
+ ]
914
+ }
915
+ )
916
+ ]
917
+ },
918
+ app.name
919
+ ),
920
+ app.children?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.Collapse, { in: openCollapse[app.routeName], children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.List, { children: app.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
921
+ import_material.ListItemButton,
922
+ {
923
+ className: classes.nested,
924
+ disabled: child.disabled,
925
+ onClick: () => navigateTo(child.url, child.shouldReload),
926
+ title: child.url,
927
+ children: [
928
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.FiberManualRecord, { style: { height: 12 } }) }),
929
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
930
+ import_material.ListItemText,
931
+ {
932
+ primary: child.name,
933
+ slotProps: { primary: { variant: "body2" } }
934
+ }
935
+ )
936
+ ]
937
+ },
938
+ child.name
939
+ )) }) })
940
+ ] }, `${group.groupName}_${app.name}`))
941
+ ] }, group.groupName)) })
942
+ ]
943
+ }
944
+ );
945
+ };
946
+ var LeftDrawer_default = LeftDrawer;
947
+ // Annotate the CommonJS export names for ESM import in node:
948
+ 0 && (module.exports = {
949
+ LeftDrawer
950
+ });
951
+ //# sourceMappingURL=index.cjs.map