// @flow import 'scss/component/_header.scss'; import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button'; import * as ICONS from 'constants/icons'; import * as PAGES from 'constants/pages'; import ChannelThumbnail from 'component/channelThumbnail'; import classnames from 'classnames'; import HeaderMenuLink from 'component/common/header-menu-link'; import Icon from 'component/common/icon'; import React from 'react'; import Skeleton from '@mui/material/Skeleton'; type HeaderMenuButtonProps = { myChannelClaimIds: ?Array, activeChannelClaim: ?ChannelClaim, authenticated: boolean, email: ?string, signOut: () => void, }; export default function HeaderProfileMenuButton(props: HeaderMenuButtonProps) { const { myChannelClaimIds, activeChannelClaim, authenticated, email, signOut } = props; const activeChannelUrl = activeChannelClaim && activeChannelClaim.permanent_url; // activeChannel will be: undefined = fetching, null = nothing, or { channel claim } const noActiveChannel = activeChannelUrl === null; const pendingChannelFetch = !noActiveChannel && myChannelClaimIds === undefined; return (
{pendingChannelFetch ? ( ) : ( {activeChannelUrl ? ( ) : ( )} )} {authenticated ? ( <>
{__('Sign Out')}
{email}
) : ( <> )}
); }