import * as React from "react"; import * as Constants from "~/common/constants"; import * as SVG from "~/common/svg"; import { TooltipWrapper, dispatchCustomEvent, PopoverNavigation, } from "~/components/system"; import { css } from "@emotion/react"; import { Boundary } from "~/components/system/components/fragments/Boundary"; import CircleButtonLight from "~/components/core/CircleButtonLight"; const APPLICATION_CONTROL_MENU_ID = "application-control-menu"; const STYLES_HEADER = css` display: block; position: relative; width: 100%; padding: 64px 24px 48px 42px; @media (max-width: ${Constants.sizes.mobile}px) { padding: 64px 0 48px 16px; } `; const STYLES_FLEX_ROW = css` display: flex; align-items: flex-start; justify-content: space-between; width: 100%; max-width: 228px; `; const STYLES_PROFILE = css` display: flex; align-items: flex-start; justify-content: flex-start; min-width: 10%; width: 100%; font-family: ${Constants.font.semiBold}; color: ${Constants.system.pitchBlack}; background-color: ${Constants.system.white}; font-size: 12px; line-height: 12px; text-decoration: none; padding-right: 24px; border-radius: 32px; min-height: 38px; transition: 200ms ease all; cursor: pointer; :hover { color: ${Constants.system.white}; background-color: ${Constants.system.brand}; } @media (max-width: ${Constants.sizes.mobile}px) { display: none; } `; const STYLES_PROFILE_IMAGE = css` background-size: cover; background-position: 50% 50%; flex-shrink: 0; height: 32px; width: 32px; border-radius: 32px; margin-left: 3px; margin-top: 3px; `; const STYLES_PROFILE_USERNAME = css` min-width: 10%; width: 100%; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; padding: 12px 0 12px 16px; user-select: none; `; export default class ApplicationUserControls extends React.Component { state = { visible: false }; _handleClick = (e) => { this.setState({ visible: !this.state.visible }); dispatchCustomEvent({ name: "show-tooltip", detail: { id: APPLICATION_CONTROL_MENU_ID, }, }); }; _handleHide = () => { this.setState({ visible: false }); return dispatchCustomEvent({ name: "hide-tooltip", detail: { id: APPLICATION_CONTROL_MENU_ID, }, }); }; _handleNavigateTo = (data) => { this._handleHide(); return this.props.onNavigateTo(data); }; _handleAction = (data) => { this._handleHide(); return this.props.onAction(data); }; _handleSignOut = (data) => { this._handleHide(); return this.props.onSignOut(data); }; render() { return (