@focus-reactive/payload-plugin-comments 1.4.0 → 1.5.0

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 (53) hide show
  1. package/dist/components/CommentItem/ToolsPanel.d.ts +2 -1
  2. package/dist/components/CommentItem/ToolsPanel.d.ts.map +1 -1
  3. package/dist/components/CommentItem/ToolsPanel.js +33 -10
  4. package/dist/components/CommentItem/ToolsPanel.js.map +1 -1
  5. package/dist/components/CommentItem/index.d.ts.map +1 -1
  6. package/dist/components/CommentItem/index.js +1 -0
  7. package/dist/components/CommentItem/index.js.map +1 -1
  8. package/dist/components/CommentsDrawer/components/CommentsFilter.d.ts +2 -0
  9. package/dist/components/CommentsDrawer/components/CommentsFilter.d.ts.map +1 -0
  10. package/dist/components/CommentsDrawer/components/CommentsFilter.js +58 -0
  11. package/dist/components/CommentsDrawer/components/CommentsFilter.js.map +1 -0
  12. package/dist/components/CommentsDrawer/components/Header.d.ts.map +1 -1
  13. package/dist/components/CommentsDrawer/components/Header.js +5 -1
  14. package/dist/components/CommentsDrawer/components/Header.js.map +1 -1
  15. package/dist/components/CommentsPanel/components/GlobalView.d.ts.map +1 -1
  16. package/dist/components/CommentsPanel/components/GlobalView.js +42 -35
  17. package/dist/components/CommentsPanel/components/GlobalView.js.map +1 -1
  18. package/dist/components/CommentsPanel/index.d.ts.map +1 -1
  19. package/dist/components/CommentsPanel/index.js +5 -1
  20. package/dist/components/CommentsPanel/index.js.map +1 -1
  21. package/dist/components/CommentsPanel/utils/resolveEmptyCommentsMessageKey.d.ts +5 -0
  22. package/dist/components/CommentsPanel/utils/resolveEmptyCommentsMessageKey.d.ts.map +1 -0
  23. package/dist/components/CommentsPanel/utils/resolveEmptyCommentsMessageKey.js +10 -0
  24. package/dist/components/CommentsPanel/utils/resolveEmptyCommentsMessageKey.js.map +1 -0
  25. package/dist/components/FieldCommentLabel/index.d.ts.map +1 -1
  26. package/dist/components/FieldCommentLabel/index.js +8 -2
  27. package/dist/components/FieldCommentLabel/index.js.map +1 -1
  28. package/dist/components/IconButton/index.d.ts +3 -2
  29. package/dist/components/IconButton/index.d.ts.map +1 -1
  30. package/dist/components/IconButton/index.js +26 -3
  31. package/dist/components/IconButton/index.js.map +1 -1
  32. package/dist/providers/CommentsFilterProvider/index.d.ts +14 -0
  33. package/dist/providers/CommentsFilterProvider/index.d.ts.map +1 -0
  34. package/dist/providers/CommentsFilterProvider/index.js +25 -0
  35. package/dist/providers/CommentsFilterProvider/index.js.map +1 -0
  36. package/dist/providers/CommentsProviderWrapper/index.d.ts.map +1 -1
  37. package/dist/providers/CommentsProviderWrapper/index.js +2 -1
  38. package/dist/providers/CommentsProviderWrapper/index.js.map +1 -1
  39. package/dist/styles.css +1 -1
  40. package/dist/translations/en.d.ts.map +1 -1
  41. package/dist/translations/en.js +17 -1
  42. package/dist/translations/en.js.map +1 -1
  43. package/dist/translations/types.d.ts +16 -0
  44. package/dist/translations/types.d.ts.map +1 -1
  45. package/dist/types/filters.d.ts +5 -0
  46. package/dist/types/filters.d.ts.map +1 -0
  47. package/dist/types/filters.js +1 -0
  48. package/dist/types/filters.js.map +1 -0
  49. package/dist/utils/comment/applyCommentFilters.d.ts +4 -0
  50. package/dist/utils/comment/applyCommentFilters.d.ts.map +1 -0
  51. package/dist/utils/comment/applyCommentFilters.js +19 -0
  52. package/dist/utils/comment/applyCommentFilters.js.map +1 -0
  53. package/package.json +2 -1
@@ -1,9 +1,10 @@
1
1
  interface Props {
2
+ commentId: string | number;
2
3
  isResolved: boolean;
3
4
  canDelete: boolean;
4
5
  onResolve: () => void;
5
6
  onDelete: () => void;
6
7
  }
