BottomSection.tsx 894 B

1234567891011121314151617181920212223242526272829
  1. import React from 'react';
  2. import _ from 'lodash';
  3. import SignIn from './SignIn';
  4. import BottomNavLinks from './BottomNavLinks';
  5. import { contextSrv } from 'app/core/services/context_srv';
  6. import config from '../../config';
  7. export default function BottomSection() {
  8. const navTree: any = _.cloneDeep(config.bootData.navTree);
  9. const bottomNav: any = _.filter(navTree, item => item.hideFromMenu);
  10. const isSignedIn = contextSrv.isSignedIn;
  11. const user = contextSrv.user;
  12. if (user && user.orgCount > 1) {
  13. const profileNode: any = _.find(bottomNav, { id: 'profile' });
  14. if (profileNode) {
  15. profileNode.showOrgSwitcher = true;
  16. }
  17. }
  18. return (
  19. <div className="sidemenu__bottom">
  20. {!isSignedIn && <SignIn />}
  21. {bottomNav.map((link, index) => {
  22. return <BottomNavLinks link={link} user={user} key={`${link.url}-${index}`} />;
  23. })}
  24. </div>
  25. );
  26. }