@nguyentrungkien/shared 1.1.1 → 1.1.3

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.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./enums";
2
2
  export * from "./types";
3
+ export { getStatusConfig, StatusConfigRes } from "./types/user.types";
package/dist/index.js CHANGED
@@ -14,5 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.getStatusConfig = void 0;
17
18
  __exportStar(require("./enums"), exports);
18
19
  __exportStar(require("./types"), exports);
20
+ var user_types_1 = require("./types/user.types");
21
+ Object.defineProperty(exports, "getStatusConfig", { enumerable: true, get: function () { return user_types_1.getStatusConfig; } });
@@ -1,4 +1,4 @@
1
- import { UserRole } from "../enums";
1
+ import { OrderStatus, UserRole } from "../enums";
2
2
  export interface User {
3
3
  id: number;
4
4
  username: string;
@@ -7,3 +7,10 @@ export interface User {
7
7
  createdAt: Date;
8
8
  updateAt: Date;
9
9
  }
10
+ export interface StatusConfigRes {
11
+ text: string;
12
+ bgColor: string;
13
+ textColor: string;
14
+ borderColor: string;
15
+ }
16
+ export declare const getStatusConfig: (status: OrderStatus) => StatusConfigRes;
@@ -1,2 +1,58 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStatusConfig = void 0;
4
+ const enums_1 = require("../enums");
5
+ const getStatusConfig = (status) => {
6
+ switch (status) {
7
+ case enums_1.OrderStatus.PENDING:
8
+ return {
9
+ text: "Chờ xác nhận",
10
+ bgColor: "#fef3c7",
11
+ textColor: "#92400e",
12
+ borderColor: "#fbbf24",
13
+ };
14
+ case enums_1.OrderStatus.CONFIRMED:
15
+ return {
16
+ text: "Đã xác nhận",
17
+ bgColor: "#dbeafe",
18
+ textColor: "#1e40af",
19
+ borderColor: "#3b82f6",
20
+ };
21
+ case enums_1.OrderStatus.SHIPPING:
22
+ return {
23
+ text: "Đang giao",
24
+ bgColor: "#c3dafe",
25
+ textColor: "#4c51bf",
26
+ borderColor: "#818cf8",
27
+ };
28
+ case enums_1.OrderStatus.DELIVERED:
29
+ return {
30
+ text: "Đã giao",
31
+ bgColor: "#d1fae5",
32
+ textColor: "#065f46",
33
+ borderColor: "#34d399",
34
+ };
35
+ case enums_1.OrderStatus.COMPLETED:
36
+ return {
37
+ text: "Hoàn thành",
38
+ bgColor: "#d1fae5",
39
+ textColor: "#065f46",
40
+ borderColor: "#10b981",
41
+ };
42
+ case enums_1.OrderStatus.CANCELLED:
43
+ return {
44
+ text: "Đã hủy",
45
+ bgColor: "#fee2e2",
46
+ textColor: "#991b1b",
47
+ borderColor: "#ef4444",
48
+ };
49
+ default:
50
+ return {
51
+ text: "Không xác định",
52
+ bgColor: "#f3f4f6",
53
+ textColor: "#6b7280",
54
+ borderColor: "#d1d5db",
55
+ };
56
+ }
57
+ };
58
+ exports.getStatusConfig = getStatusConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nguyentrungkien/shared",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "shared enum & types",
5
5
  "license": "ISC",
6
6
  "author": "nguyentrungkien04921@gmail.com",