7
- export declare function ToolsPanel({ isResolved, canDelete, onDelete, onResolve }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export declare function ToolsPanel({ commentId, isResolved, canDelete, onDelete, onResolve }: Props): import("react/jsx-runtime").JSX.Element;
8
9
  export {};
9
10
  //# sourceMappingURL=ToolsPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolsPanel.d.ts","sourceRoot":"","sources":["../../../src/components/CommentItem/ToolsPanel.tsx"],"names":[],"mappings":"AAIA,UAAU,KAAK;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,2CAsB/E"}
1
+ {"version":3,"file":"ToolsPanel.d.ts","sourceRoot":"","sources":["../../../src/components/CommentItem/ToolsPanel.tsx"],"names":[],"mappings":"AAKA,UAAU,KAAK;IACb,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,2CA4C1F"}
@@ -1,19 +1,42 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { CircleCheck, Trash2, Undo2 } from "lucide-react";
3
- import { useTranslation } from "@payloadcms/ui";
3
+ import { ConfirmationModal, toast, useModal, useTranslation } from "@payloadcms/ui";
4
4
  import { IconButton } from "../IconButton";
5
- function ToolsPanel({ isResolved, canDelete, onDelete, onResolve }) {
5
+ import { useCommentsFilter } from "../../providers/CommentsFilterProvider";
6
+ function ToolsPanel({ commentId, isResolved, canDelete, onDelete, onResolve }) {
7
+ const DELETE_MODAL_SLUG = `comments-delete-${commentId}`;
6
8
  const { t } = useTranslation();
7
- return /* @__PURE__ */ jsxs("div", { className: "absolute top-3 right-3 flex bg-(--theme-elevation-0) p-1 border rounded-md border-(--theme-elevation-100) opacity-0 group-hover:opacity-100 transition-opacity duration-150 pointer-events-none group-hover:pointer-events-auto", children: [
9
+ const { openModal } = useModal();
10
+ const { filters } = useCommentsFilter();
11
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsxs("div", { className: "absolute top-3 right-3 flex bg-(--theme-elevation-0) p-1 border rounded-md border-(--theme-elevation-100) opacity-0 group-hover:opacity-100 transition-opacity duration-150 pointer-events-none group-hover:pointer-events-auto", children: [
13
+ /* @__PURE__ */ jsx(
14
+ IconButton,
15
+ {
16
+ onClick: () => {
17
+ onResolve();
18
+ if (!isResolved && !filters.showResolved) {
19
+ toast.success(t("comments:commentResolved") ?? "Comment resolved");
20
+ }
21
+ },
22
+ title: isResolved ? t("comments:reopen") ?? "Reopen" : t("comments:resolve") ?? "Resolve",
23
+ children: isResolved ? /* @__PURE__ */ jsx(Undo2, { size: 16 }) : /* @__PURE__ */ jsx(CircleCheck, { size: 16 })
24
+ }
25
+ ),
26
+ canDelete && /* @__PURE__ */ jsx(IconButton, { onClick: () => openModal(DELETE_MODAL_SLUG), title: t("comments:delete") ?? "Delete", children: /* @__PURE__ */ jsx(Trash2, { size: 16 }) })
27
+ ] }),
8
28
  /* @__PURE__ */ jsx(
9
- IconButton,
29
+ ConfirmationModal,
10
30
  {
11
- onClick: onResolve,
12
- title: isResolved ? t("comments:reopen") ?? "Reopen" : t("comments:resolve") ?? "Resolve",
13
- children: isResolved ? /* @__PURE__ */ jsx(Undo2, { size: 16 }) : /* @__PURE__ */ jsx(CircleCheck, { size: 16 })
31
+ modalSlug: DELETE_MODAL_SLUG,
32
+ heading: t("comments:deleteComment:heading"),
33
+ body: t("comments:deleteComment:body"),
34
+ confirmingLabel: t("comments:deleteComment:confirming"),
35
+ confirmLabel: t("comments:deleteComment:confirm"),
36
+ cancelLabel: t("comments:deleteComment:cancel"),
37
+ onConfirm: onDelete
14
38
  }
15
- ),
16
- canDelete && /* @__PURE__ */ jsx(IconButton, { onClick: onDelete, title: t("comments:delete") ?? "Delete", children: /* @__PURE__ */ jsx(Trash2, { size: 16 }) })
39
+ )
17
40
  ] });
18
41
  }
19
42
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CommentItem/ToolsPanel.tsx"],"sourcesContent":["import { CircleCheck, Trash2, Undo2 } from \"lucide-react\";\nimport { useTranslation } from \"@payloadcms/ui\";\nimport { IconButton } from \"../IconButton\";\n\ninterface Props {\n isResolved: boolean;\n canDelete: boolean;\n onResolve: () => void;\n onDelete: () => void;\n}\n\nexport function ToolsPanel({ isResolved, canDelete, onDelete, onResolve }: Props) {\n const { t } = useTranslation();\n\n return (\n <div className=\"absolute top-3 right-3 flex bg-(--theme-elevation-0) p-1 border rounded-md border-(--theme-elevation-100) opacity-0 group-hover:opacity-100 transition-opacity duration-150 pointer-events-none group-hover:pointer-events-auto\">\n <IconButton\n onClick={onResolve}\n title={\n isResolved ? (t(\"comments:reopen\" as never) ?? \"Reopen\") : (t(\"comments:resolve\" as never) ?? \"Resolve\")\n }>\n {isResolved ?\n <Undo2 size={16} />\n : <CircleCheck size={16} />}\n </IconButton>\n\n {canDelete && (\n <IconButton onClick={onDelete} title={t(\"comments:delete\" as never) ?? \"Delete\"}>\n <Trash2 size={16} />\n </IconButton>\n )}\n </div>\n );\n}\n"],"mappings":"AAeI,SAOM,KAPN;AAfJ,SAAS,aAAa,QAAQ,aAAa;AAC3C,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AASpB,SAAS,WAAW,EAAE,YAAY,WAAW,UAAU,UAAU,GAAU;AAChF,QAAM,EAAE,EAAE,IAAI,eAAe;AAE7B,SACE,qBAAC,SAAI,WAAU,mOACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,OACE,aAAc,EAAE,iBAA0B,KAAK,WAAa,EAAE,kBAA2B,KAAK;AAAA,QAE/F,uBACC,oBAAC,SAAM,MAAM,IAAI,IACjB,oBAAC,eAAY,MAAM,IAAI;AAAA;AAAA,IAC3B;AAAA,IAEC,aACC,oBAAC,cAAW,SAAS,UAAU,OAAO,EAAE,iBAA0B,KAAK,UACrE,8BAAC,UAAO,MAAM,IAAI,GACpB;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/CommentItem/ToolsPanel.tsx"],"sourcesContent":["import { CircleCheck, Trash2, Undo2 } from \"lucide-react\";\nimport { ConfirmationModal, toast, useModal, useTranslation } from \"@payloadcms/ui\";\nimport { IconButton } from \"../IconButton\";\nimport { useCommentsFilter } from \"../../providers/CommentsFilterProvider\";\n\ninterface Props {\n commentId: string | number;\n isResolved: boolean;\n canDelete: boolean;\n onResolve: () => void;\n onDelete: () => void;\n}\n\nexport function ToolsPanel({ commentId, isResolved, canDelete, onDelete, onResolve }: Props) {\n const DELETE_MODAL_SLUG = `comments-delete-${commentId}`;\n\n const { t } = useTranslation();\n const { openModal } = useModal();\n const { filters } = useCommentsFilter();\n\n return (\n <>\n <div className=\"absolute top-3 right-3 flex bg-(--theme-elevation-0) p-1 border rounded-md border-(--theme-elevation-100) opacity-0 group-hover:opacity-100 transition-opacity duration-150 pointer-events-none group-hover:pointer-events-auto\">\n <IconButton\n onClick={() => {\n onResolve();\n\n if (!isResolved && !filters.showResolved) {\n toast.success(t(\"comments:commentResolved\" as never) ?? \"Comment resolved\");\n }\n }}\n title={\n isResolved ? (t(\"comments:reopen\" as never) ?? \"Reopen\") : (t(\"comments:resolve\" as never) ?? \"Resolve\")\n }>\n {isResolved ?\n <Undo2 size={16} />\n : <CircleCheck size={16} />}\n </IconButton>\n\n {canDelete && (\n <IconButton onClick={() => openModal(DELETE_MODAL_SLUG)} title={t(\"comments:delete\" as never) ?? \"Delete\"}>\n <Trash2 size={16} />\n </IconButton>\n )}\n </div>\n\n <ConfirmationModal\n modalSlug={DELETE_MODAL_SLUG}\n heading={t(\"comments:deleteComment:heading\" as never)}\n body={t(\"comments:deleteComment:body\" as never)}\n confirmingLabel={t(\"comments:deleteComment:confirming\" as never)}\n confirmLabel={t(\"comments:deleteComment:confirm\" as never)}\n cancelLabel={t(\"comments:deleteComment:cancel\" as never)}\n onConfirm={onDelete}\n />\n </>\n );\n}\n"],"mappings":"AAqBI,mBAcQ,KAbN,YADF;AArBJ,SAAS,aAAa,QAAQ,aAAa;AAC3C,SAAS,mBAAmB,OAAO,UAAU,sBAAsB;AACnE,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAU3B,SAAS,WAAW,EAAE,WAAW,YAAY,WAAW,UAAU,UAAU,GAAU;AAC3F,QAAM,oBAAoB,mBAAmB,SAAS;AAEtD,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,UAAU,IAAI,SAAS;AAC/B,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AAEtC,SACE,iCACE;AAAA,yBAAC,SAAI,WAAU,mOACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAS,MAAM;AACb,sBAAU;AAEV,gBAAI,CAAC,cAAc,CAAC,QAAQ,cAAc;AACxC,oBAAM,QAAQ,EAAE,0BAAmC,KAAK,kBAAkB;AAAA,YAC5E;AAAA,UACF;AAAA,UACA,OACE,aAAc,EAAE,iBAA0B,KAAK,WAAa,EAAE,kBAA2B,KAAK;AAAA,UAE/F,uBACC,oBAAC,SAAM,MAAM,IAAI,IACjB,oBAAC,eAAY,MAAM,IAAI;AAAA;AAAA,MAC3B;AAAA,MAEC,aACC,oBAAC,cAAW,SAAS,MAAM,UAAU,iBAAiB,GAAG,OAAO,EAAE,iBAA0B,KAAK,UAC/F,8BAAC,UAAO,MAAM,IAAI,GACpB;AAAA,OAEJ;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX,SAAS,EAAE,gCAAyC;AAAA,QACpD,MAAM,EAAE,6BAAsC;AAAA,QAC9C,iBAAiB,EAAE,mCAA4C;AAAA,QAC/D,cAAc,EAAE,gCAAyC;AAAA,QACzD,aAAa,EAAE,+BAAwC;AAAA,QACvD,WAAW;AAAA;AAAA,IACb;AAAA,KACF;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CommentItem/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAU3C,UAAU,KAAK;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,KAAK,2CA+E5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CommentItem/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAU3C,UAAU,KAAK;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,KAAK,2CAgF5D"}
@@ -70,6 +70,7 @@ function CommentItem({ comment, currentUserId }) {
70
70
  /* @__PURE__ */ jsx(
71
71
  ToolsPanel,
72
72
  {
73
+ commentId: comment.id,
73
74
  isResolved,
74
75
  canDelete,
75
76
  onDelete: handleDelete,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CommentItem/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { startTransition, useRef } from \"react\";\nimport { useTranslation } from \"@payloadcms/ui\";\nimport { CircleCheck } from \"lucide-react\";\nimport { cn } from \"../../utils/general/cn\";\nimport type { Comment } from \"../../types\";\nimport { useComments } from \"../../providers/CommentsProvider\";\nimport { renderCommentText } from \"../../utils/comment/renderCommentText\";\nimport { resolveUsername } from \"../../utils/user/resolveUsername\";\nimport { FALLBACK_DELETED_USERNAME, FALLBACK_USERNAME } from \"../../constants\";\nimport { ToolsPanel } from \"./ToolsPanel\";\nimport { useRelativeDate } from \"../../hooks/useRelativeDate\";\nimport { Avatar } from \"../Avatar\";\nimport { StrikethoroughOverlay } from \"./StrikethoroughOverlay\";\n\ninterface Props {\n comment: Comment;\n currentUserId: number | null;\n}\n\nexport function CommentItem({ comment, currentUserId }: Props) {\n const { resolveComment, removeComment, usernameFieldPath } = useComments();\n const { t } = useTranslation();\n const createdAtRelativeDate = useRelativeDate(comment.createdAt);\n\n const contentRef = useRef<HTMLParagraphElement>(null);\n\n const deletedUserLabel = t(\"comments:deletedUser\" as never) ?? FALLBACK_DELETED_USERNAME;\n const unknownLabel = t(\"comments:unknownAuthor\" as never) ?? FALLBACK_USERNAME;\n const narrowedAuthor = typeof comment.author === \"object\" ? comment.author : null;\n const authorName = resolveUsername(narrowedAuthor, usernameFieldPath, unknownLabel);\n\n const isResolved = comment.isResolved ?? false;\n const authorId =\n comment.author && typeof comment.author === \"object\" && \"id\" in comment.author ? comment.author.id : null;\n const canDelete = currentUserId !== null && authorId === currentUserId;\n\n const renderedText = renderCommentText({\n text: comment.text,\n mentions: comment.mentions,\n currentUserId,\n usernameFieldPath,\n fallbackDeletedUsername: deletedUserLabel,\n });\n\n const handleToggleResolve = () => {\n startTransition(async () => {\n await resolveComment(comment.id, !isResolved);\n });\n };\n\n const handleDelete = () => {\n startTransition(async () => {\n await removeComment(comment.id);\n });\n };\n\n return (\n <div className={cn(\"group relative\")}>\n <div className=\"flex gap-2.5 items-start\">\n <Avatar user={narrowedAuthor} usernameFieldPath={usernameFieldPath} fallbackName={unknownLabel} />\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 mb-1\">\n <span className=\"font-semibold text-[13px] text-(--theme-text) truncate\">{authorName}</span>\n\n {isResolved && (\n <CircleCheck size={14} className=\"text-green-500 shrink-0\" aria-label={t(\"comments:resolved\" as never)} />\n )}\n\n <span className=\"text-[11px] text-(--theme-elevation-450) shrink-0\">{createdAtRelativeDate}</span>\n </div>\n\n <p\n ref={contentRef}\n className={cn(\n \"relative m-0 text-[13px] text-(--theme-text) leading-normal whitespace-pre-wrap wrap-break-word transition-opacity motion-reduce:transition-none\",\n isResolved && \"opacity-60\",\n )}>\n {isResolved && (\n <del style={{ textDecoration: \"none\" }} dateTime={comment.resolvedAt ?? undefined}>\n {renderedText}\n </del>\n )}\n {!isResolved && renderedText}\n\n <StrikethoroughOverlay isResolved={isResolved} contentRef={contentRef} />\n </p>\n </div>\n </div>\n\n <ToolsPanel\n isResolved={isResolved}\n canDelete={canDelete}\n onDelete={handleDelete}\n onResolve={handleToggleResolve}\n />\n </div>\n );\n}\n"],"mappings":";AA6DQ,cAGE,YAHF;AA3DR,SAAS,iBAAiB,cAAc;AACxC,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AAEnB,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,2BAA2B,yBAAyB;AAC7D,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,SAAS,6BAA6B;AAO/B,SAAS,YAAY,EAAE,SAAS,cAAc,GAAU;AAC7D,QAAM,EAAE,gBAAgB,eAAe,kBAAkB,IAAI,YAAY;AACzE,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,wBAAwB,gBAAgB,QAAQ,SAAS;AAE/D,QAAM,aAAa,OAA6B,IAAI;AAEpD,QAAM,mBAAmB,EAAE,sBAA+B,KAAK;AAC/D,QAAM,eAAe,EAAE,wBAAiC,KAAK;AAC7D,QAAM,iBAAiB,OAAO,QAAQ,WAAW,WAAW,QAAQ,SAAS;AAC7E,QAAM,aAAa,gBAAgB,gBAAgB,mBAAmB,YAAY;AAElF,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,WACJ,QAAQ,UAAU,OAAO,QAAQ,WAAW,YAAY,QAAQ,QAAQ,SAAS,QAAQ,OAAO,KAAK;AACvG,QAAM,YAAY,kBAAkB,QAAQ,aAAa;AAEzD,QAAM,eAAe,kBAAkB;AAAA,IACrC,MAAM,QAAQ;AAAA,IACd,UAAU,QAAQ;AAAA,IAClB;AAAA,IACA;AAAA,IACA,yBAAyB;AAAA,EAC3B,CAAC;AAED,QAAM,sBAAsB,MAAM;AAChC,oBAAgB,YAAY;AAC1B,YAAM,eAAe,QAAQ,IAAI,CAAC,UAAU;AAAA,IAC9C,CAAC;AAAA,EACH;AAEA,QAAM,eAAe,MAAM;AACzB,oBAAgB,YAAY;AAC1B,YAAM,cAAc,QAAQ,EAAE;AAAA,IAChC,CAAC;AAAA,EACH;AAEA,SACE,qBAAC,SAAI,WAAW,GAAG,gBAAgB,GACjC;AAAA,yBAAC,SAAI,WAAU,4BACb;AAAA,0BAAC,UAAO,MAAM,gBAAgB,mBAAsC,cAAc,cAAc;AAAA,MAEhG,qBAAC,SAAI,WAAU,kBACb;AAAA,6BAAC,SAAI,WAAU,gCACb;AAAA,8BAAC,UAAK,WAAU,0DAA0D,sBAAW;AAAA,UAEpF,cACC,oBAAC,eAAY,MAAM,IAAI,WAAU,2BAA0B,cAAY,EAAE,mBAA4B,GAAG;AAAA,UAG1G,oBAAC,UAAK,WAAU,qDAAqD,iCAAsB;AAAA,WAC7F;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,WAAW;AAAA,cACT;AAAA,cACA,cAAc;AAAA,YAChB;AAAA,YACC;AAAA,4BACC,oBAAC,SAAI,OAAO,EAAE,gBAAgB,OAAO,GAAG,UAAU,QAAQ,cAAc,QACrE,wBACH;AAAA,cAED,CAAC,cAAc;AAAA,cAEhB,oBAAC,yBAAsB,YAAwB,YAAwB;AAAA;AAAA;AAAA,QACzE;AAAA,SACF;AAAA,OACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV,WAAW;AAAA;AAAA,IACb;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/CommentItem/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { startTransition, useRef } from \"react\";\nimport { useTranslation } from \"@payloadcms/ui\";\nimport { CircleCheck } from \"lucide-react\";\nimport { cn } from \"../../utils/general/cn\";\nimport type { Comment } from \"../../types\";\nimport { useComments } from \"../../providers/CommentsProvider\";\nimport { renderCommentText } from \"../../utils/comment/renderCommentText\";\nimport { resolveUsername } from \"../../utils/user/resolveUsername\";\nimport { FALLBACK_DELETED_USERNAME, FALLBACK_USERNAME } from \"../../constants\";\nimport { ToolsPanel } from \"./ToolsPanel\";\nimport { useRelativeDate } from \"../../hooks/useRelativeDate\";\nimport { Avatar } from \"../Avatar\";\nimport { StrikethoroughOverlay } from \"./StrikethoroughOverlay\";\n\ninterface Props {\n comment: Comment;\n currentUserId: number | null;\n}\n\nexport function CommentItem({ comment, currentUserId }: Props) {\n const { resolveComment, removeComment, usernameFieldPath } = useComments();\n const { t } = useTranslation();\n const createdAtRelativeDate = useRelativeDate(comment.createdAt);\n\n const contentRef = useRef<HTMLParagraphElement>(null);\n\n const deletedUserLabel = t(\"comments:deletedUser\" as never) ?? FALLBACK_DELETED_USERNAME;\n const unknownLabel = t(\"comments:unknownAuthor\" as never) ?? FALLBACK_USERNAME;\n const narrowedAuthor = typeof comment.author === \"object\" ? comment.author : null;\n const authorName = resolveUsername(narrowedAuthor, usernameFieldPath, unknownLabel);\n\n const isResolved = comment.isResolved ?? false;\n const authorId =\n comment.author && typeof comment.author === \"object\" && \"id\" in comment.author ? comment.author.id : null;\n const canDelete = currentUserId !== null && authorId === currentUserId;\n\n const renderedText = renderCommentText({\n text: comment.text,\n mentions: comment.mentions,\n currentUserId,\n usernameFieldPath,\n fallbackDeletedUsername: deletedUserLabel,\n });\n\n const handleToggleResolve = () => {\n startTransition(async () => {\n await resolveComment(comment.id, !isResolved);\n });\n };\n\n const handleDelete = () => {\n startTransition(async () => {\n await removeComment(comment.id);\n });\n };\n\n return (\n <div className={cn(\"group relative\")}>\n <div className=\"flex gap-2.5 items-start\">\n <Avatar user={narrowedAuthor} usernameFieldPath={usernameFieldPath} fallbackName={unknownLabel} />\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 mb-1\">\n <span className=\"font-semibold text-[13px] text-(--theme-text) truncate\">{authorName}</span>\n\n {isResolved && (\n <CircleCheck size={14} className=\"text-green-500 shrink-0\" aria-label={t(\"comments:resolved\" as never)} />\n )}\n\n <span className=\"text-[11px] text-(--theme-elevation-450) shrink-0\">{createdAtRelativeDate}</span>\n </div>\n\n <p\n ref={contentRef}\n className={cn(\n \"relative m-0 text-[13px] text-(--theme-text) leading-normal whitespace-pre-wrap wrap-break-word transition-opacity motion-reduce:transition-none\",\n isResolved && \"opacity-60\",\n )}>\n {isResolved && (\n <del style={{ textDecoration: \"none\" }} dateTime={comment.resolvedAt ?? undefined}>\n {renderedText}\n </del>\n )}\n {!isResolved && renderedText}\n\n <StrikethoroughOverlay isResolved={isResolved} contentRef={contentRef} />\n </p>\n </div>\n </div>\n\n <ToolsPanel\n commentId={comment.id}\n isResolved={isResolved}\n canDelete={canDelete}\n onDelete={handleDelete}\n onResolve={handleToggleResolve}\n />\n </div>\n );\n}\n"],"mappings":";AA6DQ,cAGE,YAHF;AA3DR,SAAS,iBAAiB,cAAc;AACxC,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AAEnB,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,2BAA2B,yBAAyB;AAC7D,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,SAAS,6BAA6B;AAO/B,SAAS,YAAY,EAAE,SAAS,cAAc,GAAU;AAC7D,QAAM,EAAE,gBAAgB,eAAe,kBAAkB,IAAI,YAAY;AACzE,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,wBAAwB,gBAAgB,QAAQ,SAAS;AAE/D,QAAM,aAAa,OAA6B,IAAI;AAEpD,QAAM,mBAAmB,EAAE,sBAA+B,KAAK;AAC/D,QAAM,eAAe,EAAE,wBAAiC,KAAK;AAC7D,QAAM,iBAAiB,OAAO,QAAQ,WAAW,WAAW,QAAQ,SAAS;AAC7E,QAAM,aAAa,gBAAgB,gBAAgB,mBAAmB,YAAY;AAElF,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,WACJ,QAAQ,UAAU,OAAO,QAAQ,WAAW,YAAY,QAAQ,QAAQ,SAAS,QAAQ,OAAO,KAAK;AACvG,QAAM,YAAY,kBAAkB,QAAQ,aAAa;AAEzD,QAAM,eAAe,kBAAkB;AAAA,IACrC,MAAM,QAAQ;AAAA,IACd,UAAU,QAAQ;AAAA,IAClB;AAAA,IACA;AAAA,IACA,yBAAyB;AAAA,EAC3B,CAAC;AAED,QAAM,sBAAsB,MAAM;AAChC,oBAAgB,YAAY;AAC1B,YAAM,eAAe,QAAQ,IAAI,CAAC,UAAU;AAAA,IAC9C,CAAC;AAAA,EACH;AAEA,QAAM,eAAe,MAAM;AACzB,oBAAgB,YAAY;AAC1B,YAAM,cAAc,QAAQ,EAAE;AAAA,IAChC,CAAC;AAAA,EACH;AAEA,SACE,qBAAC,SAAI,WAAW,GAAG,gBAAgB,GACjC;AAAA,yBAAC,SAAI,WAAU,4BACb;AAAA,0BAAC,UAAO,MAAM,gBAAgB,mBAAsC,cAAc,cAAc;AAAA,MAEhG,qBAAC,SAAI,WAAU,kBACb;AAAA,6BAAC,SAAI,WAAU,gCACb;AAAA,8BAAC,UAAK,WAAU,0DAA0D,sBAAW;AAAA,UAEpF,cACC,oBAAC,eAAY,MAAM,IAAI,WAAU,2BAA0B,cAAY,EAAE,mBAA4B,GAAG;AAAA,UAG1G,oBAAC,UAAK,WAAU,qDAAqD,iCAAsB;AAAA,WAC7F;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,WAAW;AAAA,cACT;AAAA,cACA,cAAc;AAAA,YAChB;AAAA,YACC;AAAA,4BACC,oBAAC,SAAI,OAAO,EAAE,gBAAgB,OAAO,GAAG,UAAU,QAAQ,cAAc,QACrE,wBACH;AAAA,cAED,CAAC,cAAc;AAAA,cAEhB,oBAAC,yBAAsB,YAAwB,YAAwB;AAAA;AAAA;AAAA,QACzE;AAAA,SACF;AAAA,OACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,QAAQ;AAAA,QACnB;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV,WAAW;AAAA;AAAA,IACb;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,2 @@
1
+ export declare function CommentsFilter(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=CommentsFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommentsFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsDrawer/components/CommentsFilter.tsx"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,4CA8C7B"}
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
4
+ import { FilterIcon, CheckIcon } from "lucide-react";
5
+ import { IconButton } from "../../IconButton";
6
+ import { useCommentsFilter } from "../../../providers/CommentsFilterProvider";
7
+ import { useTranslation } from "@payloadcms/ui";
8
+ function CommentsFilter() {
9
+ const { filters, setFilter, isAnyFilterActive } = useCommentsFilter();
10
+ const { t } = useTranslation();
11
+ return /* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [
12
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { title: t("comments:filterComments"), variant: "neutral", isActive: isAnyFilterActive, children: /* @__PURE__ */ jsx(FilterIcon, { width: 16, height: 16 }) }) }),
13
+ /* @__PURE__ */ jsxs(
14
+ DropdownMenu.Content,
15
+ {
16
+ align: "end",
17
+ sideOffset: 4,
18
+ onEscapeKeyDown: (e) => e.stopPropagation(),
19
+ className: `
20
+ flex flex-col min-w-55
21
+ z-50 bg-(--theme-bg) border border-(--theme-border-color) rounded shadow-lg p-2
22
+ `,
23
+ children: [
24
+ /* @__PURE__ */ jsxs(
25
+ DropdownMenu.CheckboxItem,
26
+ {
27
+ className: "flex items-center gap-2 cursor-pointer text-lg px-3 py-1.5 rounded outline-none hover:bg-(--theme-elevation-100) data-highlighted:bg-(--theme-elevation-100) select-none",
28
+ checked: filters.showResolved,
29
+ onCheckedChange: (checked) => setFilter("showResolved", checked),
30
+ onSelect: (e) => e.preventDefault(),
31
+ children: [
32
+ /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { className: "w-5 h-5 flex items-center justify-center text-(--theme-text)", children: /* @__PURE__ */ jsx(CheckIcon, { className: "w-5 h-5" }) }),
33
+ /* @__PURE__ */ jsx("span", { className: filters.showResolved ? "" : "pl-7", children: t("comments:showResolved") })
34
+ ]
35
+ }
36
+ ),
37
+ /* @__PURE__ */ jsxs(
38
+ DropdownMenu.CheckboxItem,
39
+ {
40
+ className: "flex items-center gap-2 cursor-pointer text-lg px-3 py-1.5 rounded outline-none hover:bg-(--theme-elevation-100) data-highlighted:bg-(--theme-elevation-100) select-none",
41
+ checked: filters.onlyMyThreads,
42
+ onCheckedChange: (checked) => setFilter("onlyMyThreads", checked),
43
+ onSelect: (e) => e.preventDefault(),
44
+ children: [
45
+ /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { className: "w-5 h-5 flex items-center justify-center text-(--theme-text)", children: /* @__PURE__ */ jsx(CheckIcon, { className: "w-5 h-5" }) }),
46
+ /* @__PURE__ */ jsx("span", { className: filters.onlyMyThreads ? "" : "pl-7", children: t("comments:onlyMyThreads") })
47
+ ]
48
+ }
49
+ )
50
+ ]
51
+ }
52
+ )
53
+ ] });
54
+ }
55
+ export {
56
+ CommentsFilter
57
+ };
58
+ //# sourceMappingURL=CommentsFilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/CommentsDrawer/components/CommentsFilter.tsx"],"sourcesContent":["\"use client\";\n\nimport * as DropdownMenu from \"@radix-ui/react-dropdown-menu\";\nimport { FilterIcon, CheckIcon } from \"lucide-react\";\nimport { IconButton } from \"../../IconButton\";\nimport { useCommentsFilter } from \"../../../providers/CommentsFilterProvider\";\nimport { useTranslation } from \"@payloadcms/ui\";\n\nexport function CommentsFilter() {\n const { filters, setFilter, isAnyFilterActive } = useCommentsFilter();\n const { t } = useTranslation();\n\n return (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton title={t(\"comments:filterComments\" as never)} variant={\"neutral\"} isActive={isAnyFilterActive}>\n <FilterIcon width={16} height={16} />\n </IconButton>\n </DropdownMenu.Trigger>\n\n <DropdownMenu.Content\n align=\"end\"\n sideOffset={4}\n onEscapeKeyDown={(e) => e.stopPropagation()}\n className={`\n flex flex-col min-w-55\n z-50 bg-(--theme-bg) border border-(--theme-border-color) rounded shadow-lg p-2\n `}>\n <DropdownMenu.CheckboxItem\n className=\"flex items-center gap-2 cursor-pointer text-lg px-3 py-1.5 rounded outline-none hover:bg-(--theme-elevation-100) data-highlighted:bg-(--theme-elevation-100) select-none\"\n checked={filters.showResolved}\n onCheckedChange={(checked) => setFilter(\"showResolved\", checked)}\n onSelect={(e) => e.preventDefault()}>\n <DropdownMenu.ItemIndicator className=\"w-5 h-5 flex items-center justify-center text-(--theme-text)\">\n <CheckIcon className=\"w-5 h-5\" />\n </DropdownMenu.ItemIndicator>\n\n <span className={filters.showResolved ? \"\" : \"pl-7\"}>{t(\"comments:showResolved\" as never)}</span>\n </DropdownMenu.CheckboxItem>\n\n <DropdownMenu.CheckboxItem\n className=\"flex items-center gap-2 cursor-pointer text-lg px-3 py-1.5 rounded outline-none hover:bg-(--theme-elevation-100) data-highlighted:bg-(--theme-elevation-100) select-none\"\n checked={filters.onlyMyThreads}\n onCheckedChange={(checked) => setFilter(\"onlyMyThreads\", checked)}\n onSelect={(e) => e.preventDefault()}>\n <DropdownMenu.ItemIndicator className=\"w-5 h-5 flex items-center justify-center text-(--theme-text)\">\n <CheckIcon className=\"w-5 h-5\" />\n </DropdownMenu.ItemIndicator>\n\n <span className={filters.onlyMyThreads ? \"\" : \"pl-7\"}>{t(\"comments:onlyMyThreads\" as never)}</span>\n </DropdownMenu.CheckboxItem>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n );\n}\n"],"mappings":";AAgBU,cAYF,YAZE;AAdV,YAAY,kBAAkB;AAC9B,SAAS,YAAY,iBAAiB;AACtC,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAExB,SAAS,iBAAiB;AAC/B,QAAM,EAAE,SAAS,WAAW,kBAAkB,IAAI,kBAAkB;AACpE,QAAM,EAAE,EAAE,IAAI,eAAe;AAE7B,SACE,qBAAC,aAAa,MAAb,EACC;AAAA,wBAAC,aAAa,SAAb,EAAqB,SAAO,MAC3B,8BAAC,cAAW,OAAO,EAAE,yBAAkC,GAAG,SAAS,WAAW,UAAU,mBACtF,8BAAC,cAAW,OAAO,IAAI,QAAQ,IAAI,GACrC,GACF;AAAA,IAEA;AAAA,MAAC,aAAa;AAAA,MAAb;AAAA,QACC,OAAM;AAAA,QACN,YAAY;AAAA,QACZ,iBAAiB,CAAC,MAAM,EAAE,gBAAgB;AAAA,QAC1C,WAAW;AAAA;AAAA;AAAA;AAAA,QAIX;AAAA;AAAA,YAAC,aAAa;AAAA,YAAb;AAAA,cACC,WAAU;AAAA,cACV,SAAS,QAAQ;AAAA,cACjB,iBAAiB,CAAC,YAAY,UAAU,gBAAgB,OAAO;AAAA,cAC/D,UAAU,CAAC,MAAM,EAAE,eAAe;AAAA,cAClC;AAAA,oCAAC,aAAa,eAAb,EAA2B,WAAU,gEACpC,8BAAC,aAAU,WAAU,WAAU,GACjC;AAAA,gBAEA,oBAAC,UAAK,WAAW,QAAQ,eAAe,KAAK,QAAS,YAAE,uBAAgC,GAAE;AAAA;AAAA;AAAA,UAC5F;AAAA,UAEA;AAAA,YAAC,aAAa;AAAA,YAAb;AAAA,cACC,WAAU;AAAA,cACV,SAAS,QAAQ;AAAA,cACjB,iBAAiB,CAAC,YAAY,UAAU,iBAAiB,OAAO;AAAA,cAChE,UAAU,CAAC,MAAM,EAAE,eAAe;AAAA,cAClC;AAAA,oCAAC,aAAa,eAAb,EAA2B,WAAU,gEACpC,8BAAC,aAAU,WAAU,WAAU,GACjC;AAAA,gBAEA,oBAAC,UAAK,WAAW,QAAQ,gBAAgB,KAAK,QAAS,YAAE,wBAAiC,GAAE;AAAA;AAAA;AAAA,UAC9F;AAAA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsDrawer/components/Header.tsx"],"names":[],"mappings":"AAMA,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,2CAe3C"}
1
+ {"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsDrawer/components/Header.tsx"],"names":[],"mappings":"AAOA,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,2CAiB3C"}
@@ -3,12 +3,16 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useModal, useTranslation } from "@payloadcms/ui";
4
4
  import { XIcon } from "lucide-react";
