From 83d96c7cc585973cf3c5d48c1f2cf3b203ecdc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Wed, 7 Jan 2026 16:42:47 +0100 Subject: [PATCH] pl-fe: show 'you're following #name for posts with followed hashtags in timeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/pl-fe/src/components/status-list.tsx | 1 + packages/pl-fe/src/components/status.tsx | 48 +++++++++++++++++++ packages/pl-fe/src/locales/en.json | 1 + 3 files changed, 50 insertions(+) diff --git a/packages/pl-fe/src/components/status-list.tsx b/packages/pl-fe/src/components/status-list.tsx index d418122a8..da1af54bf 100644 --- a/packages/pl-fe/src/components/status-list.tsx +++ b/packages/pl-fe/src/components/status-list.tsx @@ -108,6 +108,7 @@ const StatusList: React.FC = ({ showGroup={showGroup} variant='slim' fromBookmarks={other.scrollKey === 'bookmarked_statuses'} + fromHomeTimeline={timelineId === 'home'} /> ); diff --git a/packages/pl-fe/src/components/status.tsx b/packages/pl-fe/src/components/status.tsx index a3f354eef..fc9ba124f 100644 --- a/packages/pl-fe/src/components/status.tsx +++ b/packages/pl-fe/src/components/status.tsx @@ -14,6 +14,7 @@ import StatusTypeIcon from 'pl-fe/features/status/components/status-type-icon'; import { Hotkeys } from 'pl-fe/features/ui/components/hotkeys'; import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useFollowedTags } from 'pl-fe/queries/hashtags/use-followed-tags'; import { useFavouriteStatus, useReblogStatus, useUnfavouriteStatus, useUnreblogStatus } from 'pl-fe/queries/statuses/use-status-interactions'; import { makeGetStatus, type SelectedStatus } from 'pl-fe/selectors'; import { useModalsActions } from 'pl-fe/stores/modals'; @@ -22,6 +23,7 @@ import { useStatusMetaActions } from 'pl-fe/stores/status-meta'; import { textForScreenReader } from 'pl-fe/utils/status'; import EventPreview from './event-preview'; +import HashtagLink from './hashtag-link'; import RelativeTimestamp from './relative-timestamp'; import StatusActionBar from './status-action-bar'; import StatusContent from './status-content'; @@ -35,6 +37,48 @@ const messages = defineMessages({ reblogged_by: { id: 'status.reblogged_by', defaultMessage: '{name} reposted' }, }); +interface IStatusFollowedTagInfo { + status: SelectedStatus; + avatarSize: number; +} + +const StatusFollowedTagInfo: React.FC = ({ status, avatarSize }) => { + const { data: followedTags } = useFollowedTags(); + + const filteredTags = status.tags.filter(tag => followedTags?.some(followed => followed.name.toLowerCase() === tag.name.toLowerCase())); + + if (!filteredTags.length) { + return null; + } + + const tagLinks = filteredTags.slice(0, 2).map(tag => ( + + )); + + if (filteredTags.length > 2) { + tagLinks.push( + , + ); + } + + return ( + } + text={ + , + }} + /> + } + /> + ); +}; + interface IStatus { id?: string; avatarSize?: number; @@ -51,6 +95,7 @@ interface IStatus { variant?: 'default' | 'rounded' | 'slim'; showGroup?: boolean; fromBookmarks?: boolean; + fromHomeTimeline?: boolean; className?: string; } @@ -70,6 +115,7 @@ const Status: React.FC = (props) => { variant = 'rounded', showGroup = true, fromBookmarks = false, + fromHomeTimeline = false, className, } = props; @@ -329,6 +375,8 @@ const Status: React.FC = (props) => { } /> ); + } else if (fromHomeTimeline) { + return ; } }, [status.accounts, group?.id]); diff --git a/packages/pl-fe/src/locales/en.json b/packages/pl-fe/src/locales/en.json index e7b888a4e..3fb7d1dd2 100644 --- a/packages/pl-fe/src/locales/en.json +++ b/packages/pl-fe/src/locales/en.json @@ -1679,6 +1679,7 @@ "status.external": "View post on {domain}", "status.favourite": "Like", "status.filtered": "Filtered", + "status.followed_tag": "You’re following {tags}", "status.group": "Posted in {group}", "status.group_mod_delete": "Delete post from group", "status.hide_translation": "Hide translation",