import React, { useState, useEffect } from 'react'; import { Link, withRouter } from 'react-router-dom'; import { withTranslation } from 'react-i18next'; import PropTypes from 'prop-types'; import ConnectedUserPreferencesForm from '../../connectedComponents/ConnectedUserPreferencesForm'; import { Dropdown, AboutContent, withModal } from '@ohif/ui'; import OHIFLogo from '../OHIFLogo/OHIFLogo.js'; import './Header.css'; // Context import AppContext from './../../context/AppContext'; function Header(props) { const { t, user, userManager, modal: { show }, home, location, children, } = props; const [options, setOptions] = useState([]); useEffect(() => { const optionsValue = [ { title: t('About'), icon: { name: 'info' }, onClick: () => show({ content: AboutContent, title: t('OHIF Viewer - About'), }), }, { title: t('Preferences'), icon: { name: 'user', }, onClick: () => show({ content: ConnectedUserPreferencesForm, title: t('User Preferences'), }), }, ]; if (user && userManager) { optionsValue.push({ title: t('Logout'), icon: { name: 'power-off' }, onClick: () => userManager.signoutRedirect(), }); } setOptions(optionsValue); }, [setOptions, show, t, user, userManager]); const { appConfig = {} } = AppContext; const showStudyList = appConfig.showStudyList !== undefined ? appConfig.showStudyList : true; // ANTD -- Hamburger, Drawer, Menu return ( <>