5
5
  import { IconButton } from "../../IconButton";
6
+ import { CommentsFilter } from "./CommentsFilter";
6
7
  function Header({ slug }) {
7
8
  const { t } = useTranslation();
8
9
  const { closeModal } = useModal();
9
10
  return /* @__PURE__ */ jsxs("header", { className: "sticky top-0 z-10 flex items-center gap-3 py-5 bg-(--theme-bg)", children: [
10
11
  /* @__PURE__ */ jsx("h2", { className: "m-0 text-2xl font-bold", children: t("comments:label") }),
11
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 ml-auto", children: /* @__PURE__ */ jsx(IconButton, { onClick: () => closeModal(slug), title: t("comments:close"), children: /* @__PURE__ */ jsx(XIcon, { width: 16, height: 16 }) }) })
12
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 ml-auto", children: [
13
+ /* @__PURE__ */ jsx(CommentsFilter, {}),
14
+ /* @__PURE__ */ jsx(IconButton, { onClick: () => closeModal(slug), title: t("comments:close"), children: /* @__PURE__ */ jsx(XIcon, { width: 16, height: 16 }) })
15
+ ] })
12
16
  ] });
13
17
  }
14
18
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/CommentsDrawer/components/Header.tsx"],"sourcesContent":["\"use client\";\n\nimport { useModal, useTranslation } from \"@payloadcms/ui\";\nimport { XIcon } from \"lucide-react\";\nimport { IconButton } from \"../../IconButton\";\n\ninterface HeaderProps {\n slug: string;\n}\n\nexport function Header({ slug }: HeaderProps) {\n const { t } = useTranslation();\n const { closeModal } = useModal();\n\n return (\n <header className=\"sticky top-0 z-10 flex items-center gap-3 py-5 bg-(--theme-bg)\">\n <h2 className=\"m-0 text-2xl font-bold\">{t(\"comments:label\" as never)}</h2>\n\n <div className=\"flex items-center gap-2 ml-auto\">\n <IconButton onClick={() => closeModal(slug)} title={t(\"comments:close\" as never)}>\n <XIcon width={16} height={16} />\n </IconButton>\n </div>\n </header>\n );\n}\n"],"mappings":";AAeI,SACE,KADF;AAbJ,SAAS,UAAU,sBAAsB;AACzC,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAMpB,SAAS,OAAO,EAAE,KAAK,GAAgB;AAC5C,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,WAAW,IAAI,SAAS;AAEhC,SACE,qBAAC,YAAO,WAAU,kEAChB;AAAA,wBAAC,QAAG,WAAU,0BAA0B,YAAE,gBAAyB,GAAE;AAAA,IAErE,oBAAC,SAAI,WAAU,mCACb,8BAAC,cAAW,SAAS,MAAM,WAAW,IAAI,GAAG,OAAO,EAAE,gBAAyB,GAC7E,8BAAC,SAAM,OAAO,IAAI,QAAQ,IAAI,GAChC,GACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/CommentsDrawer/components/Header.tsx"],"sourcesContent":["\"use client\";\n\nimport { useModal, useTranslation } from \"@payloadcms/ui\";\nimport { XIcon } from \"lucide-react\";\nimport { IconButton } from \"../../IconButton\";\nimport { CommentsFilter } from \"./CommentsFilter\";\n\ninterface HeaderProps {\n slug: string;\n}\n\nexport function Header({ slug }: HeaderProps) {\n const { t } = useTranslation();\n const { closeModal } = useModal();\n\n return (\n <header className=\"sticky top-0 z-10 flex items-center gap-3 py-5 bg-(--theme-bg)\">\n <h2 className=\"m-0 text-2xl font-bold\">{t(\"comments:label\" as never)}</h2>\n\n <div className=\"flex items-center gap-2 ml-auto\">\n <CommentsFilter />\n\n <IconButton onClick={() => closeModal(slug)} title={t(\"comments:close\" as never)}>\n <XIcon width={16} height={16} />\n </IconButton>\n </div>\n </header>\n );\n}\n"],"mappings":";AAiBM,cAEA,YAFA;AAfN,SAAS,UAAU,sBAAsB;AACzC,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAMxB,SAAS,OAAO,EAAE,KAAK,GAAgB;AAC5C,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,WAAW,IAAI,SAAS;AAEhC,SACE,qBAAC,YAAO,WAAU,kEAChB;AAAA,wBAAC,QAAG,WAAU,0BAA0B,YAAE,gBAAyB,GAAE;AAAA,IAErE,qBAAC,SAAI,WAAU,mCACb;AAAA,0BAAC,kBAAe;AAAA,MAEhB,oBAAC,cAAW,SAAS,MAAM,WAAW,IAAI,GAAG,OAAO,EAAE,gBAAyB,GAC7E,8BAAC,SAAM,OAAO,IAAI,QAAQ,IAAI,GAChC;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalView.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/components/GlobalView.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAStD,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,2CAkDhE"}
1
+ {"version":3,"file":"GlobalView.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/components/GlobalView.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAWtD,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,2CA0DhE"}
@@ -1,57 +1,64 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useLocale } from "@payloadcms/ui";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useLocale, useTranslation } from "@payloadcms/ui";
4
4
  import { useComments } from "../../../providers/CommentsProvider";
5
+ import { useCommentsFilter } from "../../../providers/CommentsFilterProvider";
5
6
  import { useDocumentTitlesQuery } from "../../../api/queries/useDocumentTitlesQuery";
6
7
  import { groupCommentsGlobally } from "../utils/groupCommentsGlobally";
7
8
  import { resolveEntityLabel } from "../utils/resolveEntityLabel";
9
+ import { resolveEmptyCommentsMessageKey } from "../utils/resolveEmptyCommentsMessageKey";
8
10
  import { CollapsibleGroup } from "./CollapsibleGroup";
9
11
  import { FieldGroupSection } from "./FieldGroupSection";
10
12
  import { createCollapsibleGroupKey } from "../utils/createCollapsibleGroupKey";
