import React from 'react';
import { useMultiStyleConfig, HStack, Text, Box } from '@chakra-ui/react';
import { useI18n } from '../../../utilities/i18nInit.js';
import Hide from '../../hide/index.js';
import Avatar from '../../avatar/index.js';
import { DrawerIndicator } from './drawer/DrawerIndicator.js';
import { DrawerNode } from './config/DrawerNodeItems.js';

var NavigationAvatar = function (_a) {
    var user = _a.user, isOpen = _a.isOpen, drawer = _a.drawer, hasNotification = _a.hasNotification, createDrawerHandler = _a.createDrawerHandler, onLogin = _a.onLogin;
    var isDrawerOpened = isOpen && (drawer === null || drawer === void 0 ? void 0 : drawer.current) === DrawerNode.User;
    var linkStyles = useMultiStyleConfig('Link', { variant: 'navigationLink' });
    var t = useI18n().t;
    if (user) {
        return (React.createElement(Hide, { below: "sm" },
            React.createElement(HStack, { spacing: "xs", cursor: "pointer", _hover: { color: 'blue.700' }, color: isDrawerOpened ? 'blue.700' : 'gray.900', onClick: createDrawerHandler({
                    nodeName: DrawerNode.User,
                }) },
                React.createElement(Avatar, { withNotification: hasNotification }),
                React.createElement(Hide, { below: "md" },
                    React.createElement(Text, { fontWeight: "bold", noOfLines: 1, maxW: "2xl", title: user.email }, user.email)),
                React.createElement(DrawerIndicator, { isOpen: isDrawerOpened }))));
    }
    return (React.createElement(Hide, { below: "sm" },
        React.createElement(HStack, { onClick: onLogin, __css: linkStyles.link, fontWeight: "bold", position: "relative", top: "1px" },
            React.createElement(Box, { as: Avatar, marginLeft: "2px" }),
            React.createElement(Hide, { below: "md", marginRight: "xs" }, t('header.login')))));
};

export { NavigationAvatar };
//# sourceMappingURL=NavigationAvatar.js.map
