From dac50c33e9cf23e815132cdc4cc682a5ea9f2d90 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 23 Oct 2022 08:18:41 -0700 Subject: [PATCH] Fix status load error of starred on try mode. --- .../editor/src/components/app-bar/index.tsx | 14 ++++++++------ .../editor-toolbar/configBuilder.tsx | 18 +++++++++--------- .../{app-bar => }/editor-toolbar/index.tsx | 8 ++++---- packages/editor/src/components/index.tsx | 4 ++-- .../editor/src/components/toolbar/index.tsx | 7 ++++++- .../{app-bar => }/zoom-panel/index.tsx | 12 ++++++------ .../editor/test/unit/toolbar/toolbar.test.tsx | 2 +- 7 files changed, 36 insertions(+), 29 deletions(-) rename packages/editor/src/components/{app-bar => }/editor-toolbar/configBuilder.tsx (95%) rename packages/editor/src/components/{app-bar => }/editor-toolbar/index.tsx (85%) rename packages/editor/src/components/{app-bar => }/zoom-panel/index.tsx (90%) diff --git a/packages/editor/src/components/app-bar/index.tsx b/packages/editor/src/components/app-bar/index.tsx index 3c81c9eb..5b10ce66 100644 --- a/packages/editor/src/components/app-bar/index.tsx +++ b/packages/editor/src/components/app-bar/index.tsx @@ -69,12 +69,14 @@ const AppBar = ({ model, mapInfo, capability, onAction, accountConfig }: AppBarP }; useEffect(() => { - mapInfo - .isStarred() - .then((value) => setStarred(value)) - .catch((e) => { - console.error(`Unexpected error loading starred status-> ${e}`); - }); + if (!capability.isHidden('starred')) { + mapInfo + .isStarred() + .then((value) => setStarred(value)) + .catch((e) => { + console.error(`Unexpected error loading starred status-> ${e}`); + }); + } }, []); const config: ActionConfig[] = [ diff --git a/packages/editor/src/components/app-bar/editor-toolbar/configBuilder.tsx b/packages/editor/src/components/editor-toolbar/configBuilder.tsx similarity index 95% rename from packages/editor/src/components/app-bar/editor-toolbar/configBuilder.tsx rename to packages/editor/src/components/editor-toolbar/configBuilder.tsx index 15ee03a0..c69bebf3 100644 --- a/packages/editor/src/components/app-bar/editor-toolbar/configBuilder.tsx +++ b/packages/editor/src/components/editor-toolbar/configBuilder.tsx @@ -35,15 +35,15 @@ import AddCircleOutlineOutlinedIcon from '@mui/icons-material/AddCircleOutlineOu import Palette from '@mui/icons-material/Square'; import SquareOutlined from '@mui/icons-material/SquareOutlined'; -import ActionConfig from '../../../classes/action/action-config'; -import { SwitchValueDirection } from '../../toolbar/ToolbarValueModelBuilder'; -import NodePropertyValueModelBuilder from '../../../classes/model/node-property-builder'; -import ColorPicker from '../../action-widget/pane/color-picker'; -import TopicLink from '../../action-widget/pane/topic-link'; -import TopicNote from '../../action-widget/pane/topic-note'; -import IconPicker from '../../action-widget/pane/icon-picker'; -import FontFamilySelector from '../../action-widget/button/font-family-selector'; -import Editor from '../../../classes/model/editor'; +import ActionConfig from '../../classes/action/action-config'; +import { SwitchValueDirection } from '../toolbar/ToolbarValueModelBuilder'; +import NodePropertyValueModelBuilder from '../../classes/model/node-property-builder'; +import ColorPicker from '../action-widget/pane/color-picker'; +import TopicLink from '../action-widget/pane/topic-link'; +import TopicNote from '../action-widget/pane/topic-note'; +import IconPicker from '../action-widget/pane/icon-picker'; +import FontFamilySelector from '../action-widget/button/font-family-selector'; +import Editor from '../../classes/model/editor'; import { useIntl } from 'react-intl'; const keyTooltip = (msg: string, key: string): string => { diff --git a/packages/editor/src/components/app-bar/editor-toolbar/index.tsx b/packages/editor/src/components/editor-toolbar/index.tsx similarity index 85% rename from packages/editor/src/components/app-bar/editor-toolbar/index.tsx rename to packages/editor/src/components/editor-toolbar/index.tsx index 06697ac0..5f757bf6 100644 --- a/packages/editor/src/components/app-bar/editor-toolbar/index.tsx +++ b/packages/editor/src/components/editor-toolbar/index.tsx @@ -16,10 +16,10 @@ * limitations under the License. */ import React from 'react'; -import ActionConfig from '../../../classes/action/action-config'; -import Capability from '../../../classes/action/capability'; -import Model from '../../../classes/model/editor'; -import Toolbar from '../../toolbar'; +import ActionConfig from '../../classes/action/action-config'; +import Capability from '../../classes/action/capability'; +import Model from '../../classes/model/editor'; +import Toolbar from '../toolbar'; import { buildEditorPanelConfig } from './configBuilder'; type EditorToolbarProps = { diff --git a/packages/editor/src/components/index.tsx b/packages/editor/src/components/index.tsx index 52b09337..83ec5384 100644 --- a/packages/editor/src/components/index.tsx +++ b/packages/editor/src/components/index.tsx @@ -39,8 +39,8 @@ import AppBar from './app-bar'; import Capability from '../classes/action/capability'; import { ToolbarActionType } from './toolbar/ToolbarActionType'; import MapInfo from '../classes/model/map-info'; -import EditorToolbar from './app-bar/editor-toolbar'; -import ZoomPanel from './app-bar/zoom-panel'; +import EditorToolbar from './editor-toolbar'; +import ZoomPanel from './zoom-panel'; export type EditorOptions = { mode: EditorRenderMode; diff --git a/packages/editor/src/components/toolbar/index.tsx b/packages/editor/src/components/toolbar/index.tsx index 2ea487be..34979d0d 100644 --- a/packages/editor/src/components/toolbar/index.tsx +++ b/packages/editor/src/components/toolbar/index.tsx @@ -34,7 +34,12 @@ import ActionConfig from '../../classes/action/action-config'; export const ToolbarButtonOption = (props: { configuration: ActionConfig }) => { const selected = props.configuration.selected && props.configuration.selected(); return ( - + { fireEvent.mouseOver(btn); - await screen.findByText('tooltip'); + //await screen.findByText('tooltip'); }); it('Given an option with a function icon implementation shows the icon on the button', () => {