From 32d82219b1d99ae71d0a63797b3f65de1d47c01e Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Mon, 22 Aug 2022 17:18:25 +0530 Subject: [PATCH] refactor: Stats component (#5610) refactor: stats component --- src/components/LayerUI.tsx | 31 ++++++++++++------------------ src/components/MobileMenu.tsx | 20 +++++++++++++++---- src/components/Stats.tsx | 6 +----- src/excalidraw-app/CustomStats.tsx | 6 +++++- src/excalidraw-app/index.tsx | 7 ++++++- 5 files changed, 40 insertions(+), 30 deletions(-) diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx index a4b28733..2d871508 100644 --- a/src/components/LayerUI.tsx +++ b/src/components/LayerUI.tsx @@ -412,23 +412,6 @@ const LayerUI = ({ ); - const renderStats = () => { - if (!appState.showStats) { - return null; - } - return ( - { - actionManager.executeAction(actionToggleStats); - }} - renderCustomStats={renderCustomStats} - /> - ); - }; - return device.isMobile ? ( <> {dialogs} @@ -449,7 +432,7 @@ const LayerUI = ({ showThemeBtn={showThemeBtn} onImageAction={onImageAction} renderTopRightUI={renderTopRightUI} - renderStats={renderStats} + renderCustomStats={renderCustomStats} /> ) : ( @@ -478,7 +461,17 @@ const LayerUI = ({ renderCustomFooter={renderCustomFooter} showExitZenModeBtn={showExitZenModeBtn} /> - {renderStats()} + {appState.showStats && ( + { + actionManager.executeAction(actionToggleStats); + }} + renderCustomStats={renderCustomStats} + /> + )} {appState.scrolledOutside && (