From cffc9d7332deed67dd3acbc619e34f08313c5c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 9 Oct 2024 18:04:39 +0200 Subject: [PATCH] pl-fe: rename HoverRefWrapper component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../pl-fe/src/components/account-hover-card.tsx | 2 +- packages/pl-fe/src/components/account.tsx | 6 +++--- ...r-ref-wrapper.tsx => hover-account-wrapper.tsx} | 8 ++++---- packages/pl-fe/src/components/parsed-content.tsx | 6 +++--- packages/pl-fe/src/components/status-mention.tsx | 10 +++++----- .../pl-fe/src/components/status-reply-mentions.tsx | 6 +++--- .../pl-fe/src/features/admin/components/report.tsx | 14 +++++++------- .../features/directory/components/account-card.tsx | 6 +++--- .../notifications/components/notification.tsx | 6 +++--- .../ui/components/profile-familiar-followers.tsx | 6 +++--- 10 files changed, 35 insertions(+), 35 deletions(-) rename packages/pl-fe/src/components/{hover-ref-wrapper.tsx => hover-account-wrapper.tsx} (83%) diff --git a/packages/pl-fe/src/components/account-hover-card.tsx b/packages/pl-fe/src/components/account-hover-card.tsx index b9df8ca04..0111fd32b 100644 --- a/packages/pl-fe/src/components/account-hover-card.tsx +++ b/packages/pl-fe/src/components/account-hover-card.tsx @@ -12,7 +12,7 @@ import { UserPanel } from 'pl-fe/features/ui/util/async-components'; import { useAppSelector, useAppDispatch } from 'pl-fe/hooks'; import { useAccountHoverCardStore } from 'pl-fe/stores'; -import { showAccountHoverCard } from './hover-ref-wrapper'; +import { showAccountHoverCard } from './hover-account-wrapper'; import { ParsedContent } from './parsed-content'; import { dateFormatOptions } from './relative-timestamp'; import Scrobble from './scrobble'; diff --git a/packages/pl-fe/src/components/account.tsx b/packages/pl-fe/src/components/account.tsx index 34405e360..70ecec5d5 100644 --- a/packages/pl-fe/src/components/account.tsx +++ b/packages/pl-fe/src/components/account.tsx @@ -2,7 +2,7 @@ import React, { useRef } from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; import { Link, useHistory } from 'react-router-dom'; -import HoverRefWrapper from 'pl-fe/components/hover-ref-wrapper'; +import HoverAccountWrapper from 'pl-fe/components/hover-account-wrapper'; import VerificationBadge from 'pl-fe/components/verification-badge'; import ActionButton from 'pl-fe/features/ui/components/action-button'; import { useAppSelector } from 'pl-fe/hooks'; @@ -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-account-wrapper.tsx similarity index 83% rename from packages/pl-fe/src/components/hover-ref-wrapper.tsx rename to packages/pl-fe/src/components/hover-account-wrapper.tsx index 9c38324b6..c14c86207 100644 --- a/packages/pl-fe/src/components/hover-ref-wrapper.tsx +++ b/packages/pl-fe/src/components/hover-account-wrapper.tsx @@ -11,7 +11,7 @@ const showAccountHoverCard = debounce((openAccountHoverCard, ref, accountId) => openAccountHoverCard(ref, accountId); }, 600); -interface IHoverRefWrapper { +interface IHoverAccountWrapper { accountId: string; element?: 'div' | 'span' | 'bdi'; className?: string; @@ -19,7 +19,7 @@ interface IHoverRefWrapper { } /** Makes a profile hover card appear when the wrapped element is hovered. */ -const HoverRefWrapper: React.FC = ({ accountId, children, element: Elem = 'div', className }) => { +const HoverAccountWrapper: React.FC = ({ accountId, children, element: Elem = 'div', className }) => { const dispatch = useAppDispatch(); const { openAccountHoverCard, closeAccountHoverCard } = useAccountHoverCardStore(); @@ -46,7 +46,7 @@ const HoverRefWrapper: React.FC = ({ accountId, children, elem return ( = ({ accountId, children, elem ); }; -export { HoverRefWrapper as default, showAccountHoverCard }; +export { HoverAccountWrapper as default, showAccountHoverCard }; diff --git a/packages/pl-fe/src/components/parsed-content.tsx b/packages/pl-fe/src/components/parsed-content.tsx index 698fcea22..234a86c85 100644 --- a/packages/pl-fe/src/components/parsed-content.tsx +++ b/packages/pl-fe/src/components/parsed-content.tsx @@ -4,7 +4,7 @@ import React, { useMemo } from 'react'; import { Link } from 'react-router-dom'; import HashtagLink from './hashtag-link'; -import HoverRefWrapper from './hover-ref-wrapper'; +import HoverAccountWrapper from './hover-account-wrapper'; import StatusMention from './status-mention'; import type { Mention } from 'pl-api'; @@ -70,7 +70,7 @@ const ParsedContent: React.FC = (({ html, mentions, hasQuote }) const mention = mentions.find(({ url }) => domNode.attribs.href === url); if (mention) { return ( - + = (({ html, mentions, hasQuote }) > @{mention.username} - + ); } } else if (domNode.attribs['data-user']) { diff --git a/packages/pl-fe/src/components/status-mention.tsx b/packages/pl-fe/src/components/status-mention.tsx index 1da87e0cf..b099ff21c 100644 --- a/packages/pl-fe/src/components/status-mention.tsx +++ b/packages/pl-fe/src/components/status-mention.tsx @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; import { useAccount } from 'pl-fe/api/hooks'; -import HoverRefWrapper from './hover-ref-wrapper'; +import HoverAccountWrapper from './hover-account-wrapper'; interface IStatusMention { accountId: string; @@ -14,13 +14,13 @@ const StatusMention: React.FC = ({ accountId, fallback }) => { const { account } = useAccount(accountId); if (!account) return ( - + {fallback} - + ); return ( - + = ({ accountId, fallback }) => { > @{account.acct} - + ); }; diff --git a/packages/pl-fe/src/components/status-reply-mentions.tsx b/packages/pl-fe/src/components/status-reply-mentions.tsx index a99a36624..c1f3469bb 100644 --- a/packages/pl-fe/src/components/status-reply-mentions.tsx +++ b/packages/pl-fe/src/components/status-reply-mentions.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { FormattedList, FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; -import HoverRefWrapper from 'pl-fe/components/hover-ref-wrapper'; +import HoverAccountWrapper from 'pl-fe/components/hover-account-wrapper'; import HoverStatusWrapper from 'pl-fe/components/hover-status-wrapper'; import { useModalsStore } from 'pl-fe/stores'; @@ -56,9 +56,9 @@ const StatusReplyMentions: React.FC = ({ status, hoverable if (hoverable) { return ( - + {link} - + ); } else { 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 56fd51e64..5f4cc11f6 100644 --- a/packages/pl-fe/src/features/admin/components/report.tsx +++ b/packages/pl-fe/src/features/admin/components/report.tsx @@ -5,7 +5,7 @@ import { Link } from 'react-router-dom'; import { closeReport } from 'pl-fe/actions/admin'; import { deactivateUserModal, deleteUserModal } from 'pl-fe/actions/moderation'; import DropdownMenu from 'pl-fe/components/dropdown-menu'; -import HoverRefWrapper from 'pl-fe/components/hover-ref-wrapper'; +import HoverAccountWrapper from 'pl-fe/components/hover-account-wrapper'; import { Accordion, Avatar, Button, Stack, HStack, Text } from 'pl-fe/components/ui'; import { useAppDispatch, useAppSelector } from 'pl-fe/hooks'; import { makeGetReport } from 'pl-fe/selectors'; @@ -78,7 +78,7 @@ const Report: React.FC = ({ id }) => { return ( - + = ({ id }) => { className='overflow-hidden' /> - + @@ -95,9 +95,9 @@ const Report: React.FC = ({ id }) => { id='admin.reports.report_title' defaultMessage='Report on {acct}' values={{ acct: ( - + @{acct} - + ) }} /> @@ -131,7 +131,7 @@ const Report: React.FC = ({ id }) => { - + = ({ id }) => { > @{reporterAcct} - + )} diff --git a/packages/pl-fe/src/features/directory/components/account-card.tsx b/packages/pl-fe/src/features/directory/components/account-card.tsx index 20074e8cd..8fdd2939b 100644 --- a/packages/pl-fe/src/features/directory/components/account-card.tsx +++ b/packages/pl-fe/src/features/directory/components/account-card.tsx @@ -5,7 +5,7 @@ import { Link } from 'react-router-dom'; import { useAccount } from 'pl-fe/api/hooks'; import Account from 'pl-fe/components/account'; import Badge from 'pl-fe/components/badge'; -import HoverRefWrapper from 'pl-fe/components/hover-ref-wrapper'; +import HoverAccountWrapper from 'pl-fe/components/hover-account-wrapper'; import { ParsedContent } from 'pl-fe/components/parsed-content'; import RelativeTimestamp from 'pl-fe/components/relative-timestamp'; import { Avatar, Stack, Text } from 'pl-fe/components/ui'; @@ -49,7 +49,7 @@ const AccountCard: React.FC = ({ id }) => { className='h-32 w-full rounded-t-lg object-cover' /> - + = ({ id }) => { size={64} /> - +
diff --git a/packages/pl-fe/src/features/notifications/components/notification.tsx b/packages/pl-fe/src/features/notifications/components/notification.tsx index fb62147e1..1f25cf252 100644 --- a/packages/pl-fe/src/features/notifications/components/notification.tsx +++ b/packages/pl-fe/src/features/notifications/components/notification.tsx @@ -5,7 +5,7 @@ import { Link, useHistory } from 'react-router-dom'; import { mentionCompose } from 'pl-fe/actions/compose'; import { reblog, favourite, unreblog, unfavourite } from 'pl-fe/actions/interactions'; import { toggleStatusMediaHidden } from 'pl-fe/actions/statuses'; -import HoverRefWrapper from 'pl-fe/components/hover-ref-wrapper'; +import HoverAccountWrapper from 'pl-fe/components/hover-account-wrapper'; import Icon from 'pl-fe/components/icon'; import RelativeTimestamp from 'pl-fe/components/relative-timestamp'; import { HStack, Text, Emoji } from 'pl-fe/components/ui'; @@ -31,14 +31,14 @@ const notificationForScreenReader = (intl: IntlShape, message: string, timestamp }; const buildLink = (account: Pick): JSX.Element => ( - + - + ); const icons: Partial> = { 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 7f27c5a00..5a0f99682 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 @@ -5,7 +5,7 @@ import { Link } from 'react-router-dom'; import { fetchAccountFamiliarFollowers } from 'pl-fe/actions/familiar-followers'; import AvatarStack from 'pl-fe/components/avatar-stack'; -import HoverRefWrapper from 'pl-fe/components/hover-ref-wrapper'; +import HoverAccountWrapper from 'pl-fe/components/hover-account-wrapper'; import { HStack, Text } from 'pl-fe/components/ui'; import VerificationBadge from 'pl-fe/components/verification-badge'; import { useAppDispatch, useAppSelector, useFeatures } from 'pl-fe/hooks'; @@ -45,7 +45,7 @@ const ProfileFamiliarFollowers: React.FC = ({ account } const accounts: Array = familiarFollowers.map(account => !!account && ( - + = ({ account {account.verified && } - + )).toArray().filter(Boolean); if (familiarFollowerIds.size > 2) {