From 2b4462c9411c4b089ef409749f92062f2646c060 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Fri, 26 Aug 2022 11:46:34 +0530 Subject: [PATCH] refactor: reuse common ui dialogs and message for mobile and LayerUI (#5611) * refactor: Move common UI dialogs to component * refactor * fix --- src/components/LayerUI.tsx | 137 ++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 71 deletions(-) diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx index 2d871508..2db1786b 100644 --- a/src/components/LayerUI.tsx +++ b/src/components/LayerUI.tsx @@ -381,7 +381,7 @@ const LayerUI = ({ ); }; - const dialogs = ( + return ( <> {appState.isLoading && } {appState.errorMessage && ( @@ -409,82 +409,77 @@ const LayerUI = ({ } /> )} - - ); - - return device.isMobile ? ( - <> - {dialogs} - onLockToggle()} - onPenModeToggle={onPenModeToggle} - canvas={canvas} - isCollaborating={isCollaborating} - renderCustomFooter={renderCustomFooter} - showThemeBtn={showThemeBtn} - onImageAction={onImageAction} - renderTopRightUI={renderTopRightUI} - renderCustomStats={renderCustomStats} - /> - - ) : ( - <> -
- {dialogs} - {renderFixedSideContainer()} -
onLockToggle()} + onPenModeToggle={onPenModeToggle} + canvas={canvas} + isCollaborating={isCollaborating} renderCustomFooter={renderCustomFooter} - showExitZenModeBtn={showExitZenModeBtn} + showThemeBtn={showThemeBtn} + onImageAction={onImageAction} + renderTopRightUI={renderTopRightUI} + renderCustomStats={renderCustomStats} /> - {appState.showStats && ( - + {renderFixedSideContainer()} +
{ - actionManager.executeAction(actionToggleStats); - }} - renderCustomStats={renderCustomStats} + actionManager={actionManager} + renderCustomFooter={renderCustomFooter} + showExitZenModeBtn={showExitZenModeBtn} /> - )} - {appState.scrolledOutside && ( - - )} -
+ {appState.showStats && ( + { + actionManager.executeAction(actionToggleStats); + }} + renderCustomStats={renderCustomStats} + /> + )} + {appState.scrolledOutside && ( + + )} + + )} {appState.isLibraryOpen && (
{libraryMenu}
)}