From 13d9374cdeea2e5f6904ecb8c974474661ecc522 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Sat, 20 Mar 2021 21:58:37 +0530 Subject: [PATCH] fix: Don't show export and delete when library is empty (#3288) --- src/components/LayerUI.tsx | 59 ++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx index 3ceb8deb0..1e2878c0f 100644 --- a/src/components/LayerUI.tsx +++ b/src/components/LayerUI.tsx @@ -144,34 +144,37 @@ const LibraryMenuItems = ({ }); }} /> - { - saveLibraryAsJSON() - .catch(muteFSAbortError) - .catch((error) => { - setAppState({ errorMessage: error.message }); - }); - }} - /> - { - if (window.confirm(t("alerts.resetLibrary"))) { - Library.resetLibrary(); - setLibraryItems([]); - } - }} - /> - + {!!library.length && ( + <> + { + saveLibraryAsJSON() + .catch(muteFSAbortError) + .catch((error) => { + setAppState({ errorMessage: error.message }); + }); + }} + /> + { + if (window.confirm(t("alerts.resetLibrary"))) { + Library.resetLibrary(); + setLibraryItems([]); + } + }} + /> + + )}