import PropTypes from 'prop-types'; import { useState, useRef, useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import Overlay from 'react-overlays/Overlay'; import BadgeIcon from '@/material-icons/400-24px/badge.svg?react'; import { Button } from 'mastodon/components/button'; import { Icon } from 'mastodon/components/icon'; export const BlueskyPill = ({ domain, username, isSelf }) => { const [open, setOpen] = useState(false); const triggerRef = useRef(null); const handleClick = useCallback(() => { setOpen(!open); }, [open, setOpen]); const handleBlueskyProfileOpenClick = useCallback(() => { window.open(`https://bsky.app/profile/${replacedUsername}.${replacedDomain}.ap.brid.gy`, '_blank'); }); const replacedUsername = username.replaceAll('_', '-'); const replacedDomain = domain.replaceAll('_', '-'); return ( <> bluesky {({ props }) => ( {isSelf ? : } @{replacedUsername}.{replacedDomain}.ap.brid.gy {isSelf ? : } )} > ); }; BlueskyPill.propTypes = { username: PropTypes.string.isRequired, domain: PropTypes.string.isRequired, isSelf: PropTypes.bool, };
{isSelf ? : }