From c950c5136e79fcd13c9602157d33bba122278799 Mon Sep 17 00:00:00 2001 From: liweitian Date: Tue, 31 Mar 2020 00:59:05 +0800 Subject: [PATCH] fix: highlight design page nav item (#2433) Co-authored-by: Andy Brown --- Composer/packages/client/src/App.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Composer/packages/client/src/App.tsx b/Composer/packages/client/src/App.tsx index c2d1f5db62..1e426c074e 100644 --- a/Composer/packages/client/src/App.tsx +++ b/Composer/packages/client/src/App.tsx @@ -28,7 +28,7 @@ const Onboarding = React.lazy(() => import('./Onboarding')); // eslint-disable-next-line react/display-name const Content = forwardRef((props, ref) =>
); -const topLinks = (projectId: string) => { +const topLinks = (projectId: string, openedDialogId: string) => { const botLoaded = !!projectId; let links = [ { @@ -39,7 +39,7 @@ const topLinks = (projectId: string) => { disabled: false, }, { - to: `/bot/${projectId}/dialogs/Main`, + to: `/bot/${projectId}/dialogs/${openedDialogId}`, iconName: 'SplitObject', labelName: formatMessage('Design Flow'), exact: false, @@ -116,10 +116,11 @@ const bottomLinks = [ export const App: React.FC = () => { const { state, actions } = useContext(StoreContext); const [sideBarExpand, setSideBarExpand] = useState(false); - const { botName, projectId, creationFlowStatus, locale } = state; + const { botName, projectId, dialogs, creationFlowStatus, locale, designPageLocation } = state; const { setCreationFlowStatus } = actions; const mapNavItemTo = x => resolveToBasePath(BASEPATH, x); + const openedDialogId = designPageLocation.dialogId || dialogs.find(({ isRoot }) => isRoot === true)?.id || 'Main'; return (
@@ -139,7 +140,7 @@ export const App: React.FC = () => { />
{' '} - {topLinks(projectId).map((link, index) => { + {topLinks(projectId, openedDialogId).map((link, index) => { return (