feat: support resubmitting published library items (#5174)
This commit is contained in:
parent
d2cc76e52e
commit
b27ac257e7
@ -172,7 +172,7 @@ const LibraryMenuItems = ({
|
|||||||
</ToolButton>
|
</ToolButton>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{itemsSelected && !isPublished && (
|
{itemsSelected && (
|
||||||
<Tooltip label={t("hints.publishLibrary")}>
|
<Tooltip label={t("hints.publishLibrary")}>
|
||||||
<ToolButton
|
<ToolButton
|
||||||
type="button"
|
type="button"
|
||||||
@ -199,9 +199,6 @@ const LibraryMenuItems = ({
|
|||||||
|
|
||||||
const referrer =
|
const referrer =
|
||||||
libraryReturnUrl || window.location.origin + window.location.pathname;
|
libraryReturnUrl || window.location.origin + window.location.pathname;
|
||||||
const isPublished = selectedItems.some(
|
|
||||||
(id) => libraryItems.find((item) => item.id === id)?.status === "published",
|
|
||||||
);
|
|
||||||
|
|
||||||
const [lastSelectedItem, setLastSelectedItem] = useState<
|
const [lastSelectedItem, setLastSelectedItem] = useState<
|
||||||
LibraryItem["id"] | null
|
LibraryItem["id"] | null
|
||||||
|
@ -82,6 +82,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-warning {
|
||||||
|
color: $oc-red-6;
|
||||||
|
}
|
||||||
|
|
||||||
&-note {
|
&-note {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
|
@ -295,6 +295,11 @@ const PublishLibrary = ({
|
|||||||
}, [clonedLibItems, onClose, updateItemsInStorage, libraryData]);
|
}, [clonedLibItems, onClose, updateItemsInStorage, libraryData]);
|
||||||
|
|
||||||
const shouldRenderForm = !!libraryItems.length;
|
const shouldRenderForm = !!libraryItems.length;
|
||||||
|
|
||||||
|
const containsPublishedItems = libraryItems.some(
|
||||||
|
(item) => item.status === "published",
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
onCloseRequest={onDialogClose}
|
onCloseRequest={onDialogClose}
|
||||||
@ -329,6 +334,11 @@ const PublishLibrary = ({
|
|||||||
<div className="publish-library-note">
|
<div className="publish-library-note">
|
||||||
{t("publishDialog.noteItems")}
|
{t("publishDialog.noteItems")}
|
||||||
</div>
|
</div>
|
||||||
|
{containsPublishedItems && (
|
||||||
|
<span className="publish-library-note publish-library-warning">
|
||||||
|
{t("publishDialog.republishWarning")}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
{renderLibraryItems()}
|
{renderLibraryItems()}
|
||||||
<div className="publish-library__fields">
|
<div className="publish-library__fields">
|
||||||
<label>
|
<label>
|
||||||
|
@ -3,11 +3,24 @@
|
|||||||
.excalidraw {
|
.excalidraw {
|
||||||
.single-library-item {
|
.single-library-item {
|
||||||
position: relative;
|
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 {
|
&__svg {
|
||||||
|
background-color: $oc-white;
|
||||||
|
padding: 0.3rem;
|
||||||
width: 7.5rem;
|
width: 7.5rem;
|
||||||
height: 7.5rem;
|
height: 7.5rem;
|
||||||
border: 1px solid var(--button-gray-2);
|
border: 1px solid var(--button-gray-2);
|
||||||
margin: 0.3rem;
|
|
||||||
svg {
|
svg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -40,7 +53,7 @@
|
|||||||
&--remove {
|
&--remove {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0.2rem;
|
top: 0.2rem;
|
||||||
right: 1.3rem;
|
right: 1rem;
|
||||||
|
|
||||||
.ToolIcon__icon {
|
.ToolIcon__icon {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -45,6 +45,11 @@ const SingleLibraryItem = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="single-library-item">
|
<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" />
|
<div ref={svgRef} className="single-library-item__svg" />
|
||||||
<ToolButton
|
<ToolButton
|
||||||
aria-label={t("buttons.remove")}
|
aria-label={t("buttons.remove")}
|
||||||
|
@ -119,7 +119,8 @@
|
|||||||
"unlock": "Unlock",
|
"unlock": "Unlock",
|
||||||
"lockAll": "Lock all",
|
"lockAll": "Lock all",
|
||||||
"unlockAll": "Unlock all"
|
"unlockAll": "Unlock all"
|
||||||
}
|
},
|
||||||
|
"statusPublished": "Published"
|
||||||
},
|
},
|
||||||
"buttons": {
|
"buttons": {
|
||||||
"clearReset": "Reset the canvas",
|
"clearReset": "Reset the canvas",
|
||||||
@ -341,7 +342,8 @@
|
|||||||
"post": "which in short means anyone can use them without restrictions."
|
"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:",
|
"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": {
|
"publishSuccessDialog": {
|
||||||
"title": "Library submitted",
|
"title": "Library submitted",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user