strapi-plugin-magic-mark 3.2.8 → 3.3.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.
- package/dist/_chunks/{App-C6T1ltR3.mjs → App-CZEZ9x55.mjs} +64 -43
- package/dist/_chunks/{App-C6Crb_w7.js → App-DduKOTII.js} +63 -42
- package/dist/_chunks/{UpgradePage-CYrqGUnv.js → UpgradePage-B5kfn6Np.js} +1 -1
- package/dist/_chunks/{UpgradePage-BWjKwdCf.mjs → UpgradePage-BeQJjvjk.mjs} +1 -1
- package/dist/_chunks/{index-svfBWq9B.js → index-BKaROSTg.js} +1254 -595
- package/dist/_chunks/{index-C7wF7iqT.mjs → index-DF8ICn1F.mjs} +1255 -596
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +27 -2
- package/dist/server/index.mjs +27 -2
- package/package.json +2 -1
|
@@ -4,9 +4,10 @@ import { useIntl } from "react-intl";
|
|
|
4
4
|
import { useNavigate } from "react-router-dom";
|
|
5
5
|
import styled, { keyframes } from "styled-components";
|
|
6
6
|
import { Flex, Loader, Box, Typography, SingleSelect, SingleSelectOption, Thead, Tr, Th, VisuallyHidden, Tbody, Td, Button, Table, TextInput } from "@strapi/design-system";
|
|
7
|
-
import {
|
|
7
|
+
import { Pin, Eye, Pencil, Trash, Cross, Key, User, Mail, Check } from "@strapi/icons";
|
|
8
|
+
import { BookOpenIcon, UserIcon, SparklesIcon, LinkIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline";
|
|
8
9
|
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
9
|
-
import { u as useLicenseInfo, p as pluginId, C as CreateEditModal } from "./index-
|
|
10
|
+
import { u as useLicenseInfo, p as pluginId, g as getIconById, C as CreateEditModal } from "./index-DF8ICn1F.mjs";
|
|
10
11
|
const theme = {
|
|
11
12
|
colors: {
|
|
12
13
|
primary: {
|
|
@@ -312,10 +313,21 @@ styled(Box)`
|
|
|
312
313
|
border-radius: 2px;
|
|
313
314
|
transition: all ${theme.transitions.normal};
|
|
314
315
|
`;
|
|
315
|
-
styled.div`
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
316
|
+
const BookmarkIconWrapper = styled.div`
|
|
317
|
+
display: flex;
|
|
318
|
+
align-items: center;
|
|
319
|
+
justify-content: center;
|
|
320
|
+
width: 40px;
|
|
321
|
+
height: 40px;
|
|
322
|
+
background: linear-gradient(135deg, ${theme.colors.primary[100]} 0%, #E0E7FF 100%);
|
|
323
|
+
border-radius: 8px;
|
|
324
|
+
flex-shrink: 0;
|
|
325
|
+
|
|
326
|
+
svg {
|
|
327
|
+
width: 20px;
|
|
328
|
+
height: 20px;
|
|
329
|
+
color: ${theme.colors.primary[600]};
|
|
330
|
+
}
|
|
319
331
|
`;
|
|
320
332
|
const ActionButtons = styled(Flex)`
|
|
321
333
|
opacity: 1;
|
|
@@ -323,13 +335,18 @@ const ActionButtons = styled(Flex)`
|
|
|
323
335
|
gap: ${theme.spacing.xs};
|
|
324
336
|
justify-content: flex-end;
|
|
325
337
|
`;
|
|
326
|
-
const
|
|
338
|
+
const FloatingIcon = styled.div`
|
|
327
339
|
position: absolute;
|
|
328
340
|
bottom: 40px;
|
|
329
341
|
right: 40px;
|
|
330
|
-
font-size: 72px;
|
|
331
342
|
opacity: 0.08;
|
|
332
343
|
animation: ${float} 4s ease-in-out infinite;
|
|
344
|
+
|
|
345
|
+
svg {
|
|
346
|
+
width: 72px;
|
|
347
|
+
height: 72px;
|
|
348
|
+
color: ${theme.colors.warning[500]};
|
|
349
|
+
}
|
|
333
350
|
`;
|
|
334
351
|
const FilterBar = styled(Flex)`
|
|
335
352
|
background: ${theme.colors.neutral[0]};
|
|
@@ -350,7 +367,7 @@ const SearchInputWrapper = styled.div`
|
|
|
350
367
|
display: flex;
|
|
351
368
|
align-items: center;
|
|
352
369
|
`;
|
|
353
|
-
const
|
|
370
|
+
const SearchIconStyled = styled(MagnifyingGlassIcon)`
|
|
354
371
|
position: absolute;
|
|
355
372
|
left: 12px;
|
|
356
373
|
width: 16px;
|
|
@@ -449,6 +466,19 @@ const HomePageModern = () => {
|
|
|
449
466
|
console.error("[Magic-Mark] Error fetching current user:", error);
|
|
450
467
|
}
|
|
451
468
|
};
|
|
469
|
+
const isCurrentUserOwner = (bookmark) => {
|
|
470
|
+
if (!bookmark.createdBy || !currentUser) return false;
|
|
471
|
+
if (bookmark.createdBy.documentId && currentUser.documentId) {
|
|
472
|
+
return bookmark.createdBy.documentId === currentUser.documentId;
|
|
473
|
+
}
|
|
474
|
+
if (bookmark.createdBy.id && currentUser.id) {
|
|
475
|
+
return String(bookmark.createdBy.id) === String(currentUser.id);
|
|
476
|
+
}
|
|
477
|
+
if (bookmark.createdBy.id && currentUser.documentId) {
|
|
478
|
+
return String(bookmark.createdBy.id) === String(currentUser.documentId);
|
|
479
|
+
}
|
|
480
|
+
return false;
|
|
481
|
+
};
|
|
452
482
|
const fetchLicenseLimits = async () => {
|
|
453
483
|
try {
|
|
454
484
|
const response = await get(`/${pluginId}/license/limits`);
|
|
@@ -473,27 +503,29 @@ const HomePageModern = () => {
|
|
|
473
503
|
setLoading(false);
|
|
474
504
|
}
|
|
475
505
|
};
|
|
476
|
-
const handleDelete = async (
|
|
506
|
+
const handleDelete = async (bookmark) => {
|
|
477
507
|
if (!confirm(formatMessage({
|
|
478
508
|
id: `${pluginId}.confirm.delete`,
|
|
479
509
|
defaultMessage: "Are you sure you want to delete this bookmark?"
|
|
480
510
|
}))) {
|
|
481
511
|
return;
|
|
482
512
|
}
|
|
513
|
+
const deleteId = bookmark.documentId || bookmark.id;
|
|
483
514
|
try {
|
|
484
|
-
await del(`/${pluginId}/bookmarks/${
|
|
485
|
-
console.log("[Magic-Mark HomePage] Bookmark deleted:",
|
|
515
|
+
await del(`/${pluginId}/bookmarks/${deleteId}`);
|
|
516
|
+
console.log("[Magic-Mark HomePage] Bookmark deleted:", deleteId);
|
|
486
517
|
fetchBookmarks();
|
|
487
518
|
} catch (error) {
|
|
488
519
|
console.error("[Magic-Mark HomePage] Error deleting bookmark:", error);
|
|
489
520
|
}
|
|
490
521
|
};
|
|
491
522
|
const handlePin = async (bookmark) => {
|
|
523
|
+
const pinId = bookmark.documentId || bookmark.id;
|
|
492
524
|
try {
|
|
493
|
-
await post(`/${pluginId}/bookmarks/${
|
|
525
|
+
await post(`/${pluginId}/bookmarks/${pinId}/pin`, {
|
|
494
526
|
isPinned: !bookmark.isPinned
|
|
495
527
|
});
|
|
496
|
-
console.log("[Magic-Mark HomePage] Bookmark pinned:",
|
|
528
|
+
console.log("[Magic-Mark HomePage] Bookmark pinned:", pinId);
|
|
497
529
|
fetchBookmarks();
|
|
498
530
|
} catch (error) {
|
|
499
531
|
console.error("[Magic-Mark HomePage] Error pinning bookmark:", error);
|
|
@@ -532,24 +564,24 @@ const HomePageModern = () => {
|
|
|
532
564
|
return bookmark.name.toLowerCase().includes(query) || bookmark.description && bookmark.description.toLowerCase().includes(query) || bookmark.path.toLowerCase().includes(query);
|
|
533
565
|
}).slice(0, parseInt(entriesPerPage));
|
|
534
566
|
const pinnedBookmarks = bookmarks.filter((b) => b.isPinned);
|
|
535
|
-
const myBookmarks = bookmarks.filter((b) => b
|
|
536
|
-
const sharedWithMe = bookmarks.filter((b) => b
|
|
567
|
+
const myBookmarks = bookmarks.filter((b) => isCurrentUserOwner(b));
|
|
568
|
+
const sharedWithMe = bookmarks.filter((b) => !isCurrentUserOwner(b) && b.createdBy);
|
|
537
569
|
return /* @__PURE__ */ jsxs(Container, { padding: 8, children: [
|
|
538
570
|
/* @__PURE__ */ jsx(Header, { children: /* @__PURE__ */ jsxs(HeaderContent, { direction: "column", alignItems: "flex-start", gap: 2, children: [
|
|
539
571
|
/* @__PURE__ */ jsxs(Title, { children: [
|
|
540
|
-
/* @__PURE__ */ jsx(
|
|
572
|
+
/* @__PURE__ */ jsx(BookOpenIcon, {}),
|
|
541
573
|
" MagicMark"
|
|
542
574
|
] }),
|
|
543
575
|
/* @__PURE__ */ jsx(Subtitle, { children: "Save filtered views and navigate with one click" })
|
|
544
576
|
] }) }),
|
|
545
577
|
/* @__PURE__ */ jsxs(StatsGrid, { children: [
|
|
546
578
|
/* @__PURE__ */ jsxs(StatCard, { $delay: "0.1s", $color: theme.colors.primary[500], children: [
|
|
547
|
-
/* @__PURE__ */ jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.primary[100], $color: theme.colors.primary[600], children: /* @__PURE__ */ jsx(
|
|
579
|
+
/* @__PURE__ */ jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.primary[100], $color: theme.colors.primary[600], children: /* @__PURE__ */ jsx(UserIcon, {}) }),
|
|
548
580
|
/* @__PURE__ */ jsx(StatValue, { className: "stat-value", children: myBookmarks.length }),
|
|
549
581
|
/* @__PURE__ */ jsx(StatLabel, { children: "My Bookmarks" })
|
|
550
582
|
] }),
|
|
551
583
|
/* @__PURE__ */ jsxs(StatCard, { $delay: "0.2s", $color: theme.colors.success[500], children: [
|
|
552
|
-
/* @__PURE__ */ jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.success[100], $color: theme.colors.success[600], children: /* @__PURE__ */ jsx(
|
|
584
|
+
/* @__PURE__ */ jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.success[100], $color: theme.colors.success[600], children: /* @__PURE__ */ jsx(SparklesIcon, {}) }),
|
|
553
585
|
/* @__PURE__ */ jsx(StatValue, { className: "stat-value", children: sharedWithMe.length }),
|
|
554
586
|
/* @__PURE__ */ jsx(StatLabel, { children: formatMessage({ id: `${pluginId}.stats.shared`, defaultMessage: "Shared with Me" }) })
|
|
555
587
|
] }),
|
|
@@ -572,7 +604,7 @@ const HomePageModern = () => {
|
|
|
572
604
|
className: "stat-icon",
|
|
573
605
|
$bg: licenseLimits.canCreate ? theme.colors.neutral[100] : theme.colors.danger[100],
|
|
574
606
|
$color: licenseLimits.canCreate ? theme.colors.neutral[600] : theme.colors.danger[600],
|
|
575
|
-
children: /* @__PURE__ */ jsx(
|
|
607
|
+
children: /* @__PURE__ */ jsx(LinkIcon, {})
|
|
576
608
|
}
|
|
577
609
|
),
|
|
578
610
|
/* @__PURE__ */ jsxs(StatValue, { className: "stat-value", children: [
|
|
@@ -611,7 +643,7 @@ const HomePageModern = () => {
|
|
|
611
643
|
/* @__PURE__ */ jsx(Box, { style: { marginBottom: theme.spacing.md }, children: /* @__PURE__ */ jsx(Typography, { variant: "delta", style: { marginBottom: theme.spacing.md, color: theme.colors.neutral[700] }, children: formatMessage({ id: `${pluginId}.allBookmarks.title`, defaultMessage: "🔖 All Available Bookmarks" }) }) }),
|
|
612
644
|
/* @__PURE__ */ jsxs(FilterBar, { children: [
|
|
613
645
|
/* @__PURE__ */ jsxs(SearchInputWrapper, { style: { flex: 1 }, children: [
|
|
614
|
-
/* @__PURE__ */ jsx(
|
|
646
|
+
/* @__PURE__ */ jsx(SearchIconStyled, {}),
|
|
615
647
|
/* @__PURE__ */ jsx(
|
|
616
648
|
StyledSearchInput,
|
|
617
649
|
{
|
|
@@ -668,25 +700,14 @@ const HomePageModern = () => {
|
|
|
668
700
|
background: bookmark.isPinned ? theme.colors.warning[50] : "transparent"
|
|
669
701
|
}, children: [
|
|
670
702
|
/* @__PURE__ */ jsx(Td, { onClick: () => handleBookmarkClick(bookmark), style: { cursor: "pointer" }, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 3, children: [
|
|
671
|
-
/* @__PURE__ */ jsx(
|
|
672
|
-
|
|
673
|
-
{
|
|
674
|
-
|
|
675
|
-
width: "36px",
|
|
676
|
-
height: "36px",
|
|
677
|
-
display: "flex",
|
|
678
|
-
alignItems: "center",
|
|
679
|
-
justifyContent: "center",
|
|
680
|
-
flexShrink: 0,
|
|
681
|
-
fontSize: "24px"
|
|
682
|
-
},
|
|
683
|
-
children: bookmark.emoji
|
|
684
|
-
}
|
|
685
|
-
),
|
|
703
|
+
/* @__PURE__ */ jsx(BookmarkIconWrapper, { children: (() => {
|
|
704
|
+
const IconComponent = getIconById(bookmark.icon || bookmark.emoji || "bookmark");
|
|
705
|
+
return /* @__PURE__ */ jsx(IconComponent, {});
|
|
706
|
+
})() }),
|
|
686
707
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 0, children: [
|
|
687
708
|
/* @__PURE__ */ jsx(Typography, { fontWeight: "semiBold", ellipsis: true, style: { fontSize: "1.125rem", lineHeight: "1.4" }, children: bookmark.name }),
|
|
688
709
|
/* @__PURE__ */ jsxs(Flex, { gap: 1, alignItems: "center", children: [
|
|
689
|
-
bookmark
|
|
710
|
+
isCurrentUserOwner(bookmark) ? /* @__PURE__ */ jsxs(Typography, { variant: "pi", style: { fontSize: "0.75rem", color: theme.colors.primary[600], fontWeight: 500 }, children: [
|
|
690
711
|
"• ",
|
|
691
712
|
formatMessage({ id: `${pluginId}.bookmark.myBookmark`, defaultMessage: "My Bookmark" })
|
|
692
713
|
] }) : /* @__PURE__ */ jsxs(Typography, { variant: "pi", style: { fontSize: "0.75rem", color: theme.colors.neutral[600] }, children: [
|
|
@@ -748,7 +769,7 @@ const HomePageModern = () => {
|
|
|
748
769
|
children: /* @__PURE__ */ jsx(Eye, {})
|
|
749
770
|
}
|
|
750
771
|
),
|
|
751
|
-
|
|
772
|
+
/* @__PURE__ */ jsx(
|
|
752
773
|
Button,
|
|
753
774
|
{
|
|
754
775
|
variant: "ghost",
|
|
@@ -757,18 +778,18 @@ const HomePageModern = () => {
|
|
|
757
778
|
e.stopPropagation();
|
|
758
779
|
handleEdit(bookmark);
|
|
759
780
|
},
|
|
760
|
-
disabled: bookmark
|
|
781
|
+
disabled: !isCurrentUserOwner(bookmark),
|
|
761
782
|
children: /* @__PURE__ */ jsx(Pencil, {})
|
|
762
783
|
}
|
|
763
784
|
),
|
|
764
|
-
bookmark
|
|
785
|
+
isCurrentUserOwner(bookmark) && /* @__PURE__ */ jsx(
|
|
765
786
|
Button,
|
|
766
787
|
{
|
|
767
788
|
variant: "ghost",
|
|
768
789
|
size: "S",
|
|
769
790
|
onClick: (e) => {
|
|
770
791
|
e.stopPropagation();
|
|
771
|
-
handleDelete(bookmark
|
|
792
|
+
handleDelete(bookmark);
|
|
772
793
|
},
|
|
773
794
|
children: /* @__PURE__ */ jsx(Trash, {})
|
|
774
795
|
}
|
|
@@ -812,7 +833,7 @@ const HomePageModern = () => {
|
|
|
812
833
|
}
|
|
813
834
|
}
|
|
814
835
|
),
|
|
815
|
-
/* @__PURE__ */ jsx(
|
|
836
|
+
/* @__PURE__ */ jsx(FloatingIcon, { children: /* @__PURE__ */ jsx(SparklesIcon, {}) }),
|
|
816
837
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "center", gap: 6, style: { position: "relative", zIndex: 1 }, children: [
|
|
817
838
|
/* @__PURE__ */ jsx(
|
|
818
839
|
Box,
|
|
@@ -827,7 +848,7 @@ const HomePageModern = () => {
|
|
|
827
848
|
justifyContent: "center",
|
|
828
849
|
boxShadow: theme.shadows.xl
|
|
829
850
|
},
|
|
830
|
-
children: /* @__PURE__ */ jsx(
|
|
851
|
+
children: /* @__PURE__ */ jsx(SparklesIcon, { style: { width: "60px", height: "60px", color: theme.colors.primary[600] } })
|
|
831
852
|
}
|
|
832
853
|
),
|
|
833
854
|
/* @__PURE__ */ jsx(
|
|
@@ -7,8 +7,9 @@ const reactRouterDom = require("react-router-dom");
|
|
|
7
7
|
const styled = require("styled-components");
|
|
8
8
|
const designSystem = require("@strapi/design-system");
|
|
9
9
|
const icons = require("@strapi/icons");
|
|
10
|
+
const outline = require("@heroicons/react/24/outline");
|
|
10
11
|
const admin = require("@strapi/strapi/admin");
|
|
11
|
-
const index = require("./index-
|
|
12
|
+
const index = require("./index-BKaROSTg.js");
|
|
12
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
13
14
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
14
15
|
const theme = {
|
|
@@ -316,10 +317,21 @@ styled__default.default(designSystem.Box)`
|
|
|
316
317
|
border-radius: 2px;
|
|
317
318
|
transition: all ${theme.transitions.normal};
|
|
318
319
|
`;
|
|
319
|
-
styled__default.default.div`
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
const BookmarkIconWrapper = styled__default.default.div`
|
|
321
|
+
display: flex;
|
|
322
|
+
align-items: center;
|
|
323
|
+
justify-content: center;
|
|
324
|
+
width: 40px;
|
|
325
|
+
height: 40px;
|
|
326
|
+
background: linear-gradient(135deg, ${theme.colors.primary[100]} 0%, #E0E7FF 100%);
|
|
327
|
+
border-radius: 8px;
|
|
328
|
+
flex-shrink: 0;
|
|
329
|
+
|
|
330
|
+
svg {
|
|
331
|
+
width: 20px;
|
|
332
|
+
height: 20px;
|
|
333
|
+
color: ${theme.colors.primary[600]};
|
|
334
|
+
}
|
|
323
335
|
`;
|
|
324
336
|
const ActionButtons = styled__default.default(designSystem.Flex)`
|
|
325
337
|
opacity: 1;
|
|
@@ -327,13 +339,18 @@ const ActionButtons = styled__default.default(designSystem.Flex)`
|
|
|
327
339
|
gap: ${theme.spacing.xs};
|
|
328
340
|
justify-content: flex-end;
|
|
329
341
|
`;
|
|
330
|
-
const
|
|
342
|
+
const FloatingIcon = styled__default.default.div`
|
|
331
343
|
position: absolute;
|
|
332
344
|
bottom: 40px;
|
|
333
345
|
right: 40px;
|
|
334
|
-
font-size: 72px;
|
|
335
346
|
opacity: 0.08;
|
|
336
347
|
animation: ${float} 4s ease-in-out infinite;
|
|
348
|
+
|
|
349
|
+
svg {
|
|
350
|
+
width: 72px;
|
|
351
|
+
height: 72px;
|
|
352
|
+
color: ${theme.colors.warning[500]};
|
|
353
|
+
}
|
|
337
354
|
`;
|
|
338
355
|
const FilterBar = styled__default.default(designSystem.Flex)`
|
|
339
356
|
background: ${theme.colors.neutral[0]};
|
|
@@ -354,7 +371,7 @@ const SearchInputWrapper = styled__default.default.div`
|
|
|
354
371
|
display: flex;
|
|
355
372
|
align-items: center;
|
|
356
373
|
`;
|
|
357
|
-
const
|
|
374
|
+
const SearchIconStyled = styled__default.default(outline.MagnifyingGlassIcon)`
|
|
358
375
|
position: absolute;
|
|
359
376
|
left: 12px;
|
|
360
377
|
width: 16px;
|
|
@@ -453,6 +470,19 @@ const HomePageModern = () => {
|
|
|
453
470
|
console.error("[Magic-Mark] Error fetching current user:", error);
|
|
454
471
|
}
|
|
455
472
|
};
|
|
473
|
+
const isCurrentUserOwner = (bookmark) => {
|
|
474
|
+
if (!bookmark.createdBy || !currentUser) return false;
|
|
475
|
+
if (bookmark.createdBy.documentId && currentUser.documentId) {
|
|
476
|
+
return bookmark.createdBy.documentId === currentUser.documentId;
|
|
477
|
+
}
|
|
478
|
+
if (bookmark.createdBy.id && currentUser.id) {
|
|
479
|
+
return String(bookmark.createdBy.id) === String(currentUser.id);
|
|
480
|
+
}
|
|
481
|
+
if (bookmark.createdBy.id && currentUser.documentId) {
|
|
482
|
+
return String(bookmark.createdBy.id) === String(currentUser.documentId);
|
|
483
|
+
}
|
|
484
|
+
return false;
|
|
485
|
+
};
|
|
456
486
|
const fetchLicenseLimits = async () => {
|
|
457
487
|
try {
|
|
458
488
|
const response = await get(`/${index.pluginId}/license/limits`);
|
|
@@ -477,27 +507,29 @@ const HomePageModern = () => {
|
|
|
477
507
|
setLoading(false);
|
|
478
508
|
}
|
|
479
509
|
};
|
|
480
|
-
const handleDelete = async (
|
|
510
|
+
const handleDelete = async (bookmark) => {
|
|
481
511
|
if (!confirm(formatMessage({
|
|
482
512
|
id: `${index.pluginId}.confirm.delete`,
|
|
483
513
|
defaultMessage: "Are you sure you want to delete this bookmark?"
|
|
484
514
|
}))) {
|
|
485
515
|
return;
|
|
486
516
|
}
|
|
517
|
+
const deleteId = bookmark.documentId || bookmark.id;
|
|
487
518
|
try {
|
|
488
|
-
await del(`/${index.pluginId}/bookmarks/${
|
|
489
|
-
console.log("[Magic-Mark HomePage] Bookmark deleted:",
|
|
519
|
+
await del(`/${index.pluginId}/bookmarks/${deleteId}`);
|
|
520
|
+
console.log("[Magic-Mark HomePage] Bookmark deleted:", deleteId);
|
|
490
521
|
fetchBookmarks();
|
|
491
522
|
} catch (error) {
|
|
492
523
|
console.error("[Magic-Mark HomePage] Error deleting bookmark:", error);
|
|
493
524
|
}
|
|
494
525
|
};
|
|
495
526
|
const handlePin = async (bookmark) => {
|
|
527
|
+
const pinId = bookmark.documentId || bookmark.id;
|
|
496
528
|
try {
|
|
497
|
-
await post(`/${index.pluginId}/bookmarks/${
|
|
529
|
+
await post(`/${index.pluginId}/bookmarks/${pinId}/pin`, {
|
|
498
530
|
isPinned: !bookmark.isPinned
|
|
499
531
|
});
|
|
500
|
-
console.log("[Magic-Mark HomePage] Bookmark pinned:",
|
|
532
|
+
console.log("[Magic-Mark HomePage] Bookmark pinned:", pinId);
|
|
501
533
|
fetchBookmarks();
|
|
502
534
|
} catch (error) {
|
|
503
535
|
console.error("[Magic-Mark HomePage] Error pinning bookmark:", error);
|
|
@@ -536,24 +568,24 @@ const HomePageModern = () => {
|
|
|
536
568
|
return bookmark.name.toLowerCase().includes(query) || bookmark.description && bookmark.description.toLowerCase().includes(query) || bookmark.path.toLowerCase().includes(query);
|
|
537
569
|
}).slice(0, parseInt(entriesPerPage));
|
|
538
570
|
const pinnedBookmarks = bookmarks.filter((b) => b.isPinned);
|
|
539
|
-
const myBookmarks = bookmarks.filter((b) => b
|
|
540
|
-
const sharedWithMe = bookmarks.filter((b) => b
|
|
571
|
+
const myBookmarks = bookmarks.filter((b) => isCurrentUserOwner(b));
|
|
572
|
+
const sharedWithMe = bookmarks.filter((b) => !isCurrentUserOwner(b) && b.createdBy);
|
|
541
573
|
return /* @__PURE__ */ jsxRuntime.jsxs(Container, { padding: 8, children: [
|
|
542
574
|
/* @__PURE__ */ jsxRuntime.jsx(Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(HeaderContent, { direction: "column", alignItems: "flex-start", gap: 2, children: [
|
|
543
575
|
/* @__PURE__ */ jsxRuntime.jsxs(Title, { children: [
|
|
544
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
576
|
+
/* @__PURE__ */ jsxRuntime.jsx(outline.BookOpenIcon, {}),
|
|
545
577
|
" MagicMark"
|
|
546
578
|
] }),
|
|
547
579
|
/* @__PURE__ */ jsxRuntime.jsx(Subtitle, { children: "Save filtered views and navigate with one click" })
|
|
548
580
|
] }) }),
|
|
549
581
|
/* @__PURE__ */ jsxRuntime.jsxs(StatsGrid, { children: [
|
|
550
582
|
/* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.1s", $color: theme.colors.primary[500], children: [
|
|
551
|
-
/* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.primary[100], $color: theme.colors.primary[600], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
583
|
+
/* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.primary[100], $color: theme.colors.primary[600], children: /* @__PURE__ */ jsxRuntime.jsx(outline.UserIcon, {}) }),
|
|
552
584
|
/* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: myBookmarks.length }),
|
|
553
585
|
/* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: "My Bookmarks" })
|
|
554
586
|
] }),
|
|
555
587
|
/* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.2s", $color: theme.colors.success[500], children: [
|
|
556
|
-
/* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.success[100], $color: theme.colors.success[600], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
588
|
+
/* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.success[100], $color: theme.colors.success[600], children: /* @__PURE__ */ jsxRuntime.jsx(outline.SparklesIcon, {}) }),
|
|
557
589
|
/* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: sharedWithMe.length }),
|
|
558
590
|
/* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: formatMessage({ id: `${index.pluginId}.stats.shared`, defaultMessage: "Shared with Me" }) })
|
|
559
591
|
] }),
|
|
@@ -576,7 +608,7 @@ const HomePageModern = () => {
|
|
|
576
608
|
className: "stat-icon",
|
|
577
609
|
$bg: licenseLimits.canCreate ? theme.colors.neutral[100] : theme.colors.danger[100],
|
|
578
610
|
$color: licenseLimits.canCreate ? theme.colors.neutral[600] : theme.colors.danger[600],
|
|
579
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
611
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(outline.LinkIcon, {})
|
|
580
612
|
}
|
|
581
613
|
),
|
|
582
614
|
/* @__PURE__ */ jsxRuntime.jsxs(StatValue, { className: "stat-value", children: [
|
|
@@ -615,7 +647,7 @@ const HomePageModern = () => {
|
|
|
615
647
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { marginBottom: theme.spacing.md }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", style: { marginBottom: theme.spacing.md, color: theme.colors.neutral[700] }, children: formatMessage({ id: `${index.pluginId}.allBookmarks.title`, defaultMessage: "🔖 All Available Bookmarks" }) }) }),
|
|
616
648
|
/* @__PURE__ */ jsxRuntime.jsxs(FilterBar, { children: [
|
|
617
649
|
/* @__PURE__ */ jsxRuntime.jsxs(SearchInputWrapper, { style: { flex: 1 }, children: [
|
|
618
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
650
|
+
/* @__PURE__ */ jsxRuntime.jsx(SearchIconStyled, {}),
|
|
619
651
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
620
652
|
StyledSearchInput,
|
|
621
653
|
{
|
|
@@ -672,25 +704,14 @@ const HomePageModern = () => {
|
|
|
672
704
|
background: bookmark.isPinned ? theme.colors.warning[50] : "transparent"
|
|
673
705
|
}, children: [
|
|
674
706
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: () => handleBookmarkClick(bookmark), style: { cursor: "pointer" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, children: [
|
|
675
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
676
|
-
|
|
677
|
-
{
|
|
678
|
-
|
|
679
|
-
width: "36px",
|
|
680
|
-
height: "36px",
|
|
681
|
-
display: "flex",
|
|
682
|
-
alignItems: "center",
|
|
683
|
-
justifyContent: "center",
|
|
684
|
-
flexShrink: 0,
|
|
685
|
-
fontSize: "24px"
|
|
686
|
-
},
|
|
687
|
-
children: bookmark.emoji
|
|
688
|
-
}
|
|
689
|
-
),
|
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx(BookmarkIconWrapper, { children: (() => {
|
|
708
|
+
const IconComponent = index.getIconById(bookmark.icon || bookmark.emoji || "bookmark");
|
|
709
|
+
return /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {});
|
|
710
|
+
})() }),
|
|
690
711
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 0, children: [
|
|
691
712
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", ellipsis: true, style: { fontSize: "1.125rem", lineHeight: "1.4" }, children: bookmark.name }),
|
|
692
713
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, alignItems: "center", children: [
|
|
693
|
-
bookmark
|
|
714
|
+
isCurrentUserOwner(bookmark) ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "0.75rem", color: theme.colors.primary[600], fontWeight: 500 }, children: [
|
|
694
715
|
"• ",
|
|
695
716
|
formatMessage({ id: `${index.pluginId}.bookmark.myBookmark`, defaultMessage: "My Bookmark" })
|
|
696
717
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "0.75rem", color: theme.colors.neutral[600] }, children: [
|
|
@@ -752,7 +773,7 @@ const HomePageModern = () => {
|
|
|
752
773
|
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Eye, {})
|
|
753
774
|
}
|
|
754
775
|
),
|
|
755
|
-
|
|
776
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
756
777
|
designSystem.Button,
|
|
757
778
|
{
|
|
758
779
|
variant: "ghost",
|
|
@@ -761,18 +782,18 @@ const HomePageModern = () => {
|
|
|
761
782
|
e.stopPropagation();
|
|
762
783
|
handleEdit(bookmark);
|
|
763
784
|
},
|
|
764
|
-
disabled: bookmark
|
|
785
|
+
disabled: !isCurrentUserOwner(bookmark),
|
|
765
786
|
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {})
|
|
766
787
|
}
|
|
767
788
|
),
|
|
768
|
-
bookmark
|
|
789
|
+
isCurrentUserOwner(bookmark) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
769
790
|
designSystem.Button,
|
|
770
791
|
{
|
|
771
792
|
variant: "ghost",
|
|
772
793
|
size: "S",
|
|
773
794
|
onClick: (e) => {
|
|
774
795
|
e.stopPropagation();
|
|
775
|
-
handleDelete(bookmark
|
|
796
|
+
handleDelete(bookmark);
|
|
776
797
|
},
|
|
777
798
|
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
|
|
778
799
|
}
|
|
@@ -816,7 +837,7 @@ const HomePageModern = () => {
|
|
|
816
837
|
}
|
|
817
838
|
}
|
|
818
839
|
),
|
|
819
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
840
|
+
/* @__PURE__ */ jsxRuntime.jsx(FloatingIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(outline.SparklesIcon, {}) }),
|
|
820
841
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 6, style: { position: "relative", zIndex: 1 }, children: [
|
|
821
842
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
822
843
|
designSystem.Box,
|
|
@@ -831,7 +852,7 @@ const HomePageModern = () => {
|
|
|
831
852
|
justifyContent: "center",
|
|
832
853
|
boxShadow: theme.shadows.xl
|
|
833
854
|
},
|
|
834
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
855
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(outline.SparklesIcon, { style: { width: "60px", height: "60px", color: theme.colors.primary[600] } })
|
|
835
856
|
}
|
|
836
857
|
),
|
|
837
858
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7,7 +7,7 @@ const admin = require("@strapi/strapi/admin");
|
|
|
7
7
|
const styled = require("styled-components");
|
|
8
8
|
const designSystem = require("@strapi/design-system");
|
|
9
9
|
const icons = require("@strapi/icons");
|
|
10
|
-
const index = require("./index-
|
|
10
|
+
const index = require("./index-BKaROSTg.js");
|
|
11
11
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
12
12
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
13
13
|
const Container = styled__default.default(designSystem.Box)`
|
|
@@ -5,7 +5,7 @@ import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
|
5
5
|
import styled from "styled-components";
|
|
6
6
|
import { Flex, Typography, Box, Badge, Button } from "@strapi/design-system";
|
|
7
7
|
import { Check, Cross, Sparkle, Lightning, Rocket } from "@strapi/icons";
|
|
8
|
-
import { p as pluginId } from "./index-
|
|
8
|
+
import { p as pluginId } from "./index-DF8ICn1F.mjs";
|
|
9
9
|
const Container = styled(Box)`
|
|
10
10
|
padding: 32px;
|
|
11
11
|
max-width: 1400px;
|