From a32a3973dbb5bc243aadd7f04522e3b8a48edeed Mon Sep 17 00:00:00 2001 From: diondiondion Date: Tue, 22 Sep 2026 18:02:08 +0000 Subject: [PATCH] Redesign: Use new design for "Copy profile link" button (#40649) --- .../components/account_header/buttons.tsx | 27 +++++----------- .../mastodon/components/copy_button.tsx | 31 +++++++++++++++++-- .../form_fields/copy_link_field.tsx | 4 +-- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/app/javascript/mastodon/components/account_header/buttons.tsx b/app/javascript/mastodon/components/account_header/buttons.tsx index 6fbcff59c10..ecc77769ba2 100644 --- a/app/javascript/mastodon/components/account_header/buttons.tsx +++ b/app/javascript/mastodon/components/account_header/buttons.tsx @@ -13,10 +13,9 @@ import { useAppDispatch, useAppSelector } from '@/mastodon/store'; import { isRedesignEnabled } from '@/mastodon/utils/environment'; import NotificationsIcon from '@/material-icons/400-24px/notifications.svg?react'; import NotificationsActiveIcon from '@/material-icons/400-24px/notifications_active-fill.svg?react'; -import ShareIcon from '@/material-icons/400-24px/share.svg?react'; import { ToggleIconButton } from '../button/redesign'; -import { CopyIconButton } from '../copy_button'; +import { CopyIconButton, CopyIconButtonLegacy } from '../copy_button'; import { FollowButton } from '../follow_button'; import { IconButton as LegacyIconButton } from '../icon_button'; @@ -77,14 +76,6 @@ const AccountButtonsOther: FC< dispatch(followAccount(account.id, { notify: !relationship?.notifying })); } }, [dispatch, account, relationship]); - const accountUrl = account?.url; - const handleShare = useCallback(() => { - if (accountUrl) { - void navigator.share({ - url: accountUrl, - }); - } - }, [accountUrl]); const reference = useFollowReference('profile'); @@ -144,18 +135,14 @@ const AccountButtonsOther: FC< /> ))} {!noShare && - ('share' in navigator ? ( - ) : ( - ); }; + +export const CopyIconButton: React.FC< + { + title: string; + value: string; + } & DistributedOmit +> = ({ title, value, ...otherProps }) => { + const { copyText, wasCopied } = useCopyToClipboard({ text: value }); + + return ( + + {title} + + ); +}; diff --git a/app/javascript/mastodon/components/form_fields/copy_link_field.tsx b/app/javascript/mastodon/components/form_fields/copy_link_field.tsx index 0476afe6446..0122c30e782 100644 --- a/app/javascript/mastodon/components/form_fields/copy_link_field.tsx +++ b/app/javascript/mastodon/components/form_fields/copy_link_field.tsx @@ -4,7 +4,7 @@ import { useIntl } from 'react-intl'; import classNames from 'classnames'; -import { CopyIconButton } from '@/mastodon/components/copy_button'; +import { CopyIconButtonLegacy } from '@/mastodon/components/copy_button'; import classes from './copy_link_field.module.scss'; import { FormFieldWrapper } from './form_field_wrapper'; @@ -73,7 +73,7 @@ export const CopyLinkField = forwardRef( onFocus={handleFocus} className={classNames(className, classes.input)} /> -