sea-react-components 1.3.24 → 1.3.26

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.
Files changed (104) hide show
  1. package/dist/components/cards-list/index.d.ts.map +1 -1
  2. package/dist/components/cards-list/index.js +4 -3
  3. package/dist/components/comments-container/comment-item/index.d.ts.map +1 -1
  4. package/dist/components/comments-container/comment-item/index.js +11 -4
  5. package/dist/components/comments-container/comments-list/index.js +1 -1
  6. package/dist/components/comments-container/index.js +1 -1
  7. package/dist/components/comments-container copy/comment-event-bus/index.d.ts +4 -0
  8. package/dist/components/comments-container copy/comment-event-bus/index.d.ts.map +1 -0
  9. package/dist/components/comments-container copy/comment-event-bus/index.js +4 -0
  10. package/dist/components/comments-container copy/comment-form/index.d.ts +39 -0
  11. package/dist/components/comments-container copy/comment-form/index.d.ts.map +1 -0
  12. package/dist/components/comments-container copy/comment-form/index.js +83 -0
  13. package/dist/components/comments-container copy/comment-item/index.d.ts +13 -0
  14. package/dist/components/comments-container copy/comment-item/index.d.ts.map +1 -0
  15. package/dist/components/comments-container copy/comment-item/index.js +20 -0
  16. package/dist/components/comments-container copy/comments-list/index.d.ts +24 -0
  17. package/dist/components/comments-container copy/comments-list/index.d.ts.map +1 -0
  18. package/dist/components/comments-container copy/comments-list/index.js +35 -0
  19. package/dist/components/comments-container copy/constants/index.d.ts +5 -0
  20. package/dist/components/comments-container copy/constants/index.d.ts.map +1 -0
  21. package/dist/components/comments-container copy/constants/index.js +5 -0
  22. package/dist/components/comments-container copy/index.d.ts +21 -0
  23. package/dist/components/comments-container copy/index.d.ts.map +1 -0
  24. package/dist/components/comments-container copy/index.js +27 -0
  25. package/dist/components/comments-container copy/use-comments/index.d.ts +17 -0
  26. package/dist/components/comments-container copy/use-comments/index.d.ts.map +1 -0
  27. package/dist/components/comments-container copy/use-comments/index.js +59 -0
  28. package/dist/components/form/index.d.ts +15 -0
  29. package/dist/components/form/index.d.ts.map +1 -0
  30. package/dist/components/form/index.js +85 -0
  31. package/dist/components/icon/index.d.ts +3 -3
  32. package/dist/components/icon/index.d.ts.map +1 -1
  33. package/dist/components/icon/index.js +2 -2
  34. package/dist/components/list-item/index.d.ts.map +1 -1
  35. package/dist/components/list-item/index.js +2 -2
  36. package/dist/components/log-activities-container/activity-message/index.d.ts +7 -0
  37. package/dist/components/log-activities-container/activity-message/index.d.ts.map +1 -0
  38. package/dist/components/log-activities-container/activity-message/index.js +63 -0
  39. package/dist/components/log-activities-container/comment-event-bus/index.d.ts +4 -0
  40. package/dist/components/log-activities-container/comment-event-bus/index.d.ts.map +1 -0
  41. package/dist/components/log-activities-container/comment-event-bus/index.js +4 -0
  42. package/dist/components/log-activities-container/comment-form/index.d.ts +39 -0
  43. package/dist/components/log-activities-container/comment-form/index.d.ts.map +1 -0
  44. package/dist/components/log-activities-container/comment-form/index.js +83 -0
  45. package/dist/components/log-activities-container/comment-item/index.d.ts +13 -0
  46. package/dist/components/log-activities-container/comment-item/index.d.ts.map +1 -0
  47. package/dist/components/log-activities-container/comment-item/index.js +20 -0
  48. package/dist/components/log-activities-container/comments-list/index.d.ts +24 -0
  49. package/dist/components/log-activities-container/comments-list/index.d.ts.map +1 -0
  50. package/dist/components/log-activities-container/comments-list/index.js +35 -0
  51. package/dist/components/log-activities-container/constants/index.d.ts +5 -0
  52. package/dist/components/log-activities-container/constants/index.d.ts.map +1 -0
  53. package/dist/components/log-activities-container/constants/index.js +5 -0
  54. package/dist/components/log-activities-container/index.d.ts +10 -0
  55. package/dist/components/log-activities-container/index.d.ts.map +1 -0
  56. package/dist/components/log-activities-container/index.js +9 -0
  57. package/dist/components/log-activities-container/log-activities-list/index.d.ts +11 -0
  58. package/dist/components/log-activities-container/log-activities-list/index.d.ts.map +1 -0
  59. package/dist/components/log-activities-container/log-activities-list/index.js +13 -0
  60. package/dist/components/log-activities-container/log-activity-item/index.d.ts +7 -0
  61. package/dist/components/log-activities-container/log-activity-item/index.d.ts.map +1 -0
  62. package/dist/components/log-activities-container/log-activity-item/index.js +63 -0
  63. package/dist/components/log-activities-container/use-comments/index.d.ts +17 -0
  64. package/dist/components/log-activities-container/use-comments/index.d.ts.map +1 -0
  65. package/dist/components/log-activities-container/use-comments/index.js +59 -0
  66. package/dist/components/log-activities-container/use-log-activities/index.d.ts +14 -0
  67. package/dist/components/log-activities-container/use-log-activities/index.d.ts.map +1 -0
  68. package/dist/components/log-activities-container/use-log-activities/index.js +41 -0
  69. package/dist/components/modal/index.js +1 -1
  70. package/dist/components/native-menu/index.d.ts +3 -1
  71. package/dist/components/native-menu/index.d.ts.map +1 -1
  72. package/dist/components/native-menu/index.js +22 -4
  73. package/dist/components/native-menu/native-menu-item/index.js +1 -1
  74. package/dist/components/notifications-menu/index.d.ts.map +1 -1
  75. package/dist/components/notifications-menu/index.js +53 -10
  76. package/dist/components/radio-button/index.d.ts +4 -8
  77. package/dist/components/radio-button/index.d.ts.map +1 -1
  78. package/dist/components/radio-button/index.js +3 -2
  79. package/dist/components/select/SelectDropdownContent.js +1 -1
  80. package/dist/components/select/index.d.ts +2 -1
  81. package/dist/components/select/index.d.ts.map +1 -1
  82. package/dist/components/select/index.js +2 -2
  83. package/dist/components/tab/index.d.ts.map +1 -1
  84. package/dist/components/tab/index.js +1 -1
  85. package/dist/index.d.ts +3 -1
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +4 -1
  88. package/dist/services/index.d.ts +2 -0
  89. package/dist/services/index.d.ts.map +1 -0
  90. package/dist/services/index.js +1 -0
  91. package/dist/services/remote-action/index.d.ts +14 -0
  92. package/dist/services/remote-action/index.d.ts.map +1 -0
  93. package/dist/services/remote-action/index.js +21 -0
  94. package/dist/services/remote-service/index.d.ts +31 -0
  95. package/dist/services/remote-service/index.d.ts.map +1 -0
  96. package/dist/services/remote-service/index.js +45 -0
  97. package/dist/tsconfig.tsbuildinfo +1 -1
  98. package/dist/utils/axios/index.d.ts +1 -0
  99. package/dist/utils/axios/index.d.ts.map +1 -1
  100. package/dist/utils/axios/index.js +7 -2
  101. package/dist/utils/remote-action/index.d.ts +14 -0
  102. package/dist/utils/remote-action/index.d.ts.map +1 -0
  103. package/dist/utils/remote-action/index.js +21 -0
  104. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