11
13
  function GlobalView({ comments, userId, className }) {
12
14
  const { collectionLabels, globalLabels, queryContext } = useComments();
15
+ const { filters } = useCommentsFilter();
16
+ const { t } = useTranslation();
13
17
  const { data: documentTitles = {} } = useDocumentTitlesQuery(queryContext);
14
18
  const { code: locale } = useLocale();
15
19
  const groupedComments = groupCommentsGlobally(comments);
16
- return /* @__PURE__ */ jsx("div", { className, children: groupedComments.map((entry) => {
17
- if (entry.type === "collection") {
18
- const { slug: slug2, docs } = entry;
20
+ return /* @__PURE__ */ jsxs("div", { className, children: [
21
+ groupedComments.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-(--theme-elevation-450) text-[13px] text-center py-6 m-0", children: t(`comments:${resolveEmptyCommentsMessageKey(filters)}`) }),
22
+ groupedComments.map((entry) => {
23
+ if (entry.type === "collection") {
24
+ const { slug: slug2, docs } = entry;
25
+ return /* @__PURE__ */ jsx(
26
+ CollapsibleGroup,
27
+ {
28
+ groupKey: slug2,
29
+ label: resolveEntityLabel(collectionLabels[slug2], locale, slug2),
30
+ level: "collection",
31
+ children: [...docs.entries()].map(([docId, fields2]) => {
32
+ const title = documentTitles[slug2]?.[String(docId)] ?? String(docId);
33
+ const documentId = Number(docId);
34
+ return /* @__PURE__ */ jsx(
35
+ CollapsibleGroup,
36
+ {
37
+ groupKey: createCollapsibleGroupKey({ collectionSlug: slug2, documentId }),
38
+ label: title,
39
+ level: "document",
40
+ children: /* @__PURE__ */ jsx(FieldGroupSection, { fields: fields2, userId, collectionSlug: slug2, documentId })
41
+ },
42
+ docId
43
+ );
44
+ })
45
+ },
46
+ slug2
47
+ );
48
+ }
49
+ const { slug, fields } = entry;
19
50
  return /* @__PURE__ */ jsx(
20
51
  CollapsibleGroup,
21
52
  {
22
- groupKey: slug2,
23
- label: resolveEntityLabel(collectionLabels[slug2], locale, slug2),
53
+ groupKey: slug,
54
+ label: resolveEntityLabel(globalLabels[slug], locale, slug),
24
55
  level: "collection",
25
- children: [...docs.entries()].map(([docId, fields2]) => {
26
- const title = documentTitles[slug2]?.[String(docId)] ?? String(docId);
27
- const documentId = Number(docId);
28
- return /* @__PURE__ */ jsx(
29
- CollapsibleGroup,
30
- {
31
- groupKey: createCollapsibleGroupKey({ collectionSlug: slug2, documentId }),
32
- label: title,
33
- level: "document",
34
- children: /* @__PURE__ */ jsx(FieldGroupSection, { fields: fields2, userId, collectionSlug: slug2, documentId })
35
- },
36
- docId
37
- );
38
- })
56
+ children: /* @__PURE__ */ jsx(FieldGroupSection, { fields, userId, globalSlug: slug })
39
57
  },
40
- slug2
58
+ slug
41
59
  );
42
- }
43
- const { slug, fields } = entry;
44
- return /* @__PURE__ */ jsx(
45
- CollapsibleGroup,
46
- {
47
- groupKey: slug,
48
- label: resolveEntityLabel(globalLabels[slug], locale, slug),
49
- level: "collection",
50
- children: /* @__PURE__ */ jsx(FieldGroupSection, { fields, userId, globalSlug: slug })
51
- },
52
- slug
53
- );
54
- }) });
60
+ })
61
+ ] });
55
62
  }
