Virtual whiteboard for sketching hand-drawn like diagrams
fix: Don't show export and delete when library is empty (#3288)
Aakansha Doshi13d9374cdeea
diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsxindex 3ceb8deb00..1e2878c0fa 100644--- a/src/components/LayerUI.tsx+++ b/src/components/LayerUI.tsx@@ -144,34 +144,37 @@ const LibraryMenuItems = ({});}}/>- <ToolButton- key="export"- type="button"- title={t("buttons.export")}- aria-label={t("buttons.export")}- icon={exportFile}- onClick={() => {- saveLibraryAsJSON()- .catch(muteFSAbortError)- .catch((error) => {- setAppState({ errorMessage: error.message });- });- }}- />- <ToolButton- key="reset"- type="button"- title={t("buttons.resetLibrary")}- aria-label={t("buttons.resetLibrary")}- icon={trash}- onClick={() => {- if (window.confirm(t("alerts.resetLibrary"))) {- Library.resetLibrary();- setLibraryItems([]);- }- }}- />-+ {!!library.length && (+ <>+ <ToolButton+ key="export"+ type="button"+ title={t("buttons.export")}+ aria-label={t("buttons.export")}+ icon={exportFile}+ onClick={() => {+ saveLibraryAsJSON()+ .catch(muteFSAbortError)+ .catch((error) => {+ setAppState({ errorMessage: error.message });+ });+ }}+ />+ <ToolButton+ key="reset"+ type="button"+ title={t("buttons.resetLibrary")}+ aria-label={t("buttons.resetLibrary")}+ icon={trash}+ onClick={() => {+ if (window.confirm(t("alerts.resetLibrary"))) {+ Library.resetLibrary();+ setLibraryItems([]);+ }+ }}+ />+ </>+ )}<ahref={`https://libraries.excalidraw.com?referrer=${referrer}`}target="_excalidraw_libraries"