- import { IconifyIcon } from "@iconify/react";
1
+ import { IconifyIcon, IconProps } from "@iconify/react";
2
2
  export type Props = {
3
3
  icon: string | IconifyIcon;
4
4
  className?: string | undefined;
5
- };
6
- export default function Icon({ icon, className }: Props): import("react/jsx-runtime").JSX.Element;
5
+ } & IconProps;
6
+ export default function Icon({ icon, className, ...props }: Props): import("react/jsx-runtime").JSX.Element;
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/icon/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIxD,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,2CAEtD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/icon/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAInE,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,GAAG,SAAS,CAAC;AACd,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,2CAEhE"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Icon as I } from "@iconify/react";
3
- export default function Icon({ icon, className }) {
4
- return _jsx(I, { icon: icon, className: className });
3
+ export default function Icon({ icon, className, ...props }) {
4
+ return _jsx(I, { icon: icon, className: className, ...props });
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/list-item/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EACL,iBAAiB,EACjB,MAAM,EAEP,MAAM,mCAAmC,CAAC;AAM3C,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,kBAAkB,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvD,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EAAE,EAClC,KAAK,EACL,IAAI,EACJ,OAAY,EACZ,UAAU,EACV,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,WAAW,EACX,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,kBAAwB,EACxB,iBAA6B,EAC7B,OAAe,EACf,iBAAwB,EACxB,cAAqB,EACrB,eAAe,EACf,QAAQ,EACR,QAAiB,GAClB,EAAE,KAAK,CAAC,CAAC,CAAC,2CAiHV"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/list-item/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EACL,iBAAiB,EACjB,MAAM,EAEP,MAAM,mCAAmC,CAAC;AAM3C,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,kBAAkB,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvD,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EAAE,EAClC,KAAK,EACL,IAAI,EACJ,OAAY,EACZ,UAAU,EACV,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,WAAW,EACX,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,kBAAwB,EACxB,iBAA6B,EAC7B,OAAe,EACf,iBAAwB,EACxB,cAAqB,EACrB,eAAe,EACf,QAAQ,EACR,QAAiB,GAClB,EAAE,KAAK,CAAC,CAAC,CAAC,2CAkHV"}
@@ -14,10 +14,10 @@ export default function ListItem({ title, name, filters = [], totalPages, query,
14
14
  useFilters(name, filters, updateParams, getParam);
15
15
  usePagination(name, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam);
16
16
  useBulkActions(bulkActionFeature, filters, query);
17
- return (_jsxs("div", { className: "flex flex-col gap-5", children: [title && (_jsx("h3", { className: "text-2xl font-semibold text-primary", children: title })), _jsxs("div", { className: clsx("flex items-center gap-5 flex-wrap", showFiltersRow && bulkActionFeature
17
+ return (_jsxs("div", { className: "flex flex-col gap-5", children: [title && (_jsx("h3", { className: "text-2xl font-semibold text-primary", children: title })), (showFiltersRow || bulkActionFeature) && (_jsxs("div", { className: clsx("flex items-center flex-wrap", showFiltersRow && bulkActionFeature
18
18
  ? "justify-between"
19
19
  : "justify-end"), children: [showFiltersRow && (_jsxs("div", { className: "flex items-end gap-2 flex-wrap", children: [_jsx(SearchInput, { placeholder: `search about ${name}`, value: query, onDebouncedChange: setQuery, QueryDebouncedTime: QueryDebouncedTime }), filters.map((f, i) => (_jsxs("div", { className: "flex flex-col gap-1", children: [f.label && (_jsx("p", { className: "text-text font-semibold", children: f.label })), _jsx(Select, { name: `table-${name}-filter-${f.label}-${i}`, values: [f.value], setValues: (newValues) => f.setValue(newValues[0]), options: [
20
20
  { label: "All", value: DEFAULT_FILTER_VALUE },
21
21
  ...f.options,
22
- ], placeholder: f.label })] }, `table-${name}-filter-${f.label}-${i}`)))] })), bulkActionFeature && (_jsx("div", { className: "flex items-center gap-2 justify-end w-full md:w-fit", children: bulkActionFeature.bulkActions.map((a, i) => (_jsx(Button, { ...a, disabled: bulkActionFeature.selectedRowIds.length === 0 }, `table-${name}-bulk-action-${i}`))) })), headerComponent] }), _jsx("div", { className: "overflow-x-auto", children: loading ? (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Loader, {}) })) : (_jsx(_Fragment, { children: totalPages > 0 ? (_jsx(_Fragment, { children: children })) : (_jsxs("p", { className: "text-center text-text", children: ["No ", itemName, " found!"] })) })) }), showPaginationRow && (_jsxs("div", { className: "flex items-center justify-end gap-5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { className: "text-text text-sm", children: "Rows per page" }), _jsx(Select, { name: `${name}-select`, values: [rowsPerPage], setValues: (newValues) => setRowsPerPage(newValues[0]), options: rowsPerPageOptions })] }), totalPages >= 1 && (_jsx(Pagination, { name: name, page: page, setPage: setPage, totalPages: totalPages }))] }))] }));
22
+ ], placeholder: f.label })] }, `table-${name}-filter-${f.label}-${i}`)))] })), bulkActionFeature && (_jsx("div", { className: "flex items-center gap-2 justify-end w-full md:w-fit", children: bulkActionFeature.bulkActions.map((a, i) => (_jsx(Button, { ...a, disabled: bulkActionFeature.selectedRowIds.length === 0 }, `table-${name}-bulk-action-${i}`))) })), headerComponent] })), _jsx("div", { className: "overflow-x-auto", children: loading ? (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Loader, {}) })) : (_jsx(_Fragment, { children: totalPages > 0 ? (_jsx(_Fragment, { children: children })) : (_jsxs("p", { className: "text-center text-text", children: ["No ", itemName, " found!"] })) })) }), showPaginationRow && (_jsxs("div", { className: "flex items-center justify-end gap-2 md:gap-4 mt-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { className: "text-text text-sm", children: "Rows per page" }), _jsx(Select, { name: `${name}-select`, values: [rowsPerPage], setValues: (newValues) => setRowsPerPage(newValues[0]), options: rowsPerPageOptions })] }), totalPages >= 1 && (_jsx(Pagination, { name: name, page: page, setPage: setPage, totalPages: totalPages }))] }))] }));
23
23
  }
@@ -0,0 +1,7 @@
1
+ import { DTO } from "sea-platform-helpers";
2
+ type Props = {
3
+ activity: DTO.Activity.IActivity;
4
+ };
5
+ export default function ActivityMessage({ activity }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/activity-message/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAG7D,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC;CAClC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAoQ1D"}
@@ -0,0 +1,63 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { CONSTANTS, Utils } from "sea-platform-helpers";
4
+ const NONE = "N/A";
5
+ export default function ActivityMessage({ activity }) {
6
+ var _a, _b, _c, _d, _e, _f;
7
+ let message = null;
8
+ switch (activity.type) {
9
+ case CONSTANTS.Activity.ActivityTypes.SystemAction: {
10
+ break;
11
+ }
12
+ case CONSTANTS.Activity.ActivityTypes.NewCommentAdded: {
13
+ const metadata = activity.metadata;
14
+ message = (_jsxs("p", { children: ["New comment added", " ", _jsx("span", { className: "font-semibold", children: metadata.description })] }));
15
+ break;
16
+ }
17
+ case CONSTANTS.Activity.ActivityTypes.CommentGetUpdated: {
18
+ const metadata = activity.metadata;
19
+ message = (_jsxs("div", { className: "flex flex-col gap-[1px]", children: [_jsx("p", { children: "Comment updated" }), _jsxs("div", { className: "text-sm", children: [_jsxs("p", { children: ["From:", " ", _jsx("span", { className: "font-semibold", children: metadata.description.from })] }), _jsxs("p", { children: ["To:", " ", _jsx("span", { className: "font-semibold", children: metadata.description.to })] })] })] }));
20
+ break;
21
+ }
22
+ case CONSTANTS.Activity.ActivityTypes.CommentGetDeleted: {
23
+ const metadata = activity.metadata;
24
+ message = (_jsxs("p", { children: ["Comment delete", " ", _jsx("span", { className: "font-semibold", children: metadata.description })] }));
25
+ break;
26
+ }
27
+ case CONSTANTS.Activity.ActivityTypes.NewProjectCreated: {
28
+ const metadata = activity.metadata;
29
+ message = (_jsxs("p", { children: ["New project created", " ", _jsx("span", { className: "font-semibold", children: metadata.title })] }));
30
+ break;
31
+ }
32
+ case CONSTANTS.Activity.ActivityTypes.ProjectGetUpdated: {
33
+ const metadata = activity.metadata;
34
+ message = (_jsxs("div", { className: "flex flex-col gap-[1px]", children: [_jsx("p", { children: "Project updated" }), _jsxs("div", { className: "text-sm", children: [metadata.title && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Title:", " ", _jsx("span", { className: "font-semibold", children: metadata.title.to })] }) })), metadata.description && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Description:", " ", _jsx("span", { className: "font-semibold", children: metadata.description.to })] }) })), metadata.budget && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Budget:", " ", _jsx("span", { className: "font-semibold", children: Utils.Number.numeralUtils(metadata.budget.to).format(`0,0.00`) })] }) })), metadata.owner && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Owner:", " ", _jsx("span", { className: "font-semibold", children: (_b = (_a = metadata.owner.to) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : NONE })] }) })), metadata.startDate && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Start Date:", " ", _jsx("span", { className: "font-semibold", children: Utils.Moment.formatDate(metadata.startDate.to) })] }) })), metadata.endDate && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["End Date:", " ", _jsx("span", { className: "font-semibold", children: Utils.Moment.formatDate(metadata.endDate.to) })] }) }))] })] }));
35
+ break;
36
+ }
37
+ case CONSTANTS.Activity.ActivityTypes.ProjectGetDeleted: {
38
+ const metadata = activity.metadata;
39
+ message = (_jsxs("p", { children: ["Project deleted", " ", _jsx("span", { className: "font-semibold", children: metadata.title })] }));
40
+ break;
41
+ }
42
+ case CONSTANTS.Activity.ActivityTypes.NewTaskCreated: {
43
+ const metadata = activity.metadata;
44
+ message = (_jsxs("p", { children: ["New task created", " ", _jsx("span", { className: "font-semibold", children: metadata.title })] }));
45
+ break;
46
+ }
47
+ case CONSTANTS.Activity.ActivityTypes.TaskGetUpdated: {
48
+ const metadata = activity.metadata;
49
+ message = (_jsxs("div", { className: "flex flex-col gap-[1px]", children: [_jsx("p", { children: "Task updated" }), _jsxs("div", { className: "text-sm", children: [metadata.title && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Title:", " ", _jsx("span", { className: "font-semibold", children: metadata.title.to })] }) })), metadata.description && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Description:", " ", _jsx("span", { className: "font-semibold", children: metadata.description.to })] }) })), metadata.section && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Section:", " ", _jsx("span", { className: "font-semibold", children: (_d = (_c = metadata.section.to) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : NONE })] }) })), metadata.milestone && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Milestone:", " ", _jsx("span", { className: "font-semibold", children: (_f = (_e = metadata.milestone.to) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : NONE })] }) })), metadata.priority && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Priority:", " ", _jsx("span", { className: "font-semibold", children: metadata.priority.to })] }) })), metadata.dueDate && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Due date:", " ", _jsx("span", { className: "font-semibold", children: Utils.Moment.formatDate(metadata.dueDate.to) })] }) })), metadata.isCompleted && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Completed:", " ", _jsx("span", { className: "font-semibold", children: metadata.isCompleted.to ? "Yes" : "No" })] }) }))] })] }));
50
+ break;
51
+ }
52
+ case CONSTANTS.Activity.ActivityTypes.TaskGetDeleted: {
53
+ const metadata = activity.metadata;
54
+ message = (_jsxs("p", { children: ["Task deleted ", _jsx("span", { className: "font-semibold", children: metadata.title })] }));
55
+ break;
56
+ }
57
+ default: {
58
+ message = _jsxs("p", { children: ["Activity type ", activity.type, " is not supported."] });
59
+ break;
60
+ }
61
+ }
62
+ return _jsxs("div", { className: "text-text line-clamp-2 truncate", children: [" ", message, " "] });
63
+ }
@@ -0,0 +1,4 @@
1
+ import { EventEmitter } from "events";
2
+ declare const eventBus: EventEmitter<[never]>;
3
+ export default eventBus;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/comment-event-bus/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,QAAA,MAAM,QAAQ,uBAAqB,CAAC;AAEpC,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ import { EventEmitter } from "events";
3
+ const eventBus = new EventEmitter();
4
+ export default eventBus;
@@ -0,0 +1,39 @@
1
+ import React from "react";
2
+ import { useFormik } from "formik";
3
+ import { DTO } from "sea-platform-helpers";
4
+ import * as Yup from "yup";
5
+ export declare const createNewCommentValidation: () => Yup.ObjectSchema<{
6
+ description: string;
7
+ }, Yup.AnyObject, {
8
+ description: undefined;
9
+ }, "">;
10
+ type Values = {
11
+ objectId: string;
12
+ model: DTO.Comment.CommentSupportedModels;
13
+ description: string;
14
+ parentCommentId?: string;
15
+ };
16
+ export type CommentFormRenderProps = {
17
+ formik: ReturnType<typeof useFormik<Values>>;
18
+ isReplying: boolean;
19
+ isEditing: boolean;
20
+ replyOnComment?: DTO.Comment.IComment;
21
+ cancelReply: () => void;
22
+ cancelEdit: () => void;
23
+ handleKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
24
+ };
25
+ export type Props = {
26
+ objectId: string;
27
+ model: DTO.Comment.CommentSupportedModels;
28
+ commentsBaseUrl: string;
29
+ commentToEdit?: DTO.Comment.IComment;
30
+ setCommentToEdit: (comment: DTO.Comment.IComment | undefined) => void;
31
+ replyOnComment?: DTO.Comment.IComment;
32
+ setReplyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
33
+ onCreateCommentSuccess?: (comment: DTO.Comment.IComment) => void;
34
+ onEditCommentSuccess?: (comment: DTO.Comment.IComment) => void;
35
+ renderForm?: (props: CommentFormRenderProps) => React.ReactNode;
36
+ };
37
+ export default function CommentForm({ objectId, model, commentsBaseUrl, commentToEdit, setCommentToEdit, replyOnComment, setReplyOnComment, onCreateCommentSuccess, onEditCommentSuccess, renderForm, }: Props): import("react/jsx-runtime").JSX.Element;
38
+ export {};
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/comment-form/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAiB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAK3B,eAAO,MAAM,0BAA0B;;;;MAQtC,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACtC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;CACvE,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;IAExB,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACrC,gBAAgB,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IAEtE,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACtC,iBAAiB,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IAEvE,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;IACjE,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;IAE/D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,SAAS,CAAC;CACjE,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,GACX,EAAE,KAAK,2CAsIP"}
@@ -0,0 +1,83 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Textarea from "../../textarea";
4
+ import Button from "../../button";
5
+ import { useFormik } from "formik";
6
+ import * as Yup from "yup";
7
+ import { authAxiosInstance } from "../../../utils/auth-axios";
8
+ import eventBus from "../comment-event-bus";
9
+ import { COMMENT_EVENTS } from "../constants";
10
+ export const createNewCommentValidation = () => {
11
+ return Yup.object({
12
+ description: Yup.string()
13
+ .trim()
14
+ .min(1, "Required")
15
+ .max(1000, "Must be at most 1000 characters")
16
+ .required("Required"),
17
+ });
18
+ };
19
+ export default function CommentForm({ objectId, model, commentsBaseUrl, commentToEdit, setCommentToEdit, replyOnComment, setReplyOnComment, onCreateCommentSuccess, onEditCommentSuccess, renderForm, }) {
20
+ var _a;
21
+ const initialValues = {
22
+ model,
23
+ objectId,
24
+ description: (commentToEdit === null || commentToEdit === void 0 ? void 0 : commentToEdit.description) || "",
25
+ parentCommentId: (replyOnComment === null || replyOnComment === void 0 ? void 0 : replyOnComment.id) || "",
26
+ };
27
+ const onSubmit = async (values, helpers) => {
28
+ try {
29
+ if (commentToEdit) {
30
+ const response = await authAxiosInstance.put(`${commentsBaseUrl}/${commentToEdit.id}`, { description: values.description });
31
+ eventBus.emit(COMMENT_EVENTS.UpdateComment, response.data);
32
+ onEditCommentSuccess === null || onEditCommentSuccess === void 0 ? void 0 : onEditCommentSuccess(response.data);
33
+ }
34
+ else {
35
+ const response = await authAxiosInstance.post(commentsBaseUrl, {
36
+ objectId: values.objectId,
37
+ model: values.model,
38
+ description: values.description,
39
+ parentCommentId: values.parentCommentId,
40
+ });
41
+ eventBus.emit(COMMENT_EVENTS.NewComment, response.data);
42
+ onCreateCommentSuccess === null || onCreateCommentSuccess === void 0 ? void 0 : onCreateCommentSuccess(response.data);
43
+ }
44
+ helpers.resetForm();
45
+ }
46
+ finally {
47
+ helpers.setSubmitting(false);
48
+ }
49
+ };
50
+ const formik = useFormik({
51
+ initialValues,
52
+ validationSchema: createNewCommentValidation,
53
+ onSubmit,
54
+ enableReinitialize: true,
55
+ });
56
+ const handleKeyDown = (e) => {
57
+ // If user pressed Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac)
58
+ if ((e.ctrlKey || e.metaKey) && e.key === "Enter") {
59
+ e.preventDefault(); // prevent new line
60
+ if (!formik.isSubmitting && formik.isValid) {
61
+ formik.submitForm();
62
+ }
63
+ }
64
+ };
65
+ const cancelReply = () => setReplyOnComment(undefined);
66
+ const cancelEdit = () => setCommentToEdit(undefined);
67
+ const renderProps = {
68
+ formik,
69
+ isReplying: Boolean(replyOnComment),
70
+ isEditing: Boolean(commentToEdit),
71
+ replyOnComment,
72
+ cancelReply,
73
+ cancelEdit,
74
+ handleKeyDown,
75
+ };
76
+ if (renderForm)
77
+ return _jsx(_Fragment, { children: renderForm(renderProps) });
78
+ return (_jsxs("form", { onSubmit: formik.handleSubmit, className: "flex flex-col gap-3", children: [replyOnComment && (_jsxs("div", { className: "flex items-center justify-between bg-primary/5 px-3 py-2 rounded-lg border border-primary/10", children: [_jsxs("p", { className: "text-sm text-gray-700", children: ["Replying to", " ", _jsx("span", { className: "font-semibold text-primary", children: (_a = replyOnComment.account) === null || _a === void 0 ? void 0 : _a.name })] }), _jsx(Button, { type: "button", onClick: () => setReplyOnComment(undefined), className: "bg-transparent", children: _jsx("p", { className: "text-error hover:text-opacity-75 custom-animation", children: "Cancel" }) })] })), _jsx(Textarea, { name: "description", placeholder: commentToEdit
79
+ ? "Edit your comment..."
80
+ : replyOnComment
81
+ ? "Write a reply..."
82
+ : "Add a comment...", onChange: formik.handleChange, onBlur: formik.handleBlur, value: formik.values.description, errorMessage: formik.touched.description ? formik.errors.description : "", className: "min-h-[80px]", onKeyDown: handleKeyDown }), _jsxs("div", { className: "flex justify-end gap-2 pt-1", children: [commentToEdit && (_jsx(Button, { type: "button", onClick: () => setCommentToEdit(undefined), className: "bg-transparent", children: _jsx("p", { className: "text-error hover:text-opacity-75 custom-animation", children: "Cancel" }) })), _jsx(Button, { type: "submit", loading: formik.isSubmitting, disabled: formik.isSubmitting || !formik.isValid, children: commentToEdit ? "Update Comment" : "Add Comment" })] })] }));
83
+ }
@@ -0,0 +1,13 @@
1
+ import { DTO } from "sea-platform-helpers";
2
+ export type Props = {
3
+ comment: DTO.Comment.IComment;
4
+ isHighlight?: boolean;
5
+ currentAccountId?: string;
6
+ replyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
7
+ editComment: (comment: DTO.Comment.IComment | undefined) => void;
8
+ commentsBaseUrl: string;
9
+ objectId: string;
10
+ limit?: number;
11
+ };
12
+ export default function CommentItem({ comment, isHighlight, currentAccountId, replyOnComment, editComment, commentsBaseUrl, objectId, limit, }: Props): import("react/jsx-runtime").JSX.Element;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/comment-item/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAK7D,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACpE,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,WAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,EACf,QAAQ,EACR,KAAK,GACN,EAAE,KAAK,2CAkHP"}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo, useState } from "react";
4
+ import clsx from "clsx";
5
+ import { CONSTANTS, Utils } from "sea-platform-helpers";
6
+ import Icon from "../../icon";
7
+ import Avatar from "../../avatar";
8
+ import CommentsList from "../log-activities-list";
9
+ export default function CommentItem({ comment, isHighlight = false, currentAccountId, replyOnComment, editComment, commentsBaseUrl, objectId, limit, }) {
10
+ var _a, _b;
11
+ const [isReplyListOpen, setIsReplyListOpen] = useState(true);
12
+ const highlightedCommentId = useMemo(() => {
13
+ if (typeof window === "undefined")
14
+ return null;
15
+ const params = new URLSearchParams(window.location.search);
16
+ return params.get(CONSTANTS.Routes.global.QUERY_PARAMETER_KEYS.HIGHLIGHTED_COMMENT_ID);
17
+ }, []);
18
+ const shouldHighlight = isHighlight || comment.id === highlightedCommentId;
19
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("div", { className: clsx("relative flex flex-col gap-2 p-2 border border-gray-100 rounded-lg bg-white shadow-sm transition-all", shouldHighlight && "ring-2 ring-primary/50 bg-primary/5"), children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx(Avatar, { alt: ((_a = comment.account) === null || _a === void 0 ? void 0 : _a.name) || "", placeholderSource: "letters", size: "sm" }), _jsxs("div", { className: "flex flex-col flex-1 gap-1", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-sm font-semibold text-gray-900", children: (_b = comment.account) === null || _b === void 0 ? void 0 : _b.name }), _jsx("p", { className: "text-xs text-gray-500", children: Utils.Moment.formatDateAsLabel(comment.createdAt) })] }), _jsx("p", { className: "text-sm text-gray-700 leading-relaxed", children: comment.description }), comment.edited && (_jsxs("p", { className: "text-xs text-info italic", children: ["(Edited ", Utils.Moment.formatDateAsLabel(comment.updatedAt), ")"] })), _jsxs("div", { className: "flex items-center gap-4 text-xs text-gray-500", children: [comment.account && currentAccountId === comment.account.id && (_jsxs("button", { type: "button", onClick: () => editComment(comment), className: "flex items-center gap-1 hover:text-info transition", children: [_jsx(Icon, { icon: "bitcoin-icons:edit-outline", className: "h-4 w-4" }), _jsx("span", { children: "Edit" })] })), _jsxs("button", { type: "button", onClick: () => replyOnComment(comment), className: "flex items-center gap-1 hover:text-success transition", children: [_jsx(Icon, { icon: "basil:reply-outline", className: "h-4 w-4" }), _jsx("span", { children: "Reply" })] }), comment.repliesCount > 0 && (_jsxs("button", { type: "button", onClick: () => setIsReplyListOpen((prev) => !prev), className: "flex items-center gap-1 hover:text-info transition", children: [_jsx(Icon, { icon: isReplyListOpen ? "mdi:chevron-up" : "mdi:chevron-down", className: "h-4 w-4" }), _jsxs("span", { children: [comment.repliesCount, " replies"] })] }))] })] })] }) }), comment.repliesCount !== 0 && isReplyListOpen && (_jsx("div", { className: "pl-4 mt-1", children: _jsx(CommentsList, { editComment: editComment, replyOnComment: replyOnComment, highlightCommentId: isHighlight ? comment.id : "", currentAccountId: currentAccountId, commentsBaseUrl: commentsBaseUrl, objectId: objectId, limit: limit, parentCommentId: comment.id }) }))] }));
20
+ }
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { DTO } from "sea-platform-helpers";
3
+ type Props = {
4
+ currentAccountId?: string;
5
+ highlightCommentId?: string;
6
+ editComment: (comment: DTO.Comment.IComment | undefined) => void;
7
+ replyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
8
+ commentsBaseUrl: string;
9
+ objectId: string;
10
+ limit?: number;
11
+ parentCommentId?: string;
12
+ renderCommentItem?: (comment: DTO.Comment.IComment, commonProps: {
13
+ currentAccountId?: string;
14
+ editComment: (comment: DTO.Comment.IComment | undefined) => void;
15
+ replyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
16
+ commentsBaseUrl: string;
17
+ objectId: string;
18
+ limit?: number;
19
+ highlightCommentId?: string;
20
+ }) => React.ReactNode;
21
+ };
22
+ export default function CommentsList({ currentAccountId, highlightCommentId, editComment, replyOnComment, commentsBaseUrl, objectId, parentCommentId, limit, renderCommentItem, }: Props): import("react/jsx-runtime").JSX.Element;
23
+ export {};
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/comments-list/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAQ3C,KAAK,KAAK,GAAG;IACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,CAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAC7B,WAAW,EAAE;QACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACpE,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,KACE,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,EACR,eAAe,EACf,KAAU,EACV,iBAAiB,GAClB,EAAE,KAAK,2CAgGP"}
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
4
+ import Skeleton from "../../skeleton";
5
+ import CommentItem from "../comment-item";
6
+ import Button from "../../button";
7
+ import { useComments } from "../use-comments";
8
+ import eventBus from "../comment-event-bus";
9
+ import { COMMENT_EVENTS } from "../constants";
10
+ import clsx from "clsx";
11
+ export default function CommentsList({ currentAccountId, highlightCommentId, editComment, replyOnComment, commentsBaseUrl, objectId, parentCommentId, limit = 10, renderCommentItem, }) {
12
+ const { comments, loading, totalCount, pushNewComment, updateComment, loadMoreComments, hasMoreComments, } = useComments({ commentsBaseUrl, objectId, limit, parentCommentId });
13
+ const isReplyList = Boolean(parentCommentId);
14
+ useEffect(() => {
15
+ const handleNewComment = (data) => pushNewComment(data);
16
+ const handleUpdateComment = (data) => updateComment(data);
17
+ eventBus.on(COMMENT_EVENTS.NewComment, handleNewComment);
18
+ eventBus.on(COMMENT_EVENTS.UpdateComment, handleUpdateComment);
19
+ return () => {
20
+ eventBus.off(COMMENT_EVENTS.NewComment, handleNewComment);
21
+ eventBus.off(COMMENT_EVENTS.UpdateComment, handleUpdateComment);
22
+ };
23
+ }, []);
24
+ return (_jsx("div", { className: clsx("flex flex-col", isReplyList ? "gap-2" : "gap-4"), children: comments.length === 0 && !loading ? (_jsx("p", { className: "text-gray-500 text-sm text-center py-4", children: "There are no comments yet" })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex flex-col gap-2", children: comments.map((comment) => renderCommentItem ? (renderCommentItem(comment, {
25
+ currentAccountId,
26
+ editComment,
27
+ replyOnComment,
28
+ commentsBaseUrl,
29
+ objectId,
30
+ limit,
31
+ highlightCommentId,
32
+ })) : (_jsx(CommentItem, { comment: comment, isHighlight: highlightCommentId === comment.id, currentAccountId: currentAccountId, editComment: editComment, replyOnComment: replyOnComment, commentsBaseUrl: commentsBaseUrl, objectId: objectId, limit: limit }, comment.id))) }), loading && (_jsx("div", { className: "flex flex-col gap-3", children: Array(3)
33
+ .fill(null)
34
+ .map((_, i) => (_jsx(Skeleton, { className: "h-20 w-full rounded-lg" }, `comment-loading-${i}`))) })), totalCount !== 0 && !isReplyList && (_jsxs("p", { className: "text-gray-500 text-xs text-right mt-1", children: ["Showing ", comments.length, " of ", totalCount, " comments"] })), hasMoreComments && !loading && (_jsx("div", { className: clsx("flex justify-center mt-2"), children: _jsx(Button, { type: "button", onClick: loadMoreComments, variant: "secondary", children: "Load More" }) }))] })) }));
35
+ }
@@ -0,0 +1,5 @@
1
+ export declare const COMMENT_EVENTS: {
2
+ NewComment: string;
3
+ UpdateComment: string;
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/constants/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;CAG1B,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ export const COMMENT_EVENTS = {
3
+ NewComment: "NewComment",
4
+ UpdateComment: "UpdateComment",
5
+ };
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { DTO } from "sea-platform-helpers/dist";
3
+ export type Props = {
4
+ logActivitiesBaseUrl: string;
5
+ objectId: string;
6
+ limit?: number;
7
+ renderLogActivityItem?: (logActivity: DTO.Activity.IActivity) => React.ReactNode;
8
+ };
9
+ export default function LogActivitiesContainer({ logActivitiesBaseUrl, objectId, limit, renderLogActivityItem, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/log-activities-container/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD,MAAM,MAAM,KAAK,GAAG;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,CACtB,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS,KAChC,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,oBAAoB,EACpB,QAAQ,EACR,KAAU,EACV,qBAAqB,GACtB,EAAE,KAAK,2CAaP"}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import LogActivitiesList from "./log-activities-list";
4
+ import LogActivityItem from "./log-activity-item";
5
+ export default function LogActivitiesContainer({ logActivitiesBaseUrl, objectId, limit = 10, renderLogActivityItem, }) {
6
+ return (_jsx(LogActivitiesList, { logActivitiesBaseUrl: logActivitiesBaseUrl, objectId: objectId, limit: limit, renderLogActivityItem: renderLogActivityItem
7
+ ? renderLogActivityItem
8
+ : (activity) => _jsx(LogActivityItem, { activity: activity }) }));
9
+ }
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { DTO } from "sea-platform-helpers/dist";
3
+ type Props = {
4
+ logActivitiesBaseUrl: string;
5
+ objectId: string;
6
+ limit?: number;
7
+ renderLogActivityItem?: (logActivity: DTO.Activity.IActivity) => React.ReactNode;
8
+ };
9
+ export default function LogActivitiesList({ logActivitiesBaseUrl, objectId, limit, renderLogActivityItem, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/log-activities-list/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD,KAAK,KAAK,GAAG;IACX,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,CACtB,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS,KAChC,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,oBAAoB,EACpB,QAAQ,EACR,KAAU,EACV,qBAAqB,GACtB,EAAE,KAAK,2CAuDP"}
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Skeleton from "../../skeleton";
4
+ import Button from "../../button";
5
+ import { useLogActivities } from "../use-log-activities";
6
+ import clsx from "clsx";
7
+ import LogActivityItem from "../log-activity-item";
8
+ export default function LogActivitiesList({ logActivitiesBaseUrl, objectId, limit = 10, renderLogActivityItem, }) {
9
+ const { logActivities, loading, totalCount, loadMoreLogActivities, hasMoreLogActivities, } = useLogActivities({ logActivitiesBaseUrl, objectId, limit });
10
+ return (_jsx("div", { className: clsx("flex flex-col gap-3"), children: logActivities.length === 0 && !loading ? (_jsx("p", { className: "text-gray-500 text-sm text-center py-4", children: "There are no activities yet" })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex flex-col gap-3", children: logActivities.map((logActivity) => renderLogActivityItem ? (renderLogActivityItem(logActivity)) : (_jsx(LogActivityItem, { activity: logActivity }, logActivity.id))) }), loading && (_jsx("div", { className: "flex flex-col gap-3", children: Array(3)
11
+ .fill(null)
12
+ .map((_, i) => (_jsx(Skeleton, { className: "h-20 w-full rounded-lg" }, `logActivity-loading-${i}`))) })), hasMoreLogActivities && !loading && (_jsx("div", { className: clsx("flex justify-center mt-2"), children: _jsx(Button, { type: "button", onClick: loadMoreLogActivities, variant: "secondary", children: "Load More" }) }))] })) }));
13
+ }
@@ -0,0 +1,7 @@
1
+ import { DTO } from "sea-platform-helpers";
2
+ type Props = {
3
+ activity: DTO.Activity.IActivity;
4
+ };
5
+ export default function LogActivityItem({ activity }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/log-activity-item/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAG7D,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC;CAClC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAoQ1D"}
@@ -0,0 +1,63 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { CONSTANTS, Utils } from "sea-platform-helpers";
4
+ const NONE = "N/A";
5
+ export default function LogActivityItem({ activity }) {
6
+ var _a, _b, _c, _d, _e, _f;
7
+ let message = null;
8
+ switch (activity.type) {
9
+ case CONSTANTS.Activity.ActivityTypes.SystemAction: {
10
+ break;
11
+ }
12
+ case CONSTANTS.Activity.ActivityTypes.NewCommentAdded: {
13
+ const metadata = activity.metadata;
14
+ message = (_jsxs("p", { children: ["New comment added", " ", _jsx("span", { className: "font-semibold", children: metadata.description })] }));
15
+ break;
16
+ }
17
+ case CONSTANTS.Activity.ActivityTypes.CommentGetUpdated: {
18
+ const metadata = activity.metadata;
19
+ message = (_jsxs("div", { className: "flex flex-col gap-[1px]", children: [_jsx("p", { children: "Comment updated" }), _jsxs("div", { className: "text-sm", children: [_jsxs("p", { children: ["From:", " ", _jsx("span", { className: "font-semibold", children: metadata.description.from })] }), _jsxs("p", { children: ["To:", " ", _jsx("span", { className: "font-semibold", children: metadata.description.to })] })] })] }));
20
+ break;
21
+ }
22
+ case CONSTANTS.Activity.ActivityTypes.CommentGetDeleted: {
23
+ const metadata = activity.metadata;
24
+ message = (_jsxs("p", { children: ["Comment delete", " ", _jsx("span", { className: "font-semibold", children: metadata.description })] }));
25
+ break;
26
+ }
27
+ case CONSTANTS.Activity.ActivityTypes.NewProjectCreated: {
28
+ const metadata = activity.metadata;
29
+ message = (_jsxs("p", { children: ["New project created", " ", _jsx("span", { className: "font-semibold", children: metadata.title })] }));
30
+ break;
31
+ }
32
+ case CONSTANTS.Activity.ActivityTypes.ProjectGetUpdated: {
33
+ const metadata = activity.metadata;
34
+ message = (_jsxs("div", { className: "flex flex-col gap-[1px]", children: [_jsx("p", { children: "Project updated" }), _jsxs("div", { className: "text-sm", children: [metadata.title && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Title:", " ", _jsx("span", { className: "font-semibold", children: metadata.title.to })] }) })), metadata.description && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Description:", " ", _jsx("span", { className: "font-semibold", children: metadata.description.to })] }) })), metadata.budget && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Budget:", " ", _jsx("span", { className: "font-semibold", children: Utils.Number.numeralUtils(metadata.budget.to).format(`0,0.00`) })] }) })), metadata.owner && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Owner:", " ", _jsx("span", { className: "font-semibold", children: (_b = (_a = metadata.owner.to) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : NONE })] }) })), metadata.startDate && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Start Date:", " ", _jsx("span", { className: "font-semibold", children: Utils.Moment.formatDate(metadata.startDate.to) })] }) })), metadata.endDate && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["End Date:", " ", _jsx("span", { className: "font-semibold", children: Utils.Moment.formatDate(metadata.endDate.to) })] }) }))] })] }));
35
+ break;
36
+ }
37
+ case CONSTANTS.Activity.ActivityTypes.ProjectGetDeleted: {
38
+ const metadata = activity.metadata;
39
+ message = (_jsxs("p", { children: ["Project deleted", " ", _jsx("span", { className: "font-semibold", children: metadata.title })] }));
40
+ break;
41
+ }
42
+ case CONSTANTS.Activity.ActivityTypes.NewTaskCreated: {
43
+ const metadata = activity.metadata;
44
+ message = (_jsxs("p", { children: ["New task created", " ", _jsx("span", { className: "font-semibold", children: metadata.title })] }));
45
+ break;
46
+ }
47
+ case CONSTANTS.Activity.ActivityTypes.TaskGetUpdated: {
48
+ const metadata = activity.metadata;
49
+ message = (_jsxs("div", { className: "flex flex-col gap-[1px]", children: [_jsx("p", { children: "Task updated" }), _jsxs("div", { className: "text-sm", children: [metadata.title && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Title:", " ", _jsx("span", { className: "font-semibold", children: metadata.title.to })] }) })), metadata.description && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Description:", " ", _jsx("span", { className: "font-semibold", children: metadata.description.to })] }) })), metadata.section && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Section:", " ", _jsx("span", { className: "font-semibold", children: (_d = (_c = metadata.section.to) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : NONE })] }) })), metadata.milestone && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Milestone:", " ", _jsx("span", { className: "font-semibold", children: (_f = (_e = metadata.milestone.to) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : NONE })] }) })), metadata.priority && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Priority:", " ", _jsx("span", { className: "font-semibold", children: metadata.priority.to })] }) })), metadata.dueDate && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Due date:", " ", _jsx("span", { className: "font-semibold", children: Utils.Moment.formatDate(metadata.dueDate.to) })] }) })), metadata.isCompleted && (_jsx("div", { className: "flex gap-1", children: _jsxs("p", { children: ["Completed:", " ", _jsx("span", { className: "font-semibold", children: metadata.isCompleted.to ? "Yes" : "No" })] }) }))] })] }));
50
+ break;
51
+ }
52
+ case CONSTANTS.Activity.ActivityTypes.TaskGetDeleted: {
53
+ const metadata = activity.metadata;
54
+ message = (_jsxs("p", { children: ["Task deleted ", _jsx("span", { className: "font-semibold", children: metadata.title })] }));
55
+ break;
56
+ }
57
+ default: {
58
+ message = _jsxs("p", { children: ["Activity type ", activity.type, " is not supported."] });
59
+ break;
60
+ }
61
+ }
62
+ return _jsxs("div", { className: "text-text line-clamp-2 truncate", children: [" ", message, " "] });
63
+ }
@@ -0,0 +1,17 @@
1
+ import { DTO } from "sea-platform-helpers";
2
+ export declare function useComments({ commentsBaseUrl, objectId, limit, parentCommentId, }: {
3
+ commentsBaseUrl: string;
4
+ objectId: string;
5
+ limit?: number;
6
+ parentCommentId?: string;
7
+ }): {
8
+ comments: DTO.Comment.IComment[];
9
+ loading: boolean;
10
+ totalCount: number;
11
+ totalPages: number;
12
+ pushNewComment: (comment: DTO.Comment.IComment) => void;
13
+ updateComment: (comment: DTO.Comment.IComment) => void;
14
+ loadMoreComments: () => void;
15
+ hasMoreComments: boolean;
16
+ };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/use-comments/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAGlD,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,QAAQ,EACR,KAAU,EACV,eAAe,GAChB,EAAE;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;;;;;8BA0CkC,GAAG,CAAC,OAAO,CAAC,QAAQ;6BAkBrB,GAAG,CAAC,OAAO,CAAC,QAAQ;;;EAkBrD"}