From 83992b4d120832dff6926d6a585b921ea5c95e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 9 Oct 2024 18:03:33 +0200 Subject: [PATCH] pl-fe: Show account card on hover in notification labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/src/components/account.tsx | 4 ++-- packages/pl-fe/src/components/hover-ref-wrapper.tsx | 5 ++--- packages/pl-fe/src/components/parsed-content.tsx | 2 +- packages/pl-fe/src/components/status-mention.tsx | 4 ++-- packages/pl-fe/src/components/status-reply-mentions.tsx | 2 +- packages/pl-fe/src/features/admin/components/report.tsx | 6 +++--- .../src/features/directory/components/account-card.tsx | 2 +- .../features/notifications/components/notification.tsx | 9 +++++---- .../ui/components/profile-familiar-followers.tsx | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/pl-fe/src/components/account.tsx b/packages/pl-fe/src/components/account.tsx index dc7d6cdd0..34405e360 100644 --- a/packages/pl-fe/src/components/account.tsx +++ b/packages/pl-fe/src/components/account.tsx @@ -249,7 +249,7 @@ const Account = ({ {withAvatar && ( {children}} + wrapper={(children) => {children}} > @@ -267,7 +267,7 @@ const Account = ({
{children}} + wrapper={(children) => {children}} > diff --git a/packages/pl-fe/src/components/hover-ref-wrapper.tsx b/packages/pl-fe/src/components/hover-ref-wrapper.tsx index 5c2a0d5f2..9c38324b6 100644 --- a/packages/pl-fe/src/components/hover-ref-wrapper.tsx +++ b/packages/pl-fe/src/components/hover-ref-wrapper.tsx @@ -13,19 +13,18 @@ const showAccountHoverCard = debounce((openAccountHoverCard, ref, accountId) => interface IHoverRefWrapper { accountId: string; - inline?: boolean; + element?: 'div' | 'span' | 'bdi'; className?: string; children: React.ReactNode; } /** Makes a profile hover card appear when the wrapped element is hovered. */ -const HoverRefWrapper: React.FC = ({ accountId, children, inline = false, className }) => { +const HoverRefWrapper: React.FC = ({ accountId, children, element: Elem = 'div', className }) => { const dispatch = useAppDispatch(); const { openAccountHoverCard, closeAccountHoverCard } = useAccountHoverCardStore(); const ref = useRef(null); - const Elem: keyof JSX.IntrinsicElements = inline ? 'span' : 'div'; const handleMouseEnter = () => { if (!isMobile(window.innerWidth)) { diff --git a/packages/pl-fe/src/components/parsed-content.tsx b/packages/pl-fe/src/components/parsed-content.tsx index 30fa3a03b..698fcea22 100644 --- a/packages/pl-fe/src/components/parsed-content.tsx +++ b/packages/pl-fe/src/components/parsed-content.tsx @@ -70,7 +70,7 @@ const ParsedContent: React.FC = (({ html, mentions, hasQuote }) const mention = mentions.find(({ url }) => domNode.attribs.href === url); if (mention) { return ( - + = ({ accountId, fallback }) => { const { account } = useAccount(accountId); if (!account) return ( - + {fallback} ); return ( - + = ({ status, hoverable if (hoverable) { return ( - + {link} ); diff --git a/packages/pl-fe/src/features/admin/components/report.tsx b/packages/pl-fe/src/features/admin/components/report.tsx index 8c7dbf9df..56fd51e64 100644 --- a/packages/pl-fe/src/features/admin/components/report.tsx +++ b/packages/pl-fe/src/features/admin/components/report.tsx @@ -78,7 +78,7 @@ const Report: React.FC = ({ id }) => { return ( - + = ({ id }) => { id='admin.reports.report_title' defaultMessage='Report on {acct}' values={{ acct: ( - + @{acct} ) }} @@ -131,7 +131,7 @@ const Report: React.FC = ({ id }) => { - + = ({ id }) => { className='h-32 w-full rounded-t-lg object-cover' /> - + ): JSX.Element => ( - +const buildLink = (account: Pick): JSX.Element => ( + - + ); const icons: Partial> = { @@ -145,7 +146,7 @@ const messages: Record = defineMe const buildMessage = ( intl: IntlShape, type: NotificationType | 'reply', - accounts: Array>, + accounts: Array>, targetName: string, instanceTitle: string, ): React.ReactNode => { diff --git a/packages/pl-fe/src/features/ui/components/profile-familiar-followers.tsx b/packages/pl-fe/src/features/ui/components/profile-familiar-followers.tsx index 64ca7638e..7f27c5a00 100644 --- a/packages/pl-fe/src/features/ui/components/profile-familiar-followers.tsx +++ b/packages/pl-fe/src/features/ui/components/profile-familiar-followers.tsx @@ -45,7 +45,7 @@ const ProfileFamiliarFollowers: React.FC = ({ account } const accounts: Array = familiarFollowers.map(account => !!account && ( - +