56
63
  export {
57
64
  GlobalView
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/CommentsPanel/components/GlobalView.tsx"],"sourcesContent":["\"use client\";\n\nimport { useLocale } from \"@payloadcms/ui\";\nimport type { Comment } from \"../../../types/comment\";\nimport { useComments } from \"../../../providers/CommentsProvider\";\nimport { useDocumentTitlesQuery } from \"../../../api/queries/useDocumentTitlesQuery\";\nimport { groupCommentsGlobally } from \"../utils/groupCommentsGlobally\";\nimport { resolveEntityLabel } from \"../utils/resolveEntityLabel\";\nimport { CollapsibleGroup } from \"./CollapsibleGroup\";\nimport { FieldGroupSection } from \"./FieldGroupSection\";\nimport { createCollapsibleGroupKey } from \"../utils/createCollapsibleGroupKey\";\n\ninterface Props {\n comments: Comment[];\n userId: number | null;\n className: string;\n}\n\nexport function GlobalView({ comments, userId, className }: Props) {\n const { collectionLabels, globalLabels, queryContext } = useComments();\n const { data: documentTitles = {} } = useDocumentTitlesQuery(queryContext);\n const { code: locale } = useLocale();\n const groupedComments = groupCommentsGlobally(comments);\n\n return (\n <div className={className}>\n {groupedComments.map((entry) => {\n if (entry.type === \"collection\") {\n const { slug, docs } = entry;\n\n return (\n <CollapsibleGroup\n key={slug}\n groupKey={slug}\n label={resolveEntityLabel(collectionLabels[slug], locale, slug)}\n level=\"collection\">\n {[...docs.entries()].map(([docId, fields]) => {\n const title = documentTitles[slug]?.[String(docId)] ?? String(docId);\n const documentId = Number(docId);\n\n return (\n <CollapsibleGroup\n key={docId}\n groupKey={createCollapsibleGroupKey({ collectionSlug: slug, documentId })}\n label={title}\n level=\"document\">\n <FieldGroupSection fields={fields} userId={userId} collectionSlug={slug} documentId={documentId} />\n </CollapsibleGroup>\n );\n })}\n </CollapsibleGroup>\n );\n }\n\n const { slug, fields } = entry;\n\n return (\n <CollapsibleGroup\n key={slug}\n groupKey={slug}\n label={resolveEntityLabel(globalLabels[slug], locale, slug)}\n level=\"collection\">\n <FieldGroupSection fields={fields} userId={userId} globalSlug={slug} />\n </CollapsibleGroup>\n );\n })}\n </div>\n );\n}\n"],"mappings":";AA8CoB;AA5CpB,SAAS,iBAAiB;AAE1B,SAAS,mBAAmB;AAC5B,SAAS,8BAA8B;AACvC,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAQnC,SAAS,WAAW,EAAE,UAAU,QAAQ,UAAU,GAAU;AACjE,QAAM,EAAE,kBAAkB,cAAc,aAAa,IAAI,YAAY;AACrE,QAAM,EAAE,MAAM,iBAAiB,CAAC,EAAE,IAAI,uBAAuB,YAAY;AACzE,QAAM,EAAE,MAAM,OAAO,IAAI,UAAU;AACnC,QAAM,kBAAkB,sBAAsB,QAAQ;AAEtD,SACE,oBAAC,SAAI,WACF,0BAAgB,IAAI,CAAC,UAAU;AAC9B,QAAI,MAAM,SAAS,cAAc;AAC/B,YAAM,EAAE,MAAAA,OAAM,KAAK,IAAI;AAEvB,aACE;AAAA,QAAC;AAAA;AAAA,UAEC,UAAUA;AAAA,UACV,OAAO,mBAAmB,iBAAiBA,KAAI,GAAG,QAAQA,KAAI;AAAA,UAC9D,OAAM;AAAA,UACL,WAAC,GAAG,KAAK,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC,OAAOC,OAAM,MAAM;AAC5C,kBAAM,QAAQ,eAAeD,KAAI,IAAI,OAAO,KAAK,CAAC,KAAK,OAAO,KAAK;AACnE,kBAAM,aAAa,OAAO,KAAK;AAE/B,mBACE;AAAA,cAAC;AAAA;AAAA,gBAEC,UAAU,0BAA0B,EAAE,gBAAgBA,OAAM,WAAW,CAAC;AAAA,gBACxE,OAAO;AAAA,gBACP,OAAM;AAAA,gBACN,8BAAC,qBAAkB,QAAQC,SAAQ,QAAgB,gBAAgBD,OAAM,YAAwB;AAAA;AAAA,cAJ5F;AAAA,YAKP;AAAA,UAEJ,CAAC;AAAA;AAAA,QAjBIA;AAAA,MAkBP;AAAA,IAEJ;AAEA,UAAM,EAAE,MAAM,OAAO,IAAI;AAEzB,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,UAAU;AAAA,QACV,OAAO,mBAAmB,aAAa,IAAI,GAAG,QAAQ,IAAI;AAAA,QAC1D,OAAM;AAAA,QACN,8BAAC,qBAAkB,QAAgB,QAAgB,YAAY,MAAM;AAAA;AAAA,MAJhE;AAAA,IAKP;AAAA,EAEJ,CAAC,GACH;AAEJ;","names":["slug","fields"]}
1
+ {"version":3,"sources":["../../../../src/components/CommentsPanel/components/GlobalView.tsx"],"sourcesContent":["\"use client\";\n\nimport { useLocale, useTranslation } from \"@payloadcms/ui\";\nimport type { Comment } from \"../../../types/comment\";\nimport { useComments } from \"../../../providers/CommentsProvider\";\nimport { useCommentsFilter } from \"../../../providers/CommentsFilterProvider\";\nimport { useDocumentTitlesQuery } from \"../../../api/queries/useDocumentTitlesQuery\";\nimport { groupCommentsGlobally } from \"../utils/groupCommentsGlobally\";\nimport { resolveEntityLabel } from \"../utils/resolveEntityLabel\";\nimport { resolveEmptyCommentsMessageKey } from \"../utils/resolveEmptyCommentsMessageKey\";\nimport { CollapsibleGroup } from \"./CollapsibleGroup\";\nimport { FieldGroupSection } from \"./FieldGroupSection\";\nimport { createCollapsibleGroupKey } from \"../utils/createCollapsibleGroupKey\";\n\ninterface Props {\n comments: Comment[];\n userId: number | null;\n className: string;\n}\n\nexport function GlobalView({ comments, userId, className }: Props) {\n const { collectionLabels, globalLabels, queryContext } = useComments();\n const { filters } = useCommentsFilter();\n const { t } = useTranslation();\n const { data: documentTitles = {} } = useDocumentTitlesQuery(queryContext);\n const { code: locale } = useLocale();\n const groupedComments = groupCommentsGlobally(comments);\n\n return (\n <div className={className}>\n {groupedComments.length === 0 && (\n <div className=\"text-(--theme-elevation-450) text-[13px] text-center py-6 m-0\">\n {t(`comments:${resolveEmptyCommentsMessageKey(filters)}` as never)}\n </div>\n )}\n\n {groupedComments.map((entry) => {\n if (entry.type === \"collection\") {\n const { slug, docs } = entry;\n\n return (\n <CollapsibleGroup\n key={slug}\n groupKey={slug}\n label={resolveEntityLabel(collectionLabels[slug], locale, slug)}\n level=\"collection\">\n {[...docs.entries()].map(([docId, fields]) => {\n const title = documentTitles[slug]?.[String(docId)] ?? String(docId);\n const documentId = Number(docId);\n\n return (\n <CollapsibleGroup\n key={docId}\n groupKey={createCollapsibleGroupKey({ collectionSlug: slug, documentId })}\n label={title}\n level=\"document\">\n <FieldGroupSection fields={fields} userId={userId} collectionSlug={slug} documentId={documentId} />\n </CollapsibleGroup>\n );\n })}\n </CollapsibleGroup>\n );\n }\n\n const { slug, fields } = entry;\n\n return (\n <CollapsibleGroup\n key={slug}\n groupKey={slug}\n label={resolveEntityLabel(globalLabels[slug], locale, slug)}\n level=\"collection\">\n <FieldGroupSection fields={fields} userId={userId} globalSlug={slug} />\n </CollapsibleGroup>\n );\n })}\n </div>\n );\n}\n"],"mappings":";AA6BI,SAEI,KAFJ;AA3BJ,SAAS,WAAW,sBAAsB;AAE1C,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SAAS,sCAAsC;AAC/C,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAQnC,SAAS,WAAW,EAAE,UAAU,QAAQ,UAAU,GAAU;AACjE,QAAM,EAAE,kBAAkB,cAAc,aAAa,IAAI,YAAY;AACrE,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,MAAM,iBAAiB,CAAC,EAAE,IAAI,uBAAuB,YAAY;AACzE,QAAM,EAAE,MAAM,OAAO,IAAI,UAAU;AACnC,QAAM,kBAAkB,sBAAsB,QAAQ;AAEtD,SACE,qBAAC,SAAI,WACF;AAAA,oBAAgB,WAAW,KAC1B,oBAAC,SAAI,WAAU,iEACZ,YAAE,YAAY,+BAA+B,OAAO,CAAC,EAAW,GACnE;AAAA,IAGD,gBAAgB,IAAI,CAAC,UAAU;AAC9B,UAAI,MAAM,SAAS,cAAc;AAC/B,cAAM,EAAE,MAAAA,OAAM,KAAK,IAAI;AAEvB,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,UAAUA;AAAA,YACV,OAAO,mBAAmB,iBAAiBA,KAAI,GAAG,QAAQA,KAAI;AAAA,YAC9D,OAAM;AAAA,YACL,WAAC,GAAG,KAAK,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC,OAAOC,OAAM,MAAM;AAC5C,oBAAM,QAAQ,eAAeD,KAAI,IAAI,OAAO,KAAK,CAAC,KAAK,OAAO,KAAK;AACnE,oBAAM,aAAa,OAAO,KAAK;AAE/B,qBACE;AAAA,gBAAC;AAAA;AAAA,kBAEC,UAAU,0BAA0B,EAAE,gBAAgBA,OAAM,WAAW,CAAC;AAAA,kBACxE,OAAO;AAAA,kBACP,OAAM;AAAA,kBACN,8BAAC,qBAAkB,QAAQC,SAAQ,QAAgB,gBAAgBD,OAAM,YAAwB;AAAA;AAAA,gBAJ5F;AAAA,cAKP;AAAA,YAEJ,CAAC;AAAA;AAAA,UAjBIA;AAAA,QAkBP;AAAA,MAEJ;AAEA,YAAM,EAAE,MAAM,OAAO,IAAI;AAEzB,aACE;AAAA,QAAC;AAAA;AAAA,UAEC,UAAU;AAAA,UACV,OAAO,mBAAmB,aAAa,IAAI,GAAG,QAAQ,IAAI;AAAA,UAC1D,OAAM;AAAA,UACN,8BAAC,qBAAkB,QAAgB,QAAgB,YAAY,MAAM;AAAA;AAAA,QAJhE;AAAA,MAKP;AAAA,IAEJ,CAAC;AAAA,KACH;AAEJ;","names":["slug","fields"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CommentsPanel/index.tsx"],"names":[],"mappings":"AAYA,UAAU,KAAK;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,kBAAmB,KAAK,4CA8BjD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CommentsPanel/index.tsx"],"names":[],"mappings":"AAcA,UAAU,KAAK;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,kBAAmB,KAAK,4CAgCjD,CAAC"}
@@ -9,14 +9,18 @@ import { GlobalView } from "./components/GlobalView";
9
9
  import { GlobalDocumentView } from "./components/GlobalDocumentView";
10
10
  import { useScrollToTargetFieldGroup } from "./hooks/useScrollToTargetFieldGroup";
11
11
  import { filterCommentsByLocale } from "../../utils/comment/filterCommentsByLocale";
12
+ import { applyCommentFilters } from "../../utils/comment/applyCommentFilters";
13
+ import { useCommentsFilter } from "../../providers/CommentsFilterProvider";
12
14
  const CommentsPanel = ({ className }) => {
13
15
  const { user } = useAuth();
14
16
  const { t } = useTranslation();
15
17
  const { code: currentLocale } = useLocale();
18
+ const { filters } = useCommentsFilter();
16
19
  const { mode, queryContext } = useComments();
17
20
  const { data: allComments = [], isLoading } = useCommentsQuery(queryContext);
18
21
  const userId = user?.id ?? null;
19
- const visibleComments = filterCommentsByLocale(allComments, currentLocale);
22
+ const localeFilteredComments = filterCommentsByLocale(allComments, currentLocale);
23
+ const visibleComments = applyCommentFilters(localeFilteredComments, filters, userId);
20
24
  useScrollToTargetFieldGroup();
21
25
  if (isLoading && allComments.length === 0) {
22
26
  return /* @__PURE__ */ jsx("div", { className: cn(className, "text-(--theme-elevation-450) text-[13px] text-center py-6 m-0"), children: t("comments:loadingComments") });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CommentsPanel/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { useAuth, useLocale, useTranslation } from \"@payloadcms/ui\";\nimport { cn } from \"../../utils/general/cn\";\nimport { useComments } from \"../../providers/CommentsProvider\";\nimport { useCommentsQuery } from \"../../api/queries/useCommentsQuery\";\nimport { DocumentView } from \"./components/DocumentView\";\nimport { GlobalView } from \"./components/GlobalView\";\nimport { GlobalDocumentView } from \"./components/GlobalDocumentView\";\nimport { useScrollToTargetFieldGroup } from \"./hooks/useScrollToTargetFieldGroup\";\nimport { filterCommentsByLocale } from \"../../utils/comment/filterCommentsByLocale\";\n\ninterface Props {\n className: string;\n}\n\nexport const CommentsPanel = ({ className }: Props) => {\n const { user } = useAuth();\n const { t } = useTranslation();\n const { code: currentLocale } = useLocale();\n\n const { mode, queryContext } = useComments();\n const { data: allComments = [], isLoading } = useCommentsQuery(queryContext);\n\n const userId = (user?.id as number) ?? null;\n const visibleComments = filterCommentsByLocale(allComments, currentLocale);\n\n useScrollToTargetFieldGroup();\n\n if (isLoading && allComments.length === 0) {\n return (\n <div className={cn(className, \"text-(--theme-elevation-450) text-[13px] text-center py-6 m-0\")}>\n {t(\"comments:loadingComments\" as never)}\n </div>\n );\n }\n\n if (mode === \"document\") {\n return <DocumentView comments={visibleComments} userId={userId} className={cn(className)} />;\n }\n\n if (mode === \"global-document\") {\n return <GlobalDocumentView comments={visibleComments} userId={userId} className={cn(className)} />;\n }\n\n return <GlobalView comments={visibleComments} userId={userId} className={cn(className)} />;\n};\n"],"mappings":";AA+BM;AA7BN,SAAS,SAAS,WAAW,sBAAsB;AACnD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,mCAAmC;AAC5C,SAAS,8BAA8B;AAMhC,MAAM,gBAAgB,CAAC,EAAE,UAAU,MAAa;AACrD,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,MAAM,cAAc,IAAI,UAAU;AAE1C,QAAM,EAAE,MAAM,aAAa,IAAI,YAAY;AAC3C,QAAM,EAAE,MAAM,cAAc,CAAC,GAAG,UAAU,IAAI,iBAAiB,YAAY;AAE3E,QAAM,SAAU,MAAM,MAAiB;AACvC,QAAM,kBAAkB,uBAAuB,aAAa,aAAa;AAEzE,8BAA4B;AAE5B,MAAI,aAAa,YAAY,WAAW,GAAG;AACzC,WACE,oBAAC,SAAI,WAAW,GAAG,WAAW,+DAA+D,GAC1F,YAAE,0BAAmC,GACxC;AAAA,EAEJ;AAEA,MAAI,SAAS,YAAY;AACvB,WAAO,oBAAC,gBAAa,UAAU,iBAAiB,QAAgB,WAAW,GAAG,SAAS,GAAG;AAAA,EAC5F;AAEA,MAAI,SAAS,mBAAmB;AAC9B,WAAO,oBAAC,sBAAmB,UAAU,iBAAiB,QAAgB,WAAW,GAAG,SAAS,GAAG;AAAA,EAClG;AAEA,SAAO,oBAAC,cAAW,UAAU,iBAAiB,QAAgB,WAAW,GAAG,SAAS,GAAG;AAC1F;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/CommentsPanel/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { useAuth, useLocale, useTranslation } from \"@payloadcms/ui\";\nimport { cn } from \"../../utils/general/cn\";\nimport { useComments } from \"../../providers/CommentsProvider\";\nimport { useCommentsQuery } from \"../../api/queries/useCommentsQuery\";\nimport { DocumentView } from \"./components/DocumentView\";\nimport { GlobalView } from \"./components/GlobalView\";\nimport { GlobalDocumentView } from \"./components/GlobalDocumentView\";\nimport { useScrollToTargetFieldGroup } from \"./hooks/useScrollToTargetFieldGroup\";\nimport { filterCommentsByLocale } from \"../../utils/comment/filterCommentsByLocale\";\nimport { applyCommentFilters } from \"../../utils/comment/applyCommentFilters\";\nimport { useCommentsFilter } from \"../../providers/CommentsFilterProvider\";\n\ninterface Props {\n className: string;\n}\n\nexport const CommentsPanel = ({ className }: Props) => {\n const { user } = useAuth();\n const { t } = useTranslation();\n const { code: currentLocale } = useLocale();\n const { filters } = useCommentsFilter();\n\n const { mode, queryContext } = useComments();\n const { data: allComments = [], isLoading } = useCommentsQuery(queryContext);\n\n const userId = (user?.id as number) ?? null;\n const localeFilteredComments = filterCommentsByLocale(allComments, currentLocale);\n const visibleComments = applyCommentFilters(localeFilteredComments, filters, userId);\n\n useScrollToTargetFieldGroup();\n\n if (isLoading && allComments.length === 0) {\n return (\n <div className={cn(className, \"text-(--theme-elevation-450) text-[13px] text-center py-6 m-0\")}>\n {t(\"comments:loadingComments\" as never)}\n </div>\n );\n }\n\n if (mode === \"document\") {\n return <DocumentView comments={visibleComments} userId={userId} className={cn(className)} />;\n }\n\n if (mode === \"global-document\") {\n return <GlobalDocumentView comments={visibleComments} userId={userId} className={cn(className)} />;\n }\n\n return <GlobalView comments={visibleComments} userId={userId} className={cn(className)} />;\n};\n"],"mappings":";AAmCM;AAjCN,SAAS,SAAS,WAAW,sBAAsB;AACnD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,mCAAmC;AAC5C,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAM3B,MAAM,gBAAgB,CAAC,EAAE,UAAU,MAAa;AACrD,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,MAAM,cAAc,IAAI,UAAU;AAC1C,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AAEtC,QAAM,EAAE,MAAM,aAAa,IAAI,YAAY;AAC3C,QAAM,EAAE,MAAM,cAAc,CAAC,GAAG,UAAU,IAAI,iBAAiB,YAAY;AAE3E,QAAM,SAAU,MAAM,MAAiB;AACvC,QAAM,yBAAyB,uBAAuB,aAAa,aAAa;AAChF,QAAM,kBAAkB,oBAAoB,wBAAwB,SAAS,MAAM;AAEnF,8BAA4B;AAE5B,MAAI,aAAa,YAAY,WAAW,GAAG;AACzC,WACE,oBAAC,SAAI,WAAW,GAAG,WAAW,+DAA+D,GAC1F,YAAE,0BAAmC,GACxC;AAAA,EAEJ;AAEA,MAAI,SAAS,YAAY;AACvB,WAAO,oBAAC,gBAAa,UAAU,iBAAiB,QAAgB,WAAW,GAAG,SAAS,GAAG;AAAA,EAC5F;AAEA,MAAI,SAAS,mBAAmB;AAC9B,WAAO,oBAAC,sBAAmB,UAAU,iBAAiB,QAAgB,WAAW,GAAG,SAAS,GAAG;AAAA,EAClG;AAEA,SAAO,oBAAC,cAAW,UAAU,iBAAiB,QAAgB,WAAW,GAAG,SAAS,GAAG;AAC1F;","names":[]}
@@ -0,0 +1,5 @@
1
+ import type { CommentsFilters } from "../../../types/filters";
2
+ type EmptyCommentsMessageKey = "noComments" | "noOpenComments" | "noCommentsInMyThreads" | "noOpenCommentsInMyThreads";
3
+ export declare function resolveEmptyCommentsMessageKey(filters: CommentsFilters): EmptyCommentsMessageKey;
4
+ export {};
5
+ //# sourceMappingURL=resolveEmptyCommentsMessageKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveEmptyCommentsMessageKey.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/utils/resolveEmptyCommentsMessageKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,KAAK,uBAAuB,GAAG,YAAY,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,2BAA2B,CAAC;AAEvH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,eAAe,GAAG,uBAAuB,CAMhG"}
@@ -0,0 +1,10 @@
1
+ function resolveEmptyCommentsMessageKey(filters) {
2
+ if (!filters.showResolved && filters.onlyMyThreads) return "noOpenCommentsInMyThreads";
3
+ if (!filters.showResolved) return "noOpenComments";
4
+ if (filters.onlyMyThreads) return "noCommentsInMyThreads";
5
+ return "noComments";
6
+ }
7
+ export {
8
+ resolveEmptyCommentsMessageKey
9
+ };
10
+ //# sourceMappingURL=resolveEmptyCommentsMessageKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/CommentsPanel/utils/resolveEmptyCommentsMessageKey.ts"],"sourcesContent":["import type { CommentsFilters } from \"../../../types/filters\";\n\ntype EmptyCommentsMessageKey = \"noComments\" | \"noOpenComments\" | \"noCommentsInMyThreads\" | \"noOpenCommentsInMyThreads\";\n\nexport function resolveEmptyCommentsMessageKey(filters: CommentsFilters): EmptyCommentsMessageKey {\n if (!filters.showResolved && filters.onlyMyThreads) return \"noOpenCommentsInMyThreads\";\n if (!filters.showResolved) return \"noOpenComments\";\n if (filters.onlyMyThreads) return \"noCommentsInMyThreads\";\n\n return \"noComments\";\n}\n"],"mappings":"AAIO,SAAS,+BAA+B,SAAmD;AAChG,MAAI,CAAC,QAAQ,gBAAgB,QAAQ,cAAe,QAAO;AAC3D,MAAI,CAAC,QAAQ,aAAc,QAAO;AAClC,MAAI,QAAQ,cAAe,QAAO;AAElC,SAAO;AACT;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FieldCommentLabel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAYrC,UAAU,KAAM,SAAQ,qBAAqB;IAC3C,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,GAAG;QACtC,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH;AAED,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,kDAsE3E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FieldCommentLabel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAcrC,UAAU,KAAM,SAAQ,qBAAqB;IAC3C,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,GAAG;QACtC,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH;AAED,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,kDA2E3E"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useTranslation, useLocale } from "@payloadcms/ui";
3
+ import { useTranslation, useLocale, useAuth } from "@payloadcms/ui";
4
4
  import { MessageSquareIcon, MessageSquarePlus } from "lucide-react";
5
5
  import { useComments } from "../../providers/CommentsProvider";
6
6
  import { resolveLabel } from "./utils/resolveLabel";
@@ -13,18 +13,24 @@ import { resolveFieldLabel } from "../CommentsPanel/utils/resolveFieldLabel";
13
13
  import { useCommentsQuery } from "../../api/queries/useCommentsQuery";
14
14
  import { useFieldLabelsQuery } from "../../api/queries/useFieldLabelsQuery";
15
15
  import { filterCommentsByLocale } from "../../utils/comment/filterCommentsByLocale";
16
+ import { applyCommentFilters } from "../../utils/comment/applyCommentFilters";
17
+ import { useCommentsFilter } from "../../providers/CommentsFilterProvider";
16
18
  function FieldCommentLabel({ field, htmlFor, path: fieldPath }) {
17
19
  const { label, required } = field;
18
20
  const { t } = useTranslation();
19
21
  const { code: locale } = useLocale();
22
+ const { user } = useAuth();
20
23
  const { openForField } = useCommentsDrawer();
21
24
  const { mode, queryContext, collectionSlug, documentId, globalSlug } = useComments();
22
25
  const { data: allComments = [] } = useCommentsQuery(queryContext);
23
26
  const { data: fieldLabelRegistry } = useFieldLabelsQuery(queryContext);
27
+ const { filters } = useCommentsFilter();
24
28
  const resolvedLabel = resolveLabel(label, locale);
25
29
  const stablePath = useStablePath(fieldPath ?? "");
30
+ const userId = user?.id ?? null;
26
31
  const localeFiltered = filterCommentsByLocale(allComments, locale);
27
- const fieldComments = excludeComments(localeFiltered, stablePath || void 0, locale);
32
+ const visibleComments = applyCommentFilters(localeFiltered, filters, userId);
33
+ const fieldComments = excludeComments(visibleComments, stablePath || void 0, locale);
28
34
  const openCommentsCount = fieldComments.length;
29
35
  const clientBreadcrumb = useFieldBreadcrumb(fieldPath, resolvedLabel, collectionSlug, globalSlug);
30
36
  const handleOpenDrawer = () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/FieldCommentLabel/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { useTranslation, useLocale } from \"@payloadcms/ui\";\nimport { MessageSquareIcon, MessageSquarePlus } from \"lucide-react\";\nimport { useComments } from \"../../providers/CommentsProvider\";\nimport type { FieldLabelClientProps } from \"payload\";\nimport type { Label } from \"./types\";\nimport { resolveLabel } from \"./utils/resolveLabel\";\nimport { excludeComments } from \"./utils/exludeComments\";\nimport { useStablePath } from \"./hooks/useStablePath\";\nimport { useFieldBreadcrumb } from \"./hooks/useFieldBreadcrumb\";\nimport { useCommentsDrawer } from \"../../providers/CommentsDrawerProvider\";\nimport { IconButton } from \"../IconButton\";\nimport { resolveFieldLabel } from \"../CommentsPanel/utils/resolveFieldLabel\";\nimport { useCommentsQuery } from \"../../api/queries/useCommentsQuery\";\nimport { useFieldLabelsQuery } from \"../../api/queries/useFieldLabelsQuery\";\nimport { filterCommentsByLocale } from \"../../utils/comment/filterCommentsByLocale\";\n\ninterface Props extends FieldLabelClientProps {\n field: FieldLabelClientProps[\"field\"] & {\n label?: Label;\n required?: boolean;\n };\n}\n\nexport function FieldCommentLabel({ field, htmlFor, path: fieldPath }: Props) {\n const { label, required } = field;\n\n const { t } = useTranslation();\n const { code: locale } = useLocale();\n\n const { openForField } = useCommentsDrawer();\n const { mode, queryContext, collectionSlug, documentId, globalSlug } = useComments();\n const { data: allComments = [] } = useCommentsQuery(queryContext);\n const { data: fieldLabelRegistry } = useFieldLabelsQuery(queryContext);\n\n const resolvedLabel = resolveLabel(label, locale);\n const stablePath = useStablePath(fieldPath ?? \"\");\n\n const localeFiltered = filterCommentsByLocale(allComments, locale);\n const fieldComments = excludeComments(localeFiltered, stablePath || undefined, locale);\n const openCommentsCount = fieldComments.length;\n\n const clientBreadcrumb = useFieldBreadcrumb(fieldPath, resolvedLabel, collectionSlug, globalSlug);\n\n const handleOpenDrawer = () => {\n if (!stablePath) return;\n\n const serverLabel = resolveFieldLabel({\n registry: fieldLabelRegistry ?? {},\n collectionSlug: collectionSlug ?? undefined,\n documentId: documentId ?? undefined,\n globalSlug: globalSlug ?? undefined,\n fieldPath: stablePath,\n });\n\n openForField(stablePath, serverLabel !== stablePath ? serverLabel : clientBreadcrumb);\n };\n\n if (!resolvedLabel) return null;\n\n return (\n <div className=\"flex items-center gap-1.5 pb-1.25 group\">\n <label className=\"field-label p-0\" htmlFor={htmlFor}>\n {resolvedLabel}\n\n {required && <span className=\"required\">*</span>}\n </label>\n\n {fieldPath && (mode === \"document\" || mode === \"global-document\") && (\n <div className=\"relative flex items-center\">\n {!!openCommentsCount && (\n <IconButton\n className=\"w-auto px-1 gap-1 text-[12px] font-semibold leading-none\"\n size=\"sm\"\n title={t(\"comments:openComments\" as never, { count: openCommentsCount })}\n onClick={handleOpenDrawer}>\n <MessageSquareIcon size={14} />\n\n {openCommentsCount}\n </IconButton>\n )}\n {!openCommentsCount && (\n <IconButton\n className={\"opacity-0 group-hover:opacity-100 [@media(hover:none)]:opacity-100 transition-opacity\"}\n size=\"sm\"\n title={t(\"comments:add\" as never)}\n onClick={handleOpenDrawer}>\n <MessageSquarePlus size={14} />\n </IconButton>\n )}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AA+DM,SAGe,KAHf;AA7DN,SAAS,gBAAgB,iBAAiB;AAC1C,SAAS,mBAAmB,yBAAyB;AACrD,SAAS,mBAAmB;AAG5B,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AAShC,SAAS,kBAAkB,EAAE,OAAO,SAAS,MAAM,UAAU,GAAU;AAC5E,QAAM,EAAE,OAAO,SAAS,IAAI;AAE5B,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,MAAM,OAAO,IAAI,UAAU;AAEnC,QAAM,EAAE,aAAa,IAAI,kBAAkB;AAC3C,QAAM,EAAE,MAAM,cAAc,gBAAgB,YAAY,WAAW,IAAI,YAAY;AACnF,QAAM,EAAE,MAAM,cAAc,CAAC,EAAE,IAAI,iBAAiB,YAAY;AAChE,QAAM,EAAE,MAAM,mBAAmB,IAAI,oBAAoB,YAAY;AAErE,QAAM,gBAAgB,aAAa,OAAO,MAAM;AAChD,QAAM,aAAa,cAAc,aAAa,EAAE;AAEhD,QAAM,iBAAiB,uBAAuB,aAAa,MAAM;AACjE,QAAM,gBAAgB,gBAAgB,gBAAgB,cAAc,QAAW,MAAM;AACrF,QAAM,oBAAoB,cAAc;AAExC,QAAM,mBAAmB,mBAAmB,WAAW,eAAe,gBAAgB,UAAU;AAEhG,QAAM,mBAAmB,MAAM;AAC7B,QAAI,CAAC,WAAY;AAEjB,UAAM,cAAc,kBAAkB;AAAA,MACpC,UAAU,sBAAsB,CAAC;AAAA,MACjC,gBAAgB,kBAAkB;AAAA,MAClC,YAAY,cAAc;AAAA,MAC1B,YAAY,cAAc;AAAA,MAC1B,WAAW;AAAA,IACb,CAAC;AAED,iBAAa,YAAY,gBAAgB,aAAa,cAAc,gBAAgB;AAAA,EACtF;AAEA,MAAI,CAAC,cAAe,QAAO;AAE3B,SACE,qBAAC,SAAI,WAAU,2CACb;AAAA,yBAAC,WAAM,WAAU,mBAAkB,SAChC;AAAA;AAAA,MAEA,YAAY,oBAAC,UAAK,WAAU,YAAW,eAAC;AAAA,OAC3C;AAAA,IAEC,cAAc,SAAS,cAAc,SAAS,sBAC7C,qBAAC,SAAI,WAAU,8BACZ;AAAA,OAAC,CAAC,qBACD;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,MAAK;AAAA,UACL,OAAO,EAAE,yBAAkC,EAAE,OAAO,kBAAkB,CAAC;AAAA,UACvE,SAAS;AAAA,UACT;AAAA,gCAAC,qBAAkB,MAAM,IAAI;AAAA,YAE5B;AAAA;AAAA;AAAA,MACH;AAAA,MAED,CAAC,qBACA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,UACX,MAAK;AAAA,UACL,OAAO,EAAE,cAAuB;AAAA,UAChC,SAAS;AAAA,UACT,8BAAC,qBAAkB,MAAM,IAAI;AAAA;AAAA,MAC/B;AAAA,OAEJ;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/FieldCommentLabel/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { useTranslation, useLocale, useAuth } from \"@payloadcms/ui\";\nimport { MessageSquareIcon, MessageSquarePlus } from \"lucide-react\";\nimport { useComments } from \"../../providers/CommentsProvider\";\nimport type { FieldLabelClientProps } from \"payload\";\nimport type { Label } from \"./types\";\nimport { resolveLabel } from \"./utils/resolveLabel\";\nimport { excludeComments } from \"./utils/exludeComments\";\nimport { useStablePath } from \"./hooks/useStablePath\";\nimport { useFieldBreadcrumb } from \"./hooks/useFieldBreadcrumb\";\nimport { useCommentsDrawer } from \"../../providers/CommentsDrawerProvider\";\nimport { IconButton } from \"../IconButton\";\nimport { resolveFieldLabel } from \"../CommentsPanel/utils/resolveFieldLabel\";\nimport { useCommentsQuery } from \"../../api/queries/useCommentsQuery\";\nimport { useFieldLabelsQuery } from \"../../api/queries/useFieldLabelsQuery\";\nimport { filterCommentsByLocale } from \"../../utils/comment/filterCommentsByLocale\";\nimport { applyCommentFilters } from \"../../utils/comment/applyCommentFilters\";\nimport { useCommentsFilter } from \"../../providers/CommentsFilterProvider\";\n\ninterface Props extends FieldLabelClientProps {\n field: FieldLabelClientProps[\"field\"] & {\n label?: Label;\n required?: boolean;\n };\n}\n\nexport function FieldCommentLabel({ field, htmlFor, path: fieldPath }: Props) {\n const { label, required } = field;\n\n const { t } = useTranslation();\n const { code: locale } = useLocale();\n const { user } = useAuth();\n\n const { openForField } = useCommentsDrawer();\n const { mode, queryContext, collectionSlug, documentId, globalSlug } = useComments();\n const { data: allComments = [] } = useCommentsQuery(queryContext);\n const { data: fieldLabelRegistry } = useFieldLabelsQuery(queryContext);\n const { filters } = useCommentsFilter();\n\n const resolvedLabel = resolveLabel(label, locale);\n const stablePath = useStablePath(fieldPath ?? \"\");\n\n const userId = (user?.id as number) ?? null;\n\n const localeFiltered = filterCommentsByLocale(allComments, locale);\n const visibleComments = applyCommentFilters(localeFiltered, filters, userId);\n const fieldComments = excludeComments(visibleComments, stablePath || undefined, locale);\n const openCommentsCount = fieldComments.length;\n\n const clientBreadcrumb = useFieldBreadcrumb(fieldPath, resolvedLabel, collectionSlug, globalSlug);\n\n const handleOpenDrawer = () => {\n if (!stablePath) return;\n\n const serverLabel = resolveFieldLabel({\n registry: fieldLabelRegistry ?? {},\n collectionSlug: collectionSlug ?? undefined,\n documentId: documentId ?? undefined,\n globalSlug: globalSlug ?? undefined,\n fieldPath: stablePath,\n });\n\n openForField(stablePath, serverLabel !== stablePath ? serverLabel : clientBreadcrumb);\n };\n\n if (!resolvedLabel) return null;\n\n return (\n <div className=\"flex items-center gap-1.5 pb-1.25 group\">\n <label className=\"field-label p-0\" htmlFor={htmlFor}>\n {resolvedLabel}\n\n {required && <span className=\"required\">*</span>}\n </label>\n\n {fieldPath && (mode === \"document\" || mode === \"global-document\") && (\n <div className=\"relative flex items-center\">\n {!!openCommentsCount && (\n <IconButton\n className=\"w-auto px-1 gap-1 text-[12px] font-semibold leading-none\"\n size=\"sm\"\n title={t(\"comments:openComments\" as never, { count: openCommentsCount })}\n onClick={handleOpenDrawer}>\n <MessageSquareIcon size={14} />\n\n {openCommentsCount}\n </IconButton>\n )}\n {!openCommentsCount && (\n <IconButton\n className={\"opacity-0 group-hover:opacity-100 [@media(hover:none)]:opacity-100 transition-opacity\"}\n size=\"sm\"\n title={t(\"comments:add\" as never)}\n onClick={handleOpenDrawer}>\n <MessageSquarePlus size={14} />\n </IconButton>\n )}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAsEM,SAGe,KAHf;AApEN,SAAS,gBAAgB,WAAW,eAAe;AACnD,SAAS,mBAAmB,yBAAyB;AACrD,SAAS,mBAAmB;AAG5B,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAS3B,SAAS,kBAAkB,EAAE,OAAO,SAAS,MAAM,UAAU,GAAU;AAC5E,QAAM,EAAE,OAAO,SAAS,IAAI;AAE5B,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,MAAM,OAAO,IAAI,UAAU;AACnC,QAAM,EAAE,KAAK,IAAI,QAAQ;AAEzB,QAAM,EAAE,aAAa,IAAI,kBAAkB;AAC3C,QAAM,EAAE,MAAM,cAAc,gBAAgB,YAAY,WAAW,IAAI,YAAY;AACnF,QAAM,EAAE,MAAM,cAAc,CAAC,EAAE,IAAI,iBAAiB,YAAY;AAChE,QAAM,EAAE,MAAM,mBAAmB,IAAI,oBAAoB,YAAY;AACrE,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AAEtC,QAAM,gBAAgB,aAAa,OAAO,MAAM;AAChD,QAAM,aAAa,cAAc,aAAa,EAAE;AAEhD,QAAM,SAAU,MAAM,MAAiB;AAEvC,QAAM,iBAAiB,uBAAuB,aAAa,MAAM;AACjE,QAAM,kBAAkB,oBAAoB,gBAAgB,SAAS,MAAM;AAC3E,QAAM,gBAAgB,gBAAgB,iBAAiB,cAAc,QAAW,MAAM;AACtF,QAAM,oBAAoB,cAAc;AAExC,QAAM,mBAAmB,mBAAmB,WAAW,eAAe,gBAAgB,UAAU;AAEhG,QAAM,mBAAmB,MAAM;AAC7B,QAAI,CAAC,WAAY;AAEjB,UAAM,cAAc,kBAAkB;AAAA,MACpC,UAAU,sBAAsB,CAAC;AAAA,MACjC,gBAAgB,kBAAkB;AAAA,MAClC,YAAY,cAAc;AAAA,MAC1B,YAAY,cAAc;AAAA,MAC1B,WAAW;AAAA,IACb,CAAC;AAED,iBAAa,YAAY,gBAAgB,aAAa,cAAc,gBAAgB;AAAA,EACtF;AAEA,MAAI,CAAC,cAAe,QAAO;AAE3B,SACE,qBAAC,SAAI,WAAU,2CACb;AAAA,yBAAC,WAAM,WAAU,mBAAkB,SAChC;AAAA;AAAA,MAEA,YAAY,oBAAC,UAAK,WAAU,YAAW,eAAC;AAAA,OAC3C;AAAA,IAEC,cAAc,SAAS,cAAc,SAAS,sBAC7C,qBAAC,SAAI,WAAU,8BACZ;AAAA,OAAC,CAAC,qBACD;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,MAAK;AAAA,UACL,OAAO,EAAE,yBAAkC,EAAE,OAAO,kBAAkB,CAAC;AAAA,UACvE,SAAS;AAAA,UACT;AAAA,gCAAC,qBAAkB,MAAM,IAAI;AAAA,YAE5B;AAAA;AAAA;AAAA,MACH;AAAA,MAED,CAAC,qBACA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,UACX,MAAK;AAAA,UACL,OAAO,EAAE,cAAuB;AAAA,UAChC,SAAS;AAAA,UACT,8BAAC,qBAAkB,MAAM,IAAI;AAAA;AAAA,MAC/B;AAAA,OAEJ;AAAA,KAEJ;AAEJ;","names":[]}
@@ -4,9 +4,10 @@ interface Props extends React.HTMLAttributes<HTMLButtonElement> {
4
4
  children: React.ReactNode;
5
5
  variant?: "neutral" | "neutralSecondary" | "primary";
6
6
  size?: "sm" | "md";
7
- onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
7
+ isActive?: boolean;
8
8
  tabIndex?: number;
9
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
9
10
  }
10
- export declare function IconButton({ className, title, children, variant, size, onClick, tabIndex, ...nativeButtonProps }: Props): import("react/jsx-runtime").JSX.Element;
11
+ export declare function IconButton({ className, title, children, variant, size, isActive, tabIndex, onClick, ...nativeButtonProps }: Props): import("react/jsx-runtime").JSX.Element;
11
12
  export {};
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/index.tsx"],"names":[],"mappings":"AAsBA,UAAU,KAAM,SAAQ,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACrD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,GAAG,iBAAiB,EACrB,EAAE,KAAK,2CAaP"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/index.tsx"],"names":[],"mappings":"AA4CA,UAAU,KAAM,SAAQ,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACrD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CAC5D;AAED,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,GAAG,iBAAiB,EACrB,EAAE,KAAK,2CAaP"}
@@ -11,11 +11,33 @@ const variants = cva("flex justify-center items-center p-0 rounded border-none t
11
11
  size: {
12
12
  sm: "w-[20px] h-[20px]",
13
13
  md: "w-[24px] h-[24px]"
14
+ },
15
+ isActive: {
16
+ true: "",
17
+ false: ""
14
18
  }
15
19
  },
