From 29a4dd1587859751d9c585997c236ab36426cb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Tue, 7 Apr 2026 15:22:31 +0000 Subject: [PATCH] nicolium: adapt account component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- .../src/components/accounts/account.tsx | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/packages/nicolium/src/components/accounts/account.tsx b/packages/nicolium/src/components/accounts/account.tsx index 7b06512c5..5bd18820f 100644 --- a/packages/nicolium/src/components/accounts/account.tsx +++ b/packages/nicolium/src/components/accounts/account.tsx @@ -16,6 +16,7 @@ import { useCurrentAccount } from '@/contexts/current-account-context'; import Emojify from '@/features/emoji/emojify'; import { useAcct } from '@/hooks/use-acct'; import { useFeatures } from '@/hooks/use-features'; +import { useFrontendConfig } from '@/hooks/use-frontend-config'; import { useSettings } from '@/stores/settings'; import Badge from '../badge'; @@ -161,6 +162,9 @@ const Account = ({ const me = useCurrentAccount(); const username = useAcct(account); const { disableUserProvidedMedia } = useSettings(); + const { allowDisplayingRemoteNoLogin } = useFrontendConfig(); + + const withExternalLink = !allowDisplayingRemoteNoLogin && !account.local; const handleAction = () => { onActionClick!(account); @@ -233,16 +237,26 @@ const Account = ({ if (withDate) timestamp = account.created_at; - const LinkEl: React.ElementType = withLinkToProfile ? Link : 'div'; + const LinkEl: React.ElementType = withLinkToProfile ? (withExternalLink ? 'a' : Link) : 'div'; const linkProps = withLinkToProfile - ? { - to: '/@{$username}', - params: { username: account.acct }, - title: account.acct, - onClick: (event: React.MouseEvent) => { - event.stopPropagation(); - }, - } + ? withExternalLink + ? { + href: account.url, + target: '_blank', + rel: 'noopener noreferrer', + title: account.acct, + onClick: (event: React.MouseEvent) => { + event.stopPropagation(); + }, + } + : { + to: '/@{$username}', + params: { username: account.acct }, + title: account.acct, + onClick: (event: React.MouseEvent) => { + event.stopPropagation(); + }, + } : {}; if (disabled)