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

fixes internal dropdown link not redirecting #2678

Merged
merged 6 commits into from
Nov 6, 2023
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
38 changes: 22 additions & 16 deletions src/components/Header/UserToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import './UserToggle.scss';

import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core/dist/dynamic/components/Dropdown';
import { ITLess, ITLessCognito, getEnv, isProd as isProdEnv } from '../../utils/common';
import React, { useRef, useState } from 'react';

import ChromeLink from '../ChromeLink/ChromeLink';
import { Divider } from '@patternfly/react-core/dist/dynamic/components/Divider';
import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core/dist/dynamic/components/Dropdown';
import { EllipsisVIcon } from '@patternfly/react-icons/dist/dynamic/icons/ellipsis-v-icon';
import { MenuToggle } from '@patternfly/react-core/dist/dynamic/components/MenuToggle';
import { Tooltip } from '@patternfly/react-core/dist/dynamic/components/Tooltip';
import QuestionCircleIcon from '@patternfly/react-icons/dist/dynamic/icons/question-circle-icon';
import UserIcon from './UserIcon';
import { useSelector } from 'react-redux';
import { ITLess, ITLessCognito, getEnv, isProd as isProdEnv } from '../../utils/common';
import ChromeLink from '../ChromeLink/ChromeLink';
import { useIntl } from 'react-intl';
import messages from '../../locales/Messages';
import { ReduxState } from '../../redux/store';
import { logout } from '../../jwt/jwt';
import { cogLogout } from '../../cognito/auth';
import { EllipsisVIcon } from '@patternfly/react-icons/dist/dynamic/icons/ellipsis-v-icon';
import { Tooltip } from '@patternfly/react-core/dist/dynamic/components/Tooltip';
import UserIcon from './UserIcon';
import classNames from 'classnames';

import './UserToggle.scss';
import { cogLogout } from '../../cognito/auth';
import { logout } from '../../jwt/jwt';
import messages from '../../locales/Messages';
import { useIntl } from 'react-intl';
import { useSelector } from 'react-redux';

const buildItems = (username = '', isOrgAdmin?: boolean, accountNumber?: string, isInternal?: boolean, extraItems: React.ReactNode[] = []) => {
const env = getEnv();
Expand Down Expand Up @@ -92,9 +93,14 @@ const buildItems = (username = '', isOrgAdmin?: boolean, accountNumber?: string,
</React.Fragment>,
<React.Fragment key="internal wrapper">
{isInternal && isProd && (
<DropdownItem key="Internal" href="./internal">
{intl.formatMessage(messages.internal)}
</DropdownItem>
<DropdownItem
key="Internal"
component={({ className }) => (
<ChromeLink className={className} href="/internal" appId="internal">
{intl.formatMessage(messages.internal)}
</ChromeLink>
)}
/>
)}
</React.Fragment>,
<DropdownItem key="logout" component="button" onClick={() => (ITLessCognito() ? cogLogout() : logout(true))}>
Expand Down
Loading