Virtual whiteboard for sketching hand-drawn like diagrams
feat: support resubmitting published library items (#5174)
David Luzarb27ac257e7f9
diff --git a/src/components/LibraryMenuItems.tsx b/src/components/LibraryMenuItems.tsxindex a1c1835531..4ed58720b2 100644--- a/src/components/LibraryMenuItems.tsx+++ b/src/components/LibraryMenuItems.tsx@@ -172,7 +172,7 @@ const LibraryMenuItems = ({</ToolButton></>)}- {itemsSelected && !isPublished && (+ {itemsSelected && (<Tooltip label={t("hints.publishLibrary")}><ToolButtontype="button"@@ -199,9 +199,6 @@ const LibraryMenuItems = ({const referrer =libraryReturnUrl || window.location.origin + window.location.pathname;- const isPublished = selectedItems.some(- (id) => libraryItems.find((item) => item.id === id)?.status === "published",- );const [lastSelectedItem, setLastSelectedItem] = useState<LibraryItem["id"] | nulldiff --git a/src/components/PublishLibrary.scss b/src/components/PublishLibrary.scssindex 400e156ded..7063b7881d 100644--- a/src/components/PublishLibrary.scss+++ b/src/components/PublishLibrary.scss@@ -82,6 +82,10 @@}}+ &-warning {+ color: $oc-red-6;+ }+&-note {padding: 1em;font-style: italic;diff --git a/src/components/PublishLibrary.tsx b/src/components/PublishLibrary.tsxindex adcc90a4a7..37543b6b06 100644--- a/src/components/PublishLibrary.tsx+++ b/src/components/PublishLibrary.tsx@@ -295,6 +295,11 @@ const PublishLibrary = ({}, [clonedLibItems, onClose, updateItemsInStorage, libraryData]);const shouldRenderForm = !!libraryItems.length;++ const containsPublishedItems = libraryItems.some(+ (item) => item.status === "published",+ );+return (<DialogonCloseRequest={onDialogClose}@@ -329,6 +334,11 @@ const PublishLibrary = ({<div className="publish-library-note">{t("publishDialog.noteItems")}</div>+ {containsPublishedItems && (+ <span className="publish-library-note publish-library-warning">+ {t("publishDialog.republishWarning")}+ </span>+ )}{renderLibraryItems()}<div className="publish-library__fields"><label>diff --git a/src/components/SingleLibraryItem.scss b/src/components/SingleLibraryItem.scssindex c065552844..0a42992a15 100644--- a/src/components/SingleLibraryItem.scss+++ b/src/components/SingleLibraryItem.scss@@ -3,11 +3,24 @@.excalidraw {.single-library-item {position: relative;++ &-status {+ position: absolute;+ top: 0.3rem;+ left: 0.3rem;+ font-size: 0.7rem;+ color: $oc-red-7;+ background: rgba(255, 255, 255, 0.9);+ padding: 0.1rem 0.2rem;+ border-radius: 0.2rem;+ }+&__svg {+ background-color: $oc-white;+ padding: 0.3rem;width: 7.5rem;height: 7.5rem;border: 1px solid var(--button-gray-2);- margin: 0.3rem;svg {width: 100%;height: 100%;@@ -40,7 +53,7 @@&--remove {position: absolute;top: 0.2rem;- right: 1.3rem;+ right: 1rem;.ToolIcon__icon {margin: 0;diff --git a/src/components/SingleLibraryItem.tsx b/src/components/SingleLibraryItem.tsxindex c85b7dfe8e..2dc81295ec 100644--- a/src/components/SingleLibraryItem.tsx+++ b/src/components/SingleLibraryItem.tsx@@ -45,6 +45,11 @@ const SingleLibraryItem = ({return (<div className="single-library-item">+ {libItem.status === "published" && (+ <span className="single-library-item-status">+ {t("labels.statusPublished")}+ </span>+ )}<div ref={svgRef} className="single-library-item__svg" /><ToolButtonaria-label={t("buttons.remove")}diff --git a/src/locales/en.json b/src/locales/en.jsonindex 168d1ce670..f6d887cf55 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -119,7 +119,8 @@"unlock": "Unlock","lockAll": "Lock all","unlockAll": "Unlock all"- }+ },+ "statusPublished": "Published"},"buttons": {"clearReset": "Reset the canvas",@@ -341,7 +342,8 @@"post": "which in short means anyone can use them without restrictions."},"noteItems": "Each library item must have its own name so it's filterable. The following library items will be included:",- "atleastOneLibItem": "Please select at least one library item to get started"+ "atleastOneLibItem": "Please select at least one library item to get started",+ "republishWarning": "Note: some of the selected items are marked as already published/submitted. You should only resubmit items when updating an existing library or submission."},"publishSuccessDialog": {"title": "Library submitted",