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

Make dependencies tab configurable #122

Merged
Merged
Show file tree
Hide file tree
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
18 changes: 11 additions & 7 deletions src/components/App/TopNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Dropdown, Menu } from 'semantic-ui-react';

import TraceIDSearchInput from './TraceIDSearchInput';
import type { ConfigMenuItem, ConfigMenuGroup } from '../../types/config';
import getConfig from '../../utils/config/get-config';
import prefixUrl from '../../utils/prefix-url';

import './TopNav.css';
Expand Down Expand Up @@ -56,18 +57,21 @@ function CustomNavDropdown({ label, items }: ConfigMenuGroup) {
}

const NAV_LINKS = [
{
key: 'dependencies',
to: prefixUrl('/dependencies'),
text: 'Dependencies',
},
{
key: 'search',
to: prefixUrl('/search'),
text: 'Search',
},
];

if (getConfig().dependenciesMenuEnabled) {
NAV_LINKS.push({
key: 'dependencies',
to: prefixUrl('/dependencies'),
text: 'Dependencies',
});
}

export default function TopNav(props: TopNavProps) {
const { menuConfig } = props;
const menuItems = Array.isArray(menuConfig) ? menuConfig : [];
Expand All @@ -79,11 +83,11 @@ export default function TopNav(props: TopNavProps) {
<div className="ui input">
<TraceIDSearchInput />
</div>
{NAV_LINKS.map(({ key, to, text }) =>
{NAV_LINKS.map(({ key, to, text }) => (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

husky > npm run -s precommit (node v6.11.2)

does this change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavolloffay I don't follow... can you elaborate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that this changes it done automatically via git hooks not by me

<Link key={key} to={to} className="item">
{text}
</Link>
)}
))}
<div className="right menu">
{menuItems.map(item => {
if (item.items) {
Expand Down
1 change: 1 addition & 0 deletions src/constants/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ export default deepFreeze({
],
},
],
dependenciesMenuEnabled: true,
});