@vicacha-devs/strapi-plugin-notes 0.0.0-stage → 1.1.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 (66) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +20 -2
  3. package/dist/admin/NotesHomePage-CIWSOu3n.js +457 -0
  4. package/dist/admin/NotesHomePage-Da5Eu2o9.cjs +475 -0
  5. package/dist/admin/ar-NJ-XJhAU.cjs +64 -0
  6. package/dist/admin/ar-uSBvoP4-.js +64 -0
  7. package/dist/admin/de-DlFY4yCr.js +64 -0
  8. package/dist/admin/de-d-M42GQs.cjs +64 -0
  9. package/dist/admin/en-C8MGI5Fp.cjs +64 -0
  10. package/dist/admin/en-DQUtJt3K.js +64 -0
  11. package/dist/admin/es-BZY_kUPd.cjs +64 -0
  12. package/dist/admin/es-DcTVGahO.js +64 -0
  13. package/dist/admin/fr-D6Ism7Y3.cjs +64 -0
  14. package/dist/admin/fr-QW7vMjBs.js +64 -0
  15. package/dist/admin/index-BD0jLH1y.cjs +1458 -0
  16. package/dist/admin/index-ClQtejgN.js +1442 -0
  17. package/dist/admin/index.cjs +4 -0
  18. package/dist/admin/index.js +4 -0
  19. package/dist/admin/index.mjs +4 -0
  20. package/dist/admin/it-DyBVYzjD.cjs +64 -0
  21. package/dist/admin/it-F24NTVne.js +64 -0
  22. package/dist/admin/pt-B4OG4ZiY.js +64 -0
  23. package/dist/admin/pt-BOHJueLP.cjs +64 -0
  24. package/dist/admin/ru-DGiT4YZI.js +64 -0
  25. package/dist/admin/ru-DhigZM8k.cjs +64 -0
  26. package/dist/admin/src/components/DeleteNoteDialog.d.ts +10 -0
  27. package/dist/admin/src/components/Initializer.d.ts +5 -0
  28. package/dist/admin/src/components/NoteListItem.d.ts +10 -0
  29. package/dist/admin/src/components/NoteModal.d.ts +18 -0
  30. package/dist/admin/src/components/NotesHubFilterBar.d.ts +14 -0
  31. package/dist/admin/src/components/NotesSidePanel.d.ts +13 -0
  32. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  33. package/dist/admin/src/hooks/useNotes.d.ts +12 -0
  34. package/dist/admin/src/index.d.ts +21 -0
  35. package/dist/admin/src/pages/NotesHomePage.d.ts +3 -0
  36. package/dist/admin/src/pluginId.d.ts +4 -0
  37. package/dist/admin/src/utils/getTrad.d.ts +2 -0
  38. package/dist/admin/src/utils/index.d.ts +1 -0
  39. package/dist/admin/tr-CNFZeutu.cjs +64 -0
  40. package/dist/admin/tr-CwzORNP2.js +64 -0
  41. package/dist/admin/zh-BriU4KiK.cjs +64 -0
  42. package/dist/admin/zh-C1EjzGrj.js +64 -0
  43. package/dist/package.json +3 -0
  44. package/dist/server/index.cjs +1212 -0
  45. package/dist/server/index.js +1212 -0
  46. package/dist/server/index.mjs +1212 -0
  47. package/dist/server/src/bootstrap.d.ts +5 -0
  48. package/dist/server/src/config/index.d.ts +8 -0
  49. package/dist/server/src/content-types/index.d.ts +70 -0
  50. package/dist/server/src/content-types/note/schema.json.d.ts +68 -0
  51. package/dist/server/src/controllers/index.d.ts +2 -0
  52. package/dist/server/src/controllers/notesController.d.ts +27 -0
  53. package/dist/server/src/destroy.d.ts +5 -0
  54. package/dist/server/src/index.d.ts +2 -0
  55. package/dist/server/src/register.d.ts +5 -0
  56. package/dist/server/src/routes/admin.d.ts +17 -0
  57. package/dist/server/src/routes/content-api.d.ts +12 -0
  58. package/dist/server/src/routes/index.d.ts +30 -0
  59. package/dist/server/src/services/index.d.ts +2 -0
  60. package/dist/server/src/services/notesQueryHelpers.d.ts +11 -0
  61. package/dist/server/src/services/notesService.d.ts +25 -0
  62. package/dist/shared/index.cjs +525 -0
  63. package/dist/shared/index.d.ts +1 -0
  64. package/dist/shared/index.js +525 -0
  65. package/dist/shared/index.mjs +525 -0
  66. package/package.json +102 -3
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 ComfortablyCoding
4
+ Copyright (c) 2026 Vicacha Devs
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,21 @@
1
- # Temporary Holding Version
1
+ # `@vicacha-devs/strapi-plugin-notes`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A Strapi v5 plugin (forked and modernized from [`strapi-community/strapi-plugin-notes`](https://github.com/strapi-community/strapi-plugin-notes)) that enables editorial teams to attach rich, categorized, and pinned notes to any Content Manager entry and browse all notes from a centralized Admin Hub.
4
+
5
+ ## Key Features
6
+
7
+ 1. **Note Modal Meta Information ([Issue #18](https://github.com/strapi-community/strapi-plugin-notes/issues/18))**:
8
+ - Displays a Strapi **Audit Logs**-style 2×2 metadata panel (`Created At`, `Created By`, `Updated At`, `Updated By`) inside `NoteModal` when viewing or editing an existing note.
9
+ - Automatically tracks `createdBy` and `updatedBy` on the server from `ctx.state.user`, with safe fallback display names if an admin user is later removed and strict PII sanitization.
10
+ 2. **Pinned & Color/Category Badges**:
11
+ - Pin critical notes so they stay at the top of the Content Manager side panel (`isPinned DESC, createdAt DESC`).
12
+ - Classify notes with color-coded category badges (`General`, `Todo`, `Blocker`, `Idea`).
13
+ 3. **Strapi v5 Document & Locale Scoping**:
14
+ - Binds notes to Strapi v5's stable `documentId` (`entityDocumentId`) alongside legacy `entityId` and `entitySlug`, ensuring notes remain attached across Draft/Publish cycles.
15
+ - Optional per-locale scoping (`entityLocale`) so editors can attach notes either to all locales of a document or to the currently active i18n locale.
16
+ 4. **Content Manager Side Panel UX Polish**:
17
+ - Quick search & category filtering inside the Content Manager side panel.
18
+ - Compact author and date subtitle on each note item.
19
+ - Delete confirmation dialog to prevent accidental one-click note deletion.
20
+ 5. **Global Notes Hub**:
21
+ - Dedicated **Notes** page in the Strapi Admin navigation with KPI summary cards, search/filter controls across content types, categories, and pinned status, plus one-click deep links straight into the target Content Manager entry.
@@ -0,0 +1,457 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Flex, Grid, Box, Typography, Field, TextInput, SingleSelect, SingleSelectOption, Checkbox, Main, Button, Loader, EmptyStateLayout, Table, Thead, Tr, Th, Tbody, Td, Badge, IconButton } from "@strapi/design-system";
3
+ import { ExternalLink, Pin, Pencil, Trash } from "@strapi/icons";
4
+ import { Layouts } from "@strapi/strapi/admin";
5
+ import * as React from "react";
6
+ import { useIntl } from "react-intl";
7
+ import { useNavigate } from "react-router-dom";
8
+ import { N as NOTE_CATEGORIES, a as NOTE_CATEGORY_META, g as getTrad, u as useNotes, f as filterNotesList, b as NoteModal, D as DeleteNoteDialog, c as buildContentManagerNoteLink, d as formatNoteAuthorDisplay, e as formatNoteTimestamp } from "./index-ClQtejgN.js";
9
+ const NotesHubFilterBar = ({
10
+ summary,
11
+ search,
12
+ selectedCategory,
13
+ selectedSlug,
14
+ pinnedOnly,
15
+ onSearchChange,
16
+ onCategoryChange,
17
+ onSlugChange,
18
+ onPinnedOnlyChange
19
+ }) => {
20
+ const { formatMessage } = useIntl();
21
+ const t = (id, defaultMessage) => formatMessage({ id: getTrad(id), defaultMessage });
22
+ return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
23
+ /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
24
+ /* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsx(
25
+ Box,
26
+ {
27
+ padding: 4,
28
+ background: "neutral0",
29
+ hasRadius: true,
30
+ shadow: "tableShadow",
31
+ style: { width: "100%" },
32
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
33
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("hub.stats.total", "Total Notes") }),
34
+ /* @__PURE__ */ jsx(
35
+ Typography,
36
+ {
37
+ variant: "alpha",
38
+ fontWeight: "bold",
39
+ textColor: "neutral800",
40
+ children: summary.total
41
+ }
42
+ )
43
+ ] })
44
+ }
45
+ ) }),
46
+ /* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsx(
47
+ Box,
48
+ {
49
+ padding: 4,
50
+ background: "neutral0",
51
+ hasRadius: true,
52
+ shadow: "tableShadow",
53
+ style: { width: "100%" },
54
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
55
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "primary600", children: t("hub.stats.pinned", "Pinned Notes") }),
56
+ /* @__PURE__ */ jsx(
57
+ Typography,
58
+ {
59
+ variant: "alpha",
60
+ fontWeight: "bold",
61
+ textColor: "primary700",
62
+ children: summary.pinned
63
+ }
64
+ )
65
+ ] })
66
+ }
67
+ ) }),
68
+ /* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsx(
69
+ Box,
70
+ {
71
+ padding: 4,
72
+ background: "neutral0",
73
+ hasRadius: true,
74
+ shadow: "tableShadow",
75
+ style: { width: "100%" },
76
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
77
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "danger600", children: t("hub.stats.blockers", "Blockers") }),
78
+ /* @__PURE__ */ jsx(
79
+ Typography,
80
+ {
81
+ variant: "alpha",
82
+ fontWeight: "bold",
83
+ textColor: "danger700",
84
+ children: summary.byCategory.blocker
85
+ }
86
+ )
87
+ ] })
88
+ }
89
+ ) }),
90
+ /* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsx(
91
+ Box,
92
+ {
93
+ padding: 4,
94
+ background: "neutral0",
95
+ hasRadius: true,
96
+ shadow: "tableShadow",
97
+ style: { width: "100%" },
98
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
99
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("hub.stats.todos", "Open Todos") }),
100
+ /* @__PURE__ */ jsx(
101
+ Typography,
102
+ {
103
+ variant: "alpha",
104
+ fontWeight: "bold",
105
+ textColor: "neutral800",
106
+ children: summary.byCategory.todo
107
+ }
108
+ )
109
+ ] })
110
+ }
111
+ ) })
112
+ ] }),
113
+ /* @__PURE__ */ jsx(Box, { padding: 4, background: "neutral0", hasRadius: true, shadow: "tableShadow", children: /* @__PURE__ */ jsxs(Flex, { gap: 4, wrap: "wrap", alignItems: "flex-end", children: [
114
+ /* @__PURE__ */ jsx(Box, { style: { flex: "2 1 240px" }, children: /* @__PURE__ */ jsxs(Field.Root, { name: "hubSearch", children: [
115
+ /* @__PURE__ */ jsx(Field.Label, { children: t("hub.filters.search", "Search notes") }),
116
+ /* @__PURE__ */ jsx(
117
+ TextInput,
118
+ {
119
+ name: "hubSearch",
120
+ value: search,
121
+ onChange: (e) => onSearchChange(e.target.value),
122
+ placeholder: t(
123
+ "hub.filters.search.placeholder",
124
+ "Search by title, content, content type, or author..."
125
+ )
126
+ }
127
+ )
128
+ ] }) }),
129
+ /* @__PURE__ */ jsx(Box, { style: { flex: "1 1 180px" }, children: /* @__PURE__ */ jsxs(Field.Root, { name: "hubCategory", children: [
130
+ /* @__PURE__ */ jsx(Field.Label, { children: t("note.modal.fields.category", "Category") }),
131
+ /* @__PURE__ */ jsxs(
132
+ SingleSelect,
133
+ {
134
+ value: selectedCategory,
135
+ onChange: (val) => onCategoryChange(
136
+ String(val) || "all"
137
+ ),
138
+ children: [
139
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "all", children: t("category.all", "All categories") }),
140
+ NOTE_CATEGORIES.map((cat) => /* @__PURE__ */ jsx(SingleSelectOption, { value: cat, children: t(
141
+ NOTE_CATEGORY_META[cat].labelKey,
142
+ NOTE_CATEGORY_META[cat].defaultLabel
143
+ ) }, cat))
144
+ ]
145
+ }
146
+ )
147
+ ] }) }),
148
+ /* @__PURE__ */ jsx(Box, { style: { flex: "1 1 200px" }, children: /* @__PURE__ */ jsxs(Field.Root, { name: "hubContentType", children: [
149
+ /* @__PURE__ */ jsx(Field.Label, { children: t("hub.filters.contentType", "Content Type") }),
150
+ /* @__PURE__ */ jsxs(
151
+ SingleSelect,
152
+ {
153
+ value: selectedSlug,
154
+ onChange: (val) => onSlugChange(String(val) || "all"),
155
+ children: [
156
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "all", children: t("hub.filters.contentType.all", "All content types") }),
157
+ summary.entitySlugs.map((slug) => /* @__PURE__ */ jsx(SingleSelectOption, { value: slug, children: slug }, slug))
158
+ ]
159
+ }
160
+ )
161
+ ] }) }),
162
+ /* @__PURE__ */ jsx(Box, { paddingBottom: 2, children: /* @__PURE__ */ jsx(
163
+ Checkbox,
164
+ {
165
+ checked: pinnedOnly,
166
+ onCheckedChange: (checked) => onPinnedOnlyChange(Boolean(checked)),
167
+ children: t("hub.filters.pinnedOnly", "Pinned only")
168
+ }
169
+ ) })
170
+ ] }) })
171
+ ] });
172
+ };
173
+ function formatNoteContentPreview(content) {
174
+ return content.length > 90 ? `${content.slice(0, 90)}…` : content;
175
+ }
176
+ const NoteHubActionsCell = ({
177
+ note,
178
+ deepLink,
179
+ t,
180
+ onNavigate,
181
+ onEdit,
182
+ onDelete,
183
+ onTogglePin
184
+ }) => {
185
+ const pinVariant = note.isPinned ? "secondary" : "ghost";
186
+ const pinLabel = note.isPinned ? t("note.actions.unpin", "Unpin note") : t("note.actions.pin", "Pin note");
187
+ return /* @__PURE__ */ jsxs(Flex, { gap: 1, alignItems: "center", children: [
188
+ deepLink && /* @__PURE__ */ jsx(
189
+ IconButton,
190
+ {
191
+ withTooltip: false,
192
+ variant: "ghost",
193
+ label: t("hub.actions.openEntry", "Open Content Manager entry"),
194
+ onClick: () => onNavigate(deepLink),
195
+ children: /* @__PURE__ */ jsx(ExternalLink, {})
196
+ }
197
+ ),
198
+ /* @__PURE__ */ jsx(
199
+ IconButton,
200
+ {
201
+ withTooltip: false,
202
+ variant: pinVariant,
203
+ label: pinLabel,
204
+ onClick: () => onTogglePin(note),
205
+ children: /* @__PURE__ */ jsx(Pin, {})
206
+ }
207
+ ),
208
+ /* @__PURE__ */ jsx(
209
+ IconButton,
210
+ {
211
+ withTooltip: false,
212
+ variant: "ghost",
213
+ label: t("note.actions.edit", "Edit"),
214
+ onClick: () => onEdit(note),
215
+ children: /* @__PURE__ */ jsx(Pencil, {})
216
+ }
217
+ ),
218
+ /* @__PURE__ */ jsx(
219
+ IconButton,
220
+ {
221
+ withTooltip: false,
222
+ variant: "ghost",
223
+ label: t("note.actions.delete", "Delete"),
224
+ onClick: () => onDelete(note),
225
+ children: /* @__PURE__ */ jsx(Trash, {})
226
+ }
227
+ )
228
+ ] });
229
+ };
230
+ const NoteHubRow = ({
231
+ note,
232
+ locale,
233
+ t,
234
+ onNavigate,
235
+ onEdit,
236
+ onDelete,
237
+ onTogglePin
238
+ }) => {
239
+ const catMeta = NOTE_CATEGORY_META[note.category] ?? NOTE_CATEGORY_META.general;
240
+ const deepLink = buildContentManagerNoteLink(note);
241
+ const entityBadgeText = note.entityDocumentId || String(note.entityId ?? "");
242
+ return /* @__PURE__ */ jsxs(Tr, { children: [
243
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
244
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
245
+ note.isPinned && /* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "primary700", children: t("hub.badge.pinned", "PINNED") }),
246
+ /* @__PURE__ */ jsx(
247
+ Typography,
248
+ {
249
+ fontWeight: "bold",
250
+ textColor: "neutral800",
251
+ role: "button",
252
+ tabIndex: 0,
253
+ style: { cursor: "pointer" },
254
+ onClick: () => onEdit(note),
255
+ onKeyDown: (e) => {
256
+ if (e.key === "Enter" || e.key === " ") {
257
+ e.preventDefault();
258
+ onEdit(note);
259
+ }
260
+ },
261
+ children: note.title
262
+ }
263
+ )
264
+ ] }),
265
+ note.content && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", ellipsis: true, children: formatNoteContentPreview(note.content) })
266
+ ] }) }),
267
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
268
+ Badge,
269
+ {
270
+ backgroundColor: catMeta.badgeBackground,
271
+ textColor: catMeta.badgeTextColor,
272
+ children: t(catMeta.labelKey, catMeta.defaultLabel)
273
+ }
274
+ ) }),
275
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
276
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral800", children: note.entitySlug }),
277
+ /* @__PURE__ */ jsx(Badge, { backgroundColor: "neutral100", textColor: "neutral700", children: entityBadgeText }),
278
+ note.entityLocale && /* @__PURE__ */ jsx(Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: note.entityLocale.toUpperCase() })
279
+ ] }) }),
280
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral800", children: formatNoteAuthorDisplay(note.createdBy) }) }),
281
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 0, children: [
282
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral800", children: formatNoteTimestamp(note.updatedAt ?? note.createdAt, locale) }),
283
+ note.updatedBy && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", children: formatNoteAuthorDisplay(note.updatedBy) })
284
+ ] }) }),
285
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
286
+ NoteHubActionsCell,
287
+ {
288
+ note,
289
+ deepLink,
290
+ t,
291
+ onNavigate,
292
+ onEdit,
293
+ onDelete,
294
+ onTogglePin
295
+ }
296
+ ) })
297
+ ] });
298
+ };
299
+ const NotesHomePage = () => {
300
+ const { formatMessage, locale } = useIntl();
301
+ const navigate = useNavigate();
302
+ const {
303
+ notes,
304
+ summary,
305
+ isLoading,
306
+ isMutating,
307
+ refetch,
308
+ updateNote,
309
+ deleteNote
310
+ } = useNotes({
311
+ includeAllLocales: true
312
+ });
313
+ const [search, setSearch] = React.useState("");
314
+ const [selectedCategory, setSelectedCategory] = React.useState("all");
315
+ const [selectedSlug, setSelectedSlug] = React.useState("all");
316
+ const [pinnedOnly, setPinnedOnly] = React.useState(false);
317
+ const [editingNote, setEditingNote] = React.useState(null);
318
+ const [deletingNote, setDeletingNote] = React.useState(
319
+ null
320
+ );
321
+ React.useEffect(() => {
322
+ if (!isLoading && selectedSlug !== "all" && !summary.entitySlugs.includes(selectedSlug)) {
323
+ setSelectedSlug("all");
324
+ }
325
+ }, [isLoading, selectedSlug, summary.entitySlugs]);
326
+ const t = (id, defaultMessage, values) => formatMessage({ id: getTrad(id), defaultMessage }, values);
327
+ const filteredNotes = React.useMemo(
328
+ () => filterNotesList(notes, {
329
+ search,
330
+ category: selectedCategory,
331
+ entitySlug: selectedSlug === "all" ? void 0 : selectedSlug,
332
+ isPinned: pinnedOnly ? true : void 0,
333
+ includeAllLocales: true,
334
+ sort: "DESC"
335
+ }),
336
+ [notes, search, selectedCategory, selectedSlug, pinnedOnly]
337
+ );
338
+ const handleSaveEdit = async (payload, existingId) => {
339
+ if (existingId !== void 0 && existingId !== "") {
340
+ const updated = await updateNote(existingId, payload);
341
+ if (updated) {
342
+ setEditingNote(null);
343
+ }
344
+ }
345
+ };
346
+ const handleTogglePin = async (note) => {
347
+ const id = note.id || note.documentId;
348
+ if (!id) return;
349
+ await updateNote(id, { isPinned: !note.isPinned });
350
+ };
351
+ const handleConfirmDelete = async (note) => {
352
+ const id = note.id || note.documentId;
353
+ if (!id) return;
354
+ const deleted = await deleteNote(id);
355
+ if (deleted) {
356
+ setDeletingNote(null);
357
+ }
358
+ };
359
+ return /* @__PURE__ */ jsxs(Main, { children: [
360
+ /* @__PURE__ */ jsx(
361
+ Layouts.Header,
362
+ {
363
+ title: t("hub.title", "Editorial Notes Hub"),
364
+ subtitle: t(
365
+ "hub.subtitle",
366
+ "Search, filter, and manage editorial notes across all Strapi v5 Content Manager entries."
367
+ ),
368
+ primaryAction: /* @__PURE__ */ jsx(
369
+ Button,
370
+ {
371
+ variant: "secondary",
372
+ onClick: () => void refetch(),
373
+ loading: isLoading,
374
+ children: t("hub.actions.refresh", "Refresh")
375
+ }
376
+ )
377
+ }
378
+ ),
379
+ /* @__PURE__ */ jsxs(Layouts.Content, { children: [
380
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
381
+ /* @__PURE__ */ jsx(
382
+ NotesHubFilterBar,
383
+ {
384
+ summary,
385
+ search,
386
+ selectedCategory,
387
+ selectedSlug,
388
+ pinnedOnly,
389
+ onSearchChange: setSearch,
390
+ onCategoryChange: setSelectedCategory,
391
+ onSlugChange: setSelectedSlug,
392
+ onPinnedOnlyChange: setPinnedOnly
393
+ }
394
+ ),
395
+ isLoading ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", padding: 8, children: /* @__PURE__ */ jsx(Loader, { children: t("notes.loading", "Loading Content ...") }) }) : filteredNotes.length === 0 ? /* @__PURE__ */ jsx(
396
+ EmptyStateLayout,
397
+ {
398
+ content: t(
399
+ "hub.empty",
400
+ "No editorial notes found matching your current filters."
401
+ )
402
+ }
403
+ ) : /* @__PURE__ */ jsxs(Table, { colCount: 6, rowCount: filteredNotes.length + 1, children: [
404
+ /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
405
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: t("note.modal.fields.title", "Title") }) }),
406
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: t("note.modal.fields.category", "Category") }) }),
407
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: t("hub.table.targetEntity", "Target Entry") }) }),
408
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: t("note.modal.meta.createdBy", "Created By") }) }),
409
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: t("note.modal.meta.updatedAt", "Updated At") }) }),
410
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: t("hub.table.actions", "Actions") }) })
411
+ ] }) }),
412
+ /* @__PURE__ */ jsx(Tbody, { children: filteredNotes.map((note) => /* @__PURE__ */ jsx(
413
+ NoteHubRow,
414
+ {
415
+ note,
416
+ locale,
417
+ t,
418
+ onNavigate: navigate,
419
+ onEdit: setEditingNote,
420
+ onDelete: setDeletingNote,
421
+ onTogglePin: (selected) => void handleTogglePin(selected)
422
+ },
423
+ String(note.id || note.documentId)
424
+ )) })
425
+ ] })
426
+ ] }),
427
+ editingNote && /* @__PURE__ */ jsx(
428
+ NoteModal,
429
+ {
430
+ entity: {
431
+ id: editingNote.entityId,
432
+ documentId: editingNote.entityDocumentId,
433
+ slug: editingNote.entitySlug,
434
+ locale: editingNote.entityLocale
435
+ },
436
+ note: editingNote,
437
+ isOpen: Boolean(editingNote),
438
+ isSubmitting: isMutating,
439
+ onClose: () => setEditingNote(null),
440
+ onSubmit: handleSaveEdit
441
+ }
442
+ ),
443
+ /* @__PURE__ */ jsx(
444
+ DeleteNoteDialog,
445
+ {
446
+ note: deletingNote,
447
+ isSubmitting: isMutating,
448
+ onCancel: () => setDeletingNote(null),
449
+ onConfirm: handleConfirmDelete
450
+ }
451
+ )
452
+ ] })
453
+ ] });
454
+ };
455
+ export {
456
+ NotesHomePage
457
+ };