@edifice.io/react 2.1.2-develop-pedago.20250318155201 → 2.1.2-develop-pedago.20250318163732

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.
@@ -9,6 +9,7 @@ import { CommentAvatar } from "./CommentAvatar.js";
9
9
  import { CommentDate } from "./CommentDate.js";
10
10
  import { CommentTitle } from "./CommentTitle.js";
11
11
  import { TextCounter } from "./TextCounter.js";
12
+ import { CommentDeleted } from "./CommentDeleted.js";
12
13
  import Button from "../../../components/Button/Button.js";
13
14
  import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
14
15
  const DeleteModal = /* @__PURE__ */ lazy(() => import("./DeleteModal.js")), Comment = ({
@@ -39,39 +40,42 @@ const DeleteModal = /* @__PURE__ */ lazy(() => import("./DeleteModal.js")), Comm
39
40
  resizeTextarea(), setValue(event.target.value);
40
41
  };
41
42
  return /* @__PURE__ */ jsxs(Fragment, { children: [
42
- /* @__PURE__ */ jsxs("div", { className: `${isEditing ? "border rounded-3 p-12 pb-8 d-flex gap-12 bg-gray-200 my-16" : "border rounded-3 p-12 pb-8 d-flex gap-12 mt-16"}`, children: [
43
- /* @__PURE__ */ jsx(CommentAvatar, { id: authorId }),
44
- /* @__PURE__ */ jsxs("div", { className: "flex flex-fill", children: [
45
- /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-12", children: [
46
- /* @__PURE__ */ jsx(CommentTitle, { children: authorName }),
47
- /* @__PURE__ */ jsx(BadgeProfile, { profile }),
48
- /* @__PURE__ */ jsx(CommentDate, { createdAt, updatedAt })
49
- ] }),
50
- isEditing ? /* @__PURE__ */ jsxs(Fragment, { children: [
51
- /* @__PURE__ */ jsx("div", { className: "mt-8 mb-4", children: /* @__PURE__ */ jsx("textarea", { id: "update-comment", ref, value, className: "form-control", placeholder: t("comment.placeholder"), maxLength: options.maxCommentLength, onChange: handleChangeContent, rows: 1, style: {
52
- resize: "none",
53
- overflow: "hidden"
54
- }, onFocus }) }),
55
- /* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-between align-items-center", children: [
56
- /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: handleReset, children: t("comment.cancel") }),
57
- /* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-end align-items-center gap-4", children: [
58
- /* @__PURE__ */ jsx(TextCounter, { content: value, maxLength: options.maxCommentLength }),
59
- /* @__PURE__ */ jsx(Button, { type: "submit", variant: "ghost", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconSave, {}), disabled: !(content != null && content.length), onClick: () => handleUpdateComment(value), children: t("comment.save") })
43
+ comment.deleted && /* @__PURE__ */ jsx(CommentDeleted, {}),
44
+ !comment.deleted && /* @__PURE__ */ jsxs(Fragment, { children: [
45
+ /* @__PURE__ */ jsxs("div", { className: `${isEditing ? "border rounded-3 p-12 pb-8 d-flex gap-12 bg-gray-200 my-16" : "border rounded-3 p-12 pb-8 d-flex gap-12 mt-16"}`, children: [
46
+ /* @__PURE__ */ jsx(CommentAvatar, { id: authorId }),
47
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-fill", children: [
48
+ /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-12", children: [
49
+ /* @__PURE__ */ jsx(CommentTitle, { children: authorName }),
50
+ /* @__PURE__ */ jsx(BadgeProfile, { profile }),
51
+ /* @__PURE__ */ jsx(CommentDate, { createdAt, updatedAt })
52
+ ] }),
53
+ isEditing ? /* @__PURE__ */ jsxs(Fragment, { children: [
54
+ /* @__PURE__ */ jsx("div", { className: "mt-8 mb-4", children: /* @__PURE__ */ jsx("textarea", { id: "update-comment", ref, value, className: "form-control", placeholder: t("comment.placeholder"), maxLength: options.maxCommentLength, onChange: handleChangeContent, rows: 1, style: {
55
+ resize: "none",
56
+ overflow: "hidden"
57
+ }, onFocus }) }),
58
+ /* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-between align-items-center", children: [
59
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: handleReset, children: t("comment.cancel") }),
60
+ /* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-end align-items-center gap-4", children: [
61
+ /* @__PURE__ */ jsx(TextCounter, { content: value, maxLength: options.maxCommentLength }),
62
+ /* @__PURE__ */ jsx(Button, { type: "submit", variant: "ghost", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconSave, {}), disabled: !(content != null && content.length), onClick: () => handleUpdateComment(value), children: t("comment.save") })
63
+ ] })
64
+ ] })
65
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
66
+ /* @__PURE__ */ jsx("div", { className: "mt-8 mb-4", children: content }),
67
+ type === "edit" && /* @__PURE__ */ jsxs("div", { className: "ms-n8", children: [
68
+ !comment.replyTo && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => onReply == null ? void 0 : onReply(comment.id), children: t("comment.reply") }),
69
+ userId === authorId && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => {
70
+ handleModifyComment(comment.id), setValue(content);
71
+ }, children: t("comment.edit") }),
72
+ (userId === authorId || (userRights == null ? void 0 : userRights.manager)) && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => setIsDeleteModalOpen(!0), children: t("comment.remove") })
60
73
  ] })
61
- ] })
62
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
63
- /* @__PURE__ */ jsx("div", { className: "mt-8 mb-4", children: content }),
64
- type === "edit" && /* @__PURE__ */ jsxs("div", { className: "ms-n8", children: [
65
- !comment.replyTo && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => onReply == null ? void 0 : onReply(comment.id), children: t("comment.reply") }),
66
- userId === authorId && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => {
67
- handleModifyComment(comment.id), setValue(content);
68
- }, children: t("comment.edit") }),
69
- (userId === authorId || (userRights == null ? void 0 : userRights.manager)) && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => setIsDeleteModalOpen(!0), children: t("comment.remove") })
70
74
  ] })
