Skip to content

Commit

Permalink
fix: highlight design page nav item (#2433)
Browse files Browse the repository at this point in the history
Co-authored-by: Andy Brown <asbrown002@gmail.com>
  • Loading branch information
liweitian and a-b-r-o-w-n authored Mar 30, 2020
1 parent 7f6a3bd commit c950c51
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Composer/packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Onboarding = React.lazy(() => import('./Onboarding'));
// eslint-disable-next-line react/display-name
const Content = forwardRef<HTMLDivElement>((props, ref) => <div css={content} {...props} ref={ref} />);

const topLinks = (projectId: string) => {
const topLinks = (projectId: string, openedDialogId: string) => {
const botLoaded = !!projectId;
let links = [
{
Expand All @@ -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,
Expand Down Expand Up @@ -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 (
<Fragment>
<Header botName={`${botName}(${locale})`} />
Expand All @@ -139,7 +140,7 @@ export const App: React.FC = () => {
/>
<div css={dividerTop} />{' '}
<FocusZone allowFocusRoot={true}>
{topLinks(projectId).map((link, index) => {
{topLinks(projectId, openedDialogId).map((link, index) => {
return (
<NavItem
key={'NavLeftBar' + index}
Expand Down

0 comments on commit c950c51

Please sign in to comment.