@nguyentrungkien/shared 1.1.1 → 1.1.2

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 } 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,34 @@ export interface User {
7
7
  createdAt: Date;
8
8
  updateAt: Date;
9
9
  }
10
+ export declare const getStatusConfig: (status: OrderStatus) => {
11
+ text: string;
12
+ bgColor: string;
13
+ textColor: string;
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
+ };
@@ -1,2 +1,51 @@
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
+ 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
+ });
50
+ };
51
+ 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.2",
4
4
  "description": "shared enum & types",
5
5
  "license": "ISC",
6
6
  "author": "nguyentrungkien04921@gmail.com",