71
75
  ] })
72
- ] })
73
- ] }, id),
74
- /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, { position: !1 }), children: isDeleteModalOpen && /* @__PURE__ */ jsx(DeleteModal, { isOpen: isDeleteModalOpen, onCancel: () => setIsDeleteModalOpen(!1), onSuccess: () => onDeleteComment(id) }) })
76
+ ] }, id),
77
+ /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, { position: !1 }), children: isDeleteModalOpen && /* @__PURE__ */ jsx(DeleteModal, { isOpen: isDeleteModalOpen, onCancel: () => setIsDeleteModalOpen(!1), onSuccess: () => onDeleteComment(id) }) })
78
+ ] })
75
79
  ] });
76
80
  };
77
81
  export {
@@ -0,0 +1 @@
1
+ export declare const CommentDeleted: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useTranslation } from "react-i18next";
3
+ const CommentDeleted = () => {
4
+ const {
5
+ t
6
+ } = useTranslation();
7
+ return /* @__PURE__ */ jsx("div", { className: "border rounded-3 p-12 pb-8 d-flex gap-12 bg-gray-200 my-16", children: t("comment.deleted") });
8
+ };
9
+ export {
10
+ CommentDeleted
11
+ };
@@ -24,9 +24,9 @@ const CommentReplies = ({
24
24
  comments,
25
25
  profiles,
26
26
  options
27
- });
27
+ }), showCommentForm = replyFormCommentId === parentComment.id && !parentComment.deleted;
28
28
  return /* @__PURE__ */ jsxs("div", { className: "comments-replies-container", children: [
29
- replyFormCommentId === parentComment.id && /* @__PURE__ */ jsx("div", { className: "comments-replies-form", children: /* @__PURE__ */ jsx(CommentForm, { userId: user == null ? void 0 : user.userId, replyTo: parentComment.id }) }),
29
+ showCommentForm && /* @__PURE__ */ jsx("div", { className: "comments-replies-form", children: /* @__PURE__ */ jsx(CommentForm, { userId: user == null ? void 0 : user.userId, replyTo: parentComment.id }) }),
30
30
  /* @__PURE__ */ jsx("div", { className: "comments-replies-list", children: slicedReplies.map((reply) => /* @__PURE__ */ jsx("div", { className: "comments-replies-reply", children: /* @__PURE__ */ jsx(Comment, { comment: reply, profile, userId: user == null ? void 0 : user.userId }) }, reply.id)) }),
31
31
  slicedReplies.length < (defaultReplies == null ? void 0 : defaultReplies.length) && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", onClick: handleMoreReplies, className: "ms-24", children: t("comment.more.replies") })
32
32
  ] });
@@ -28,6 +28,10 @@ export interface CommentProps {
28
28
  * The comment parent ID.
29
29
  */
30
30
  replyTo?: string;
31
+ /**
32
+ * If the comment is deleted.
33
+ */
34
+ deleted?: boolean;
31
35
  }
32
36
  export interface CommentCallbacks {
33
37
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.1.2-develop-pedago.20250318155201",
3
+ "version": "2.1.2-develop-pedago.20250318163732",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -118,9 +118,9 @@
118
118
  "react-slugify": "^3.0.3",
119
119
  "swiper": "^10.1.0",
120
120
  "ua-parser-js": "^1.0.36",
121
- "@edifice.io/bootstrap": "2.1.2-develop-pedago.20250318155201",
122
- "@edifice.io/tiptap-extensions": "2.1.2-develop-pedago.20250318155201",
123
- "@edifice.io/utilities": "2.1.2-develop-pedago.20250318155201"
121
+ "@edifice.io/bootstrap": "2.1.2-develop-pedago.20250318163732",
122
+ "@edifice.io/tiptap-extensions": "2.1.2-develop-pedago.20250318163732",
123
+ "@edifice.io/utilities": "2.1.2-develop-pedago.20250318163732"
124
124
  },
125
125
  "devDependencies": {
126
126
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -151,8 +151,8 @@
151
151
  "vite": "^5.4.11",
152
152
  "vite-plugin-dts": "^4.1.0",
153
153
  "vite-tsconfig-paths": "^5.0.1",
154
- "@edifice.io/client": "2.1.2-develop-pedago.20250318155201",
155
- "@edifice.io/config": "2.1.2-develop-pedago.20250318155201"
154
+ "@edifice.io/config": "2.1.2-develop-pedago.20250318163732",
155
+ "@edifice.io/client": "2.1.2-develop-pedago.20250318163732"
156
156
  },
157
157
  "peerDependencies": {
158
158
  "@react-spring/web": "^9.7.5",