From 61c4fd98893792dabac1dddd3a75014b04009d1d Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Fri, 25 Feb 2022 10:38:11 -0800 Subject: [PATCH] Clean up logic --- packages/editor/src/components/footer/index.tsx | 7 ++++--- packages/editor/src/components/toolbar/index.tsx | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/editor/src/components/footer/index.tsx b/packages/editor/src/components/footer/index.tsx index 52e1b8ce..1b10f9b0 100644 --- a/packages/editor/src/components/footer/index.tsx +++ b/packages/editor/src/components/footer/index.tsx @@ -7,12 +7,13 @@ import AddSvg from '../../../images/add.svg'; import MinusSvg from '../../../images/minus.svg'; import CenterFocusSvg from '../../../images/center_focus.svg'; import ActionButton from '../action-button'; +import { EditorRenderMode } from '@wisemapping/mindplot'; export type FooterPropsType = { - showTryPanel?: boolean; + editorMode: EditorRenderMode; }; -const Footer = ({ showTryPanel }: FooterPropsType): React.ReactElement => { +const Footer = ({ editorMode }: FooterPropsType): React.ReactElement => { const intl = useIntl(); return ( @@ -37,7 +38,7 @@ const Footer = ({ showTryPanel }: FooterPropsType): React.ReactElement => { - {showTryPanel && ( + {editorMode === 'showcase' && (

{intl.formatMessage({ id: 'editor.try-welcome' })}

{intl.formatMessage({ id: 'editor.try-welcome-description' })}

diff --git a/packages/editor/src/components/toolbar/index.tsx b/packages/editor/src/components/toolbar/index.tsx index 55a2ad6d..c86ae3ed 100644 --- a/packages/editor/src/components/toolbar/index.tsx +++ b/packages/editor/src/components/toolbar/index.tsx @@ -28,16 +28,17 @@ import './global-styled.css'; import { HeaderContainer, ToolbarButton, ToolbarButtonExt, ToolbarRightContainer } from './styled'; import ActionButton from '../action-button'; +import { EditorRenderMode } from '@wisemapping/mindplot'; export type ToolbarActionType = 'export' | 'publish' | 'history' | 'print' | 'share'; export type ToolbarPropsType = { - isTryMode: boolean; + editorMode: EditorRenderMode; onAction: (action: ToolbarActionType) => void; }; export default function Toolbar({ - isTryMode: isTryMode, + editorMode: editorMode, onAction, }: ToolbarPropsType): React.ReactElement { const intl = useIntl(); @@ -47,7 +48,7 @@ export default function Toolbar({
- {!isTryMode && ( + {editorMode === 'edition' && (
@@ -111,7 +112,7 @@ export default function Toolbar({
- {!isTryMode && ( + {editorMode === 'edition' && (