20
+ compoundVariants: [
21
+ {
22
+ variant: "neutral",
23
+ isActive: true,
24
+ class: "text-(--theme-text)"
25
+ },
26
+ {
27
+ variant: "neutralSecondary",
28
+ isActive: true,
29
+ class: "text-(--theme-text)"
30
+ },
31
+ {
32
+ variant: "primary",
33
+ isActive: true,
34
+ class: "bg-(--theme-elevation-800)"
35
+ }
36
+ ],
16
37
  defaultVariants: {
17
38
  variant: "neutral",
18
- size: "md"
39
+ size: "md",
40
+ isActive: false
19
41
  }
20
42
  });
21
43
  function IconButton({
@@ -24,14 +46,15 @@ function IconButton({
24
46
  children,
25
47
  variant,
26
48
  size,
27
- onClick,
49
+ isActive,
28
50
  tabIndex,
51
+ onClick,
29
52
  ...nativeButtonProps
30
53
  }) {
31
54
  return /* @__PURE__ */ jsx(
32
55
  "button",
33
56
  {
34
- className: cn(variants({ variant, size }), className),
57
+ className: cn(variants({ variant, size, isActive }), className),
35
58
  type: "button",
36
59
  title,
37
60
  "aria-label": title,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/IconButton/index.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport { cn } from \"../../utils/general/cn\";\n\nconst variants = cva(\"flex justify-center items-center p-0 rounded border-none transition-colors cursor-pointer\", {\n variants: {\n variant: {\n neutral: \"bg-transparent hover:bg-(--theme-elevation-50) text-(--theme-elevation-450) hover:text-(--theme-text)\",\n neutralSecondary:\n \"bg-(--theme-elevation-100) hover:bg-(--theme-elevation-150) text-(--theme-elevation-600) hover:text-(--theme-text)\",\n primary: \"bg-(--theme-elevation-1000) hover:bg-(--theme-elevation-800) text-(--theme-elevation-0)\",\n },\n size: {\n sm: \"w-[20px] h-[20px]\",\n md: \"w-[24px] h-[24px]\",\n },\n },\n defaultVariants: {\n variant: \"neutral\",\n size: \"md\",\n },\n});\n\ninterface Props extends React.HTMLAttributes<HTMLButtonElement> {\n className?: string;\n title?: string;\n children: React.ReactNode;\n variant?: \"neutral\" | \"neutralSecondary\" | \"primary\";\n size?: \"sm\" | \"md\";\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n tabIndex?: number;\n}\n\nexport function IconButton({\n className,\n title,\n children,\n variant,\n size,\n onClick,\n tabIndex,\n ...nativeButtonProps\n}: Props) {\n return (\n <button\n className={cn(variants({ variant, size }), className)}\n type=\"button\"\n title={title}\n aria-label={title}\n onClick={onClick}\n tabIndex={tabIndex}\n {...nativeButtonProps}>\n {children}\n </button>\n );\n}\n"],"mappings":"AA2CI;AA3CJ,SAAS,WAAW;AACpB,SAAS,UAAU;AAEnB,MAAM,WAAW,IAAI,6FAA6F;AAAA,EAChH,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,kBACE;AAAA,MACF,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;AAYM,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAU;AACR,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,SAAS,EAAE,SAAS,KAAK,CAAC,GAAG,SAAS;AAAA,MACpD,MAAK;AAAA,MACL;AAAA,MACA,cAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MACH;AAAA;AAAA,EACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/IconButton/index.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport { cn } from \"../../utils/general/cn\";\n\nconst variants = cva(\"flex justify-center items-center p-0 rounded border-none transition-colors cursor-pointer\", {\n variants: {\n variant: {\n neutral: \"bg-transparent hover:bg-(--theme-elevation-50) text-(--theme-elevation-450) hover:text-(--theme-text)\",\n neutralSecondary:\n \"bg-(--theme-elevation-100) hover:bg-(--theme-elevation-150) text-(--theme-elevation-600) hover:text-(--theme-text)\",\n primary: \"bg-(--theme-elevation-1000) hover:bg-(--theme-elevation-800) text-(--theme-elevation-0)\",\n },\n size: {\n sm: \"w-[20px] h-[20px]\",\n md: \"w-[24px] h-[24px]\",\n },\n isActive: {\n true: \"\",\n false: \"\",\n },\n },\n compoundVariants: [\n {\n variant: \"neutral\",\n isActive: true,\n class: \"text-(--theme-text)\",\n },\n {\n variant: \"neutralSecondary\",\n isActive: true,\n class: \"text-(--theme-text)\",\n },\n {\n variant: \"primary\",\n isActive: true,\n class: \"bg-(--theme-elevation-800)\",\n },\n ],\n defaultVariants: {\n variant: \"neutral\",\n size: \"md\",\n isActive: false,\n },\n});\n\ninterface Props extends React.HTMLAttributes<HTMLButtonElement> {\n className?: string;\n title?: string;\n children: React.ReactNode;\n variant?: \"neutral\" | \"neutralSecondary\" | \"primary\";\n size?: \"sm\" | \"md\";\n isActive?: boolean;\n tabIndex?: number;\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport function IconButton({\n className,\n title,\n children,\n variant,\n size,\n isActive,\n tabIndex,\n onClick,\n ...nativeButtonProps\n}: Props) {\n return (\n <button\n className={cn(variants({ variant, size, isActive }), className)}\n type=\"button\"\n title={title}\n aria-label={title}\n onClick={onClick}\n tabIndex={tabIndex}\n {...nativeButtonProps}>\n {children}\n </button>\n );\n}\n"],"mappings":"AAmEI;AAnEJ,SAAS,WAAW;AACpB,SAAS,UAAU;AAEnB,MAAM,WAAW,IAAI,6FAA6F;AAAA,EAChH,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,kBACE;AAAA,MACF,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,IAChB;AAAA,MACE,SAAS;AAAA,MACT,UAAU;AAAA,MACV,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,SAAS;AAAA,MACT,UAAU;AAAA,MACV,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,SAAS;AAAA,MACT,UAAU;AAAA,MACV,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF,CAAC;AAaM,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAU;AACR,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,SAAS,EAAE,SAAS,MAAM,SAAS,CAAC,GAAG,SAAS;AAAA,MAC9D,MAAK;AAAA,MACL;AAAA,MACA,cAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MACH;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from "react";
2
+ import type { CommentsFilters } from "../../types/filters";
3
+ interface CommentsFilterContextProps {
4
+ filters: CommentsFilters;
5
+ isAnyFilterActive: boolean;
6
+ setFilter: (key: keyof CommentsFilters, value: boolean) => void;
7
+ }
8
+ interface Props {
9
+ children: ReactNode;
10
+ }
11
+ export declare function CommentsFilterProvider({ children }: Props): import("react/jsx-runtime").JSX.Element;
12
+ export declare function useCommentsFilter(): CommentsFilterContextProps;
13
+ export {};
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/CommentsFilterProvider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,UAAU,0BAA0B;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,eAAe,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACjE;AAID,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAiBzD;AAED,wBAAgB,iBAAiB,+BAMhC"}
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext, useMemo, useState } from "react";
4
+ const CommentsFilterContext = createContext(null);
5
+ function CommentsFilterProvider({ children }) {
6
+ const [filters, setFilters] = useState({
7
+ showResolved: true,
8
+ onlyMyThreads: true
9
+ });
10
+ const setFilter = (key, value) => {
11
+ setFilters((prev) => ({ ...prev, [key]: value }));
12
+ };
13
+ const isAnyFilterActive = useMemo(() => filters.showResolved || filters.onlyMyThreads, [filters]);
14
+ return /* @__PURE__ */ jsx(CommentsFilterContext.Provider, { value: { filters, isAnyFilterActive, setFilter }, children });
15
+ }
16
+ function useCommentsFilter() {
17
+ const context = useContext(CommentsFilterContext);
18
+ if (!context) throw new Error("useCommentsFilter must be used within CommentsFilterProvider");
19
+ return context;
20
+ }
21
+ export {
22
+ CommentsFilterProvider,
23
+ useCommentsFilter
24
+ };
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/providers/CommentsFilterProvider/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, type ReactNode, useContext, useMemo, useState } from \"react\";\nimport type { CommentsFilters } from \"../../types/filters\";\n\ninterface CommentsFilterContextProps {\n filters: CommentsFilters;\n isAnyFilterActive: boolean;\n setFilter: (key: keyof CommentsFilters, value: boolean) => void;\n}\n\nconst CommentsFilterContext = createContext<CommentsFilterContextProps | null>(null);\n\ninterface Props {\n children: ReactNode;\n}\n\nexport function CommentsFilterProvider({ children }: Props) {\n const [filters, setFilters] = useState<CommentsFilters>({\n showResolved: true,\n onlyMyThreads: true,\n });\n\n const setFilter = (key: keyof CommentsFilters, value: boolean) => {\n setFilters((prev) => ({ ...prev, [key]: value }));\n };\n\n const isAnyFilterActive = useMemo(() => filters.showResolved || filters.onlyMyThreads, [filters]);\n\n return (\n <CommentsFilterContext.Provider value={{ filters, isAnyFilterActive, setFilter }}>\n {children}\n </CommentsFilterContext.Provider>\n );\n}\n\nexport function useCommentsFilter() {\n const context = useContext(CommentsFilterContext);\n\n if (!context) throw new Error(\"useCommentsFilter must be used within CommentsFilterProvider\");\n\n return context;\n}\n"],"mappings":";AA8BI;AA5BJ,SAAS,eAA+B,YAAY,SAAS,gBAAgB;AAS7E,MAAM,wBAAwB,cAAiD,IAAI;AAM5E,SAAS,uBAAuB,EAAE,SAAS,GAAU;AAC1D,QAAM,CAAC,SAAS,UAAU,IAAI,SAA0B;AAAA,IACtD,cAAc;AAAA,IACd,eAAe;AAAA,EACjB,CAAC;AAED,QAAM,YAAY,CAAC,KAA4B,UAAmB;AAChE,eAAW,CAAC,UAAU,EAAE,GAAG,MAAM,CAAC,GAAG,GAAG,MAAM,EAAE;AAAA,EAClD;AAEA,QAAM,oBAAoB,QAAQ,MAAM,QAAQ,gBAAgB,QAAQ,eAAe,CAAC,OAAO,CAAC;AAEhG,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,SAAS,mBAAmB,UAAU,GAC5E,UACH;AAEJ;AAEO,SAAS,oBAAoB;AAClC,QAAM,UAAU,WAAW,qBAAqB;AAEhD,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,8DAA8D;AAE5F,SAAO;AACT;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAOjD,OAAO,kBAAkB,CAAC;AAE1B,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAuB1D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAQjD,OAAO,kBAAkB,CAAC;AAE1B,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,2CA2B1D"}
@@ -4,6 +4,7 @@ import { useState } from "react";
4
4
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
5
5
  import { useConfig } from "@payloadcms/ui";
