refactor: Stats component (#5610)

refactor: stats component
This commit is contained in:
Aakansha Doshi 2022-08-22 17:18:25 +05:30 committed by GitHub
parent ba2c86fe1b
commit 32d82219b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 30 deletions

View file

@ -412,23 +412,6 @@ const LayerUI = ({
</>
);
const renderStats = () => {
if (!appState.showStats) {
return null;
}
return (
<Stats
appState={appState}
setAppState={setAppState}
elements={elements}
onClose={() => {
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 && (
<Stats
appState={appState}
setAppState={setAppState}
elements={elements}
onClose={() => {
actionManager.executeAction(actionToggleStats);
}}
renderCustomStats={renderCustomStats}
/>
)}
{appState.scrolledOutside && (
<button
className="scroll-back-to-content"