Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: highlight design page nav item #2433

Merged
merged 2 commits into from
Mar 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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