6
6
  import { CommentsDrawerProvider } from "../CommentsDrawerProvider";
7
+ import { CommentsFilterProvider } from "../CommentsFilterProvider";
7
8
  import { CommentsProvider } from "../CommentsProvider";
8
9
  import "../../styles.css";
9
10
  function CommentsProviderWrapper({ children }) {
@@ -19,7 +20,7 @@ function CommentsProviderWrapper({ children }) {
19
20
  const pluginConfig = config.admin?.custom?.commentsPlugin;
20
21
  const usernameFieldRawPath = pluginConfig?.usernameFieldPath;
21
22
  const usernameFieldPath = usernameFieldRawPath === "" ? void 0 : usernameFieldRawPath;
22
- return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(CommentsProvider, { usernameFieldPath, children: /* @__PURE__ */ jsx(CommentsDrawerProvider, { children }) }) });
23
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(CommentsProvider, { usernameFieldPath, children: /* @__PURE__ */ jsx(CommentsDrawerProvider, { children: /* @__PURE__ */ jsx(CommentsFilterProvider, { children }) }) }) });
23
24
  }
24
25
  export {
25
26
  CommentsProviderWrapper
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { useConfig } from \"@payloadcms/ui\";\nimport { CommentsDrawerProvider } from \"../CommentsDrawerProvider\";\nimport { CommentsProvider } from \"../CommentsProvider\";\nimport type { CommentsPluginConfigStorage } from \"../../types\";\n\nimport \"../../styles.css\";\n\ninterface Props {\n children: ReactNode;\n}\n\nexport function CommentsProviderWrapper({ children }: Props) {\n const { config } = useConfig();\n const [queryClient] = useState(\n () =>\n new QueryClient({\n defaultOptions: {\n queries: { retry: 1 },\n mutations: { retry: 0 },\n },\n }),\n );\n\n const pluginConfig = config.admin?.custom?.commentsPlugin as CommentsPluginConfigStorage | undefined;\n const usernameFieldRawPath = pluginConfig?.usernameFieldPath;\n const usernameFieldPath = usernameFieldRawPath === \"\" ? undefined : usernameFieldRawPath;\n\n return (\n <QueryClientProvider client={queryClient}>\n <CommentsProvider usernameFieldPath={usernameFieldPath}>\n <CommentsDrawerProvider>{children}</CommentsDrawerProvider>\n </CommentsProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AAkCQ;AAhCR,SAAS,gBAAgC;AACzC,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AAGjC,OAAO;AAMA,SAAS,wBAAwB,EAAE,SAAS,GAAU;AAC3D,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,MACE,IAAI,YAAY;AAAA,MACd,gBAAgB;AAAA,QACd,SAAS,EAAE,OAAO,EAAE;AAAA,QACpB,WAAW,EAAE,OAAO,EAAE;AAAA,MACxB;AAAA,IACF,CAAC;AAAA,EACL;AAEA,QAAM,eAAe,OAAO,OAAO,QAAQ;AAC3C,QAAM,uBAAuB,cAAc;AAC3C,QAAM,oBAAoB,yBAAyB,KAAK,SAAY;AAEpE,SACE,oBAAC,uBAAoB,QAAQ,aAC3B,8BAAC,oBAAiB,mBAChB,8BAAC,0BAAwB,UAAS,GACpC,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { useConfig } from \"@payloadcms/ui\";\nimport { CommentsDrawerProvider } from \"../CommentsDrawerProvider\";\nimport { CommentsFilterProvider } from \"../CommentsFilterProvider\";\nimport { CommentsProvider } from \"../CommentsProvider\";\nimport type { CommentsPluginConfigStorage } from \"../../types\";\n\nimport \"../../styles.css\";\n\ninterface Props {\n children: ReactNode;\n}\n\nexport function CommentsProviderWrapper({ children }: Props) {\n const { config } = useConfig();\n const [queryClient] = useState(\n () =>\n new QueryClient({\n defaultOptions: {\n queries: { retry: 1 },\n mutations: { retry: 0 },\n },\n }),\n );\n\n const pluginConfig = config.admin?.custom?.commentsPlugin as CommentsPluginConfigStorage | undefined;\n const usernameFieldRawPath = pluginConfig?.usernameFieldPath;\n const usernameFieldPath = usernameFieldRawPath === \"\" ? undefined : usernameFieldRawPath;\n\n return (\n <QueryClientProvider client={queryClient}>\n <CommentsProvider usernameFieldPath={usernameFieldPath}>\n <CommentsDrawerProvider>\n <CommentsFilterProvider>\n {children}\n </CommentsFilterProvider>\n </CommentsDrawerProvider>\n </CommentsProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AAoCU;AAlCV,SAAS,gBAAgC;AACzC,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;AACvC,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AAGjC,OAAO;AAMA,SAAS,wBAAwB,EAAE,SAAS,GAAU;AAC3D,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,MACE,IAAI,YAAY;AAAA,MACd,gBAAgB;AAAA,QACd,SAAS,EAAE,OAAO,EAAE;AAAA,QACpB,WAAW,EAAE,OAAO,EAAE;AAAA,MACxB;AAAA,IACF,CAAC;AAAA,EACL;AAEA,QAAM,eAAe,OAAO,OAAO,QAAQ;AAC3C,QAAM,uBAAuB,cAAc;AAC3C,QAAM,oBAAoB,yBAAyB,KAAK,SAAY;AAEpE,SACE,oBAAC,uBAAoB,QAAQ,aAC3B,8BAAC,oBAAiB,mBAChB,8BAAC,0BACC,8BAAC,0BACE,UACH,GACF,GACF,GACF;AAEJ;","names":[]}
package/dist/styles.css CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-content:""}}}:root,:host{--color-green-500:oklch(72.3% .219 149.579);--color-black:#000;--spacing:.25rem;--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-normal:1.5;--radius-sm:.25rem;--radius-md:.375rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.right-3{right:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-29{z-index:29}.m-0{margin:calc(var(--spacing) * 0)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.hidden{display:none}.h-4{height:calc(var(--spacing) * 4)}.h-9{height:calc(var(--spacing) * 9)}.h-\[20px\]{height:20px}.h-\[24px\]{height:24px}.h-px{height:1px}.max-h-32{max-height:calc(var(--spacing) * 32)}.min-h-5{min-height:calc(var(--spacing) * 5)}.w-4{width:calc(var(--spacing) * 4)}.w-9{width:calc(var(--spacing) * 9)}.w-\[20px\]{width:20px}.w-\[24px\]{width:24px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-150{max-width:calc(var(--spacing) * 150)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-rotate-90{rotate:-90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\(--theme-elevation-100\){border-color:var(--theme-elevation-100)}.border-transparent{border-color:#0000}.bg-\(--theme-bg\){background-color:var(--theme-bg)}.bg-\(--theme-elevation-0\){background-color:var(--theme-elevation-0)}.bg-\(--theme-elevation-100\){background-color:var(--theme-elevation-100)}.bg-\(--theme-elevation-150\){background-color:var(--theme-elevation-150)}.bg-\(--theme-elevation-1000\){background-color:var(--theme-elevation-1000)}.bg-\[\#36c5f021\]{background-color:#36c5f021}.bg-\[\#f0be3621\]{background-color:#f0be3621}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-current{background-color:currentColor}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pb-1\.25{padding-bottom:calc(var(--spacing) * 1.25)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.wrap-break-word{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-\(--theme-elevation-0\){color:var(--theme-elevation-0)}.text-\(--theme-elevation-450\){color:var(--theme-elevation-450)}.text-\(--theme-elevation-500\){color:var(--theme-elevation-500)}.text-\(--theme-elevation-600\){color:var(--theme-elevation-600)}.text-\(--theme-text\){color:var(--theme-text)}.text-\[\#1264a3\]{color:#1264a3}.text-\[\#a36e12\]{color:#a36e12}.text-green-500{color:var(--color-green-500)}.opacity-0{opacity:0}.opacity-60{opacity:.6}.shadow-\[0_-2px_16px_-2px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 -2px 16px -2px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.group-focus-within\:flex:is(:where(.group):focus-within *){display:flex}@media (hover:hover){.group-hover\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.focus-within\:border-\(--theme-elevation-150\):focus-within{border-color:var(--theme-elevation-150)}@media (hover:hover){.hover\:bg-\(--theme-elevation-50\):hover{background-color:var(--theme-elevation-50)}.hover\:bg-\(--theme-elevation-150\):hover{background-color:var(--theme-elevation-150)}.hover\:bg-\(--theme-elevation-800\):hover{background-color:var(--theme-elevation-800)}.hover\:text-\(--theme-text\):hover{color:var(--theme-text)}}@media (prefers-reduced-motion:reduce){.motion-reduce\:transition-none{transition-property:none}}.\[\&\.is-empty\]\:before\:pointer-events-none.is-empty:before{content:var(--tw-content);pointer-events:none}.\[\&\.is-empty\]\:before\:absolute.is-empty:before{content:var(--tw-content);position:absolute}.\[\&\.is-empty\]\:before\:text-\(--theme-elevation-450\).is-empty:before{content:var(--tw-content);color:var(--theme-elevation-450)}.\[\&\.is-empty\]\:before\:content-\[attr\(data-placeholder\)\].is-empty:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}@media (hover:none){.\[\@media\(hover\:none\)\]\:opacity-100{opacity:1}}.comments-drawer .gutter{padding:0 20px!important}.comments-drawer .drawer__content{--gutter-h:1px}.comments-drawer .drawer__blur-bg{display:none}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-content:""}}}:root,:host{--color-green-500:oklch(72.3% .219 149.579);--color-black:#000;--spacing:.25rem;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-normal:1.5;--radius-sm:.25rem;--radius-md:.375rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.right-3{right:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-29{z-index:29}.z-50{z-index:50}.m-0{margin:calc(var(--spacing) * 0)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.hidden{display:none}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-9{height:calc(var(--spacing) * 9)}.h-\[20px\]{height:20px}.h-\[24px\]{height:24px}.h-px{height:1px}.max-h-32{max-height:calc(var(--spacing) * 32)}.min-h-5{min-height:calc(var(--spacing) * 5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-9{width:calc(var(--spacing) * 9)}.w-\[20px\]{width:20px}.w-\[24px\]{width:24px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-150{max-width:calc(var(--spacing) * 150)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-55{min-width:calc(var(--spacing) * 55)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-rotate-90{rotate:-90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\(--theme-border-color\){border-color:var(--theme-border-color)}.border-\(--theme-elevation-100\){border-color:var(--theme-elevation-100)}.border-transparent{border-color:#0000}.bg-\(--theme-bg\){background-color:var(--theme-bg)}.bg-\(--theme-elevation-0\){background-color:var(--theme-elevation-0)}.bg-\(--theme-elevation-100\){background-color:var(--theme-elevation-100)}.bg-\(--theme-elevation-150\){background-color:var(--theme-elevation-150)}.bg-\(--theme-elevation-800\){background-color:var(--theme-elevation-800)}.bg-\(--theme-elevation-1000\){background-color:var(--theme-elevation-1000)}.bg-\[\#36c5f021\]{background-color:#36c5f021}.bg-\[\#f0be3621\]{background-color:#f0be3621}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-current{background-color:currentColor}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pb-1\.25{padding-bottom:calc(var(--spacing) * 1.25)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-7{padding-left:calc(var(--spacing) * 7)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.wrap-break-word{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-\(--theme-elevation-0\){color:var(--theme-elevation-0)}.text-\(--theme-elevation-450\){color:var(--theme-elevation-450)}.text-\(--theme-elevation-500\){color:var(--theme-elevation-500)}.text-\(--theme-elevation-600\){color:var(--theme-elevation-600)}.text-\(--theme-text\){color:var(--theme-text)}.text-\[\#1264a3\]{color:#1264a3}.text-\[\#a36e12\]{color:#a36e12}.text-green-500{color:var(--color-green-500)}.opacity-0{opacity:0}.opacity-60{opacity:.6}.shadow-\[0_-2px_16px_-2px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 -2px 16px -2px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.group-focus-within\:flex:is(:where(.group):focus-within *){display:flex}@media (hover:hover){.group-hover\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.focus-within\:border-\(--theme-elevation-150\):focus-within{border-color:var(--theme-elevation-150)}@media (hover:hover){.hover\:bg-\(--theme-elevation-50\):hover{background-color:var(--theme-elevation-50)}.hover\:bg-\(--theme-elevation-100\):hover{background-color:var(--theme-elevation-100)}.hover\:bg-\(--theme-elevation-150\):hover{background-color:var(--theme-elevation-150)}.hover\:bg-\(--theme-elevation-800\):hover{background-color:var(--theme-elevation-800)}.hover\:text-\(--theme-text\):hover{color:var(--theme-text)}}.data-highlighted\:bg-\(--theme-elevation-100\)[data-highlighted]{background-color:var(--theme-elevation-100)}@media (prefers-reduced-motion:reduce){.motion-reduce\:transition-none{transition-property:none}}.\[\&\.is-empty\]\:before\:pointer-events-none.is-empty:before{content:var(--tw-content);pointer-events:none}.\[\&\.is-empty\]\:before\:absolute.is-empty:before{content:var(--tw-content);position:absolute}.\[\&\.is-empty\]\:before\:text-\(--theme-elevation-450\).is-empty:before{content:var(--tw-content);color:var(--theme-elevation-450)}.\[\&\.is-empty\]\:before\:content-\[attr\(data-placeholder\)\].is-empty:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}@media (hover:none){.\[\@media\(hover\:none\)\]\:opacity-100{opacity:1}}.comments-drawer .gutter{padding:0 20px!important}.comments-drawer .drawer__content{--gutter-h:1px}.comments-drawer .drawer__blur-bg{display:none}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/translations/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,EAAE,EAAE;IAAE,QAAQ,EAAE,oBAAoB,CAAA;CA2BhD,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/translations/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,EAAE,EAAE;IAAE,QAAQ,EAAE,oBAAoB,CAAA;CA2ChD,CAAC"}
@@ -23,7 +23,23 @@ const en = {
23
23
  unknownAuthor: "Unknown",
24
24
  deletedUser: "Deleted user",
25
25
  noMentionMatches: "No matches",
26
- loadingComments: "Loading comments\u2026"
26
+ loadingComments: "Loading comments\u2026",
27
+ filters: "Filters",
28
+ filterComments: "Filter comments",
29
+ showResolved: "Show resolved comments",
30
+ onlyMyThreads: "Only my threads",
31
+ commentResolved: "Comment resolved",
32
+ noComments: "No comments yet",
33
+ noOpenComments: "No open comments",
34
+ noCommentsInMyThreads: "No comments in your threads",
35
+ noOpenCommentsInMyThreads: "No open comments in your threads",
36
+ deleteComment: {
37
+ heading: "Confirm deletion",
38
+ body: "Are you sure you want to delete this comment?",
39
+ confirm: "Delete",
40
+ confirming: "Deleting\u2026",
41
+ cancel: "Cancel"
42
+ }
27
43
  }
28
44
  };
