@nguyentrungkien/shared 1.1.2 → 1.1.4

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,3 +1,3 @@
1
1
  export * from "./enums";
2
2
  export * from "./types";
3
- export { getStatusConfig } from "./types/user.types";
3
+ export { getStatusConfig, StatusConfigRes } from "./types/user.types";
@@ -7,34 +7,10 @@ export interface User {
7
7
  createdAt: Date;
8
8
  updateAt: Date;
9
9
  }
10
- export declare const getStatusConfig: (status: OrderStatus) => {
10
+ export interface StatusConfigRes {
11
11
  text: string;
12
12
  bgColor: string;
13
13
  textColor: string;
14
14
  borderColor: string;
15
- } | {
16
- text: string;
17
- bgColor: string;
18
- textColor: string;
19
- borderColor: string;
20
- } | {
21
- text: string;
22
- bgColor: string;
23
- textColor: string;
24
- borderColor: string;
25
- } | {
26
- text: string;
27
- bgColor: string;
28
- textColor: string;
29
- borderColor: string;
30
- } | {
31
- text: string;
32
- bgColor: string;
33
- textColor: string;
34
- borderColor: string;
35
- } | {
36
- text: string;
37
- bgColor: string;
38
- textColor: string;
39
- borderColor: string;
40
- };
15
+ }
16
+ export declare const getStatusConfig: (status: OrderStatus) => StatusConfigRes;
@@ -3,49 +3,56 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStatusConfig = void 0;
4
4
  const enums_1 = require("../enums");
5
5
  const getStatusConfig = (status) => {
6
- const statusConfig = {
7
- [enums_1.OrderStatus.PENDING]: {
8
- text: "Chờ xác nhận",
9
- bgColor: "bg-amber-100",
10
- textColor: "text-amber-600",
11
- borderColor: "border-amber-200",
12
- },
13
- [enums_1.OrderStatus.CONFIRMED]: {
14
- text: "Đã xác nhận",
15
- bgColor: "bg-blue-100",
16
- textColor: "text-blue-600",
17
- borderColor: "border-blue-200",
18
- },
19
- [enums_1.OrderStatus.SHIPPING]: {
20
- text: "Đang giao",
21
- bgColor: "bg-indigo-100",
22
- textColor: "text-indigo-600",
23
- borderColor: "border-indigo-200",
24
- },
25
- [enums_1.OrderStatus.DELIVERED]: {
26
- text: "Đã giao",
27
- bgColor: "bg-emerald-100",
28
- textColor: "text-emerald-600",
29
- borderColor: "border-emerald-200",
30
- },
31
- [enums_1.OrderStatus.COMPLETED]: {
32
- text: "Hoàn thành",
33
- bgColor: "bg-green-100",
34
- textColor: "text-green-600",
35
- borderColor: "border-green-200",
36
- },
37
- [enums_1.OrderStatus.CANCELLED]: {
38
- text: "Đã hủy",
39
- bgColor: "bg-red-100",
40
- textColor: "text-red-600",
41
- borderColor: "border-red-200",
42
- },
43
- };
44
- return (statusConfig[status] || {
45
- text: status,
46
- bgColor: "bg-gray-50",
47
- textColor: "text-gray-600",
48
- borderColor: "border-gray-200",
49
- });
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
+ }
50
57
  };
51
58
  exports.getStatusConfig = getStatusConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nguyentrungkien/shared",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "shared enum & types",
5
5
  "license": "ISC",
6
6
  "author": "nguyentrungkien04921@gmail.com",