29
45
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/translations/en.ts"],"sourcesContent":["import type { CommentsTranslations } from \"./types\";\n\nexport const en: { comments: CommentsTranslations } = {\n comments: {\n label: \"Comments\",\n openComments_one: \"{{count}} open comment\",\n openComments_other: \"{{count}} open comments\",\n add: \"Add comment\",\n writeComment: \"Write a comment\",\n comment: \"Comment\",\n cancel: \"Cancel\",\n posting: \"Posting…\",\n resolve: \"Resolve\",\n reopen: \"Reopen\",\n resolved: \"Resolved\",\n delete: \"Delete\",\n general: \"General\",\n close: \"Close\",\n syncingComments: \"Syncing comments\",\n openCommentsAria: \"Open comments\",\n failedToPost: \"Failed to post comment\",\n failedToUpdate: \"Failed to update comment\",\n failedToDelete: \"Failed to delete comment\",\n failedToAdd: \"Failed to add comment\",\n unknownAuthor: \"Unknown\",\n deletedUser: \"Deleted user\",\n noMentionMatches: \"No matches\",\n loadingComments: \"Loading comments…\",\n },\n};\n"],"mappings":"AAEO,MAAM,KAAyC;AAAA,EACpD,UAAU;AAAA,IACR,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,oBAAoB;AAAA,IACpB,KAAK;AAAA,IACL,cAAc;AAAA,IACd,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,EACnB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/translations/en.ts"],"sourcesContent":["import type { CommentsTranslations } from \"./types\";\n\nexport const en: { comments: CommentsTranslations } = {\n comments: {\n label: \"Comments\",\n openComments_one: \"{{count}} open comment\",\n openComments_other: \"{{count}} open comments\",\n add: \"Add comment\",\n writeComment: \"Write a comment\",\n comment: \"Comment\",\n cancel: \"Cancel\",\n posting: \"Posting…\",\n resolve: \"Resolve\",\n reopen: \"Reopen\",\n resolved: \"Resolved\",\n delete: \"Delete\",\n general: \"General\",\n close: \"Close\",\n syncingComments: \"Syncing comments\",\n openCommentsAria: \"Open comments\",\n failedToPost: \"Failed to post comment\",\n failedToUpdate: \"Failed to update comment\",\n failedToDelete: \"Failed to delete comment\",\n failedToAdd: \"Failed to add comment\",\n unknownAuthor: \"Unknown\",\n deletedUser: \"Deleted user\",\n noMentionMatches: \"No matches\",\n loadingComments: \"Loading comments…\",\n filters: \"Filters\",\n filterComments: \"Filter comments\",\n showResolved: \"Show resolved comments\",\n onlyMyThreads: \"Only my threads\",\n commentResolved: \"Comment resolved\",\n noComments: \"No comments yet\",\n noOpenComments: \"No open comments\",\n noCommentsInMyThreads: \"No comments in your threads\",\n noOpenCommentsInMyThreads: \"No open comments in your threads\",\n deleteComment: {\n heading: \"Confirm deletion\",\n body: \"Are you sure you want to delete this comment?\",\n confirm: \"Delete\",\n confirming: \"Deleting…\",\n cancel: \"Cancel\",\n },\n },\n};\n"],"mappings":"AAEO,MAAM,KAAyC;AAAA,EACpD,UAAU;AAAA,IACR,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,oBAAoB;AAAA,IACpB,KAAK;AAAA,IACL,cAAc;AAAA,IACd,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,uBAAuB;AAAA,IACvB,2BAA2B;AAAA,IAC3B,eAAe;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,QAAQ;AAAA,IACV;AAAA,EACF;AACF;","names":[]}
@@ -23,6 +23,22 @@ export interface CommentsTranslations {
23
23
  deletedUser: string;
24
24
  noMentionMatches: string;
25
25
  loadingComments: string;
26
+ filters: string;
27
+ filterComments: string;
28
+ showResolved: string;
29
+ onlyMyThreads: string;
30
+ commentResolved: string;
31
+ noComments: string;
32
+ noOpenComments: string;
33
+ noCommentsInMyThreads: string;
34
+ noOpenCommentsInMyThreads: string;
35
+ deleteComment: {
36
+ heading: string;
37
+ body: string;
38
+ confirm: string;
39
+ confirming: string;
40
+ cancel: string;
41
+ };
26
42
  }
27
43
  export type Translations = Record<string, Partial<CommentsTranslations>>;
28
44
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/translations/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/translations/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,CAAC;IAClC,aAAa,EAAE;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface CommentsFilters {
2
+ showResolved: boolean;
3
+ onlyMyThreads: boolean;
4
+ }
5
+ //# sourceMappingURL=filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/types/filters.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CACxB"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,4 @@
1
+ import type { Comment } from "../../types";
2
+ import type { CommentsFilters } from "../../types/filters";
3
+ export declare function applyCommentFilters(comments: Comment[], filters: CommentsFilters, userId: number | null): Comment[];
4
+ //# sourceMappingURL=applyCommentFilters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyCommentFilters.d.ts","sourceRoot":"","sources":["../../../src/utils/comment/applyCommentFilters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAM3D,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,aAevG"}
@@ -0,0 +1,19 @@
1
+ function resolveId(value) {
2
+ return typeof value === "number" ? value : value.id;
3
+ }
4
+ function applyCommentFilters(comments, filters, userId) {
5
+ return comments.filter((comment) => {
6
+ if (!filters.showResolved && comment.isResolved) return false;
7
+ if (filters.onlyMyThreads && userId !== null) {
8
+ const authorId = resolveId(comment.author);
9
+ if (authorId === userId) return true;
10
+ const mentionIds = (comment.mentions ?? []).map((m) => resolveId(m.user));
11
+ return mentionIds.includes(userId);
12
+ }
13
+ return true;
14
+ });
15
+ }
16
+ export {
17
+ applyCommentFilters
18
+ };
19
+ //# sourceMappingURL=applyCommentFilters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/comment/applyCommentFilters.ts"],"sourcesContent":["import type { Comment } from \"../../types\";\nimport type { CommentsFilters } from \"../../types/filters\";\n\nfunction resolveId(value: number | { id: number }): number {\n return typeof value === \"number\" ? value : value.id;\n}\n\nexport function applyCommentFilters(comments: Comment[], filters: CommentsFilters, userId: number | null) {\n return comments.filter((comment) => {\n if (!filters.showResolved && comment.isResolved) return false;\n\n if (filters.onlyMyThreads && userId !== null) {\n const authorId = resolveId(comment.author as number | { id: number });\n if (authorId === userId) return true;\n\n const mentionIds = (comment.mentions ?? []).map((m) => resolveId(m.user as number | { id: number }));\n\n return mentionIds.includes(userId);\n }\n\n return true;\n });\n}\n"],"mappings":"AAGA,SAAS,UAAU,OAAwC;AACzD,SAAO,OAAO,UAAU,WAAW,QAAQ,MAAM;AACnD;AAEO,SAAS,oBAAoB,UAAqB,SAA0B,QAAuB;AACxG,SAAO,SAAS,OAAO,CAAC,YAAY;AAClC,QAAI,CAAC,QAAQ,gBAAgB,QAAQ,WAAY,QAAO;AAExD,QAAI,QAAQ,iBAAiB,WAAW,MAAM;AAC5C,YAAM,WAAW,UAAU,QAAQ,MAAiC;AACpE,UAAI,aAAa,OAAQ,QAAO;AAEhC,YAAM,cAAc,QAAQ,YAAY,CAAC,GAAG,IAAI,CAAC,MAAM,UAAU,EAAE,IAA+B,CAAC;AAEnG,aAAO,WAAW,SAAS,MAAM;AAAA,IACnC;AAEA,WAAO;AAAA,EACT,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@focus-reactive/payload-plugin-comments",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "license": "MIT",
5
5
  "author": "FocusReactive <ship@focusreactive.com>",
6
6
  "keywords": [
@@ -59,6 +59,7 @@
59
59
  "format:check": "prettier --check src/"
60
60
  },
61
61
  "dependencies": {
62
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
62
63
  "@tanstack/react-query": "^5.0.0",
63
64
  "class-variance-authority": "^0.7.1",
64
65
  "clsx": "^2.1.1",