From dbd2f43abc609f42a2d635fd83ede4b8f1099967 Mon Sep 17 00:00:00 2001 From: Rudy Fraser Date: Fri, 26 Jun 2026 13:51:58 -0400 Subject: [PATCH] feat(community-posts): add purple Blacksky-only badge on community posts Mirrors Instagram's Close Friends affordance: a Blacksky brand purple pill with the white Blacksky logo and a downward chevron sits on the right of every community post header (timeline, individual post, thread items, quote embed, message embed). Clicking it opens a tooltip explaining the post is only visible to Blacksky community members. PostMeta gains an optional `postUri` prop; the badge renders only when the URI's collection is community.blacksky.feed.post. --- src/components/CommunityOnlyBadge.tsx | 64 +++++++++++++++++++ src/components/Post/Embed/index.tsx | 1 + .../Messages/components/MessageInputEmbed.tsx | 1 + .../PostThread/components/ThreadItemPost.tsx | 1 + .../components/ThreadItemTreePost.tsx | 1 + src/view/com/post/Post.tsx | 1 + src/view/com/posts/PostFeedItem.tsx | 1 + src/view/com/util/PostMeta.tsx | 10 +++ 8 files changed, 80 insertions(+) create mode 100644 src/components/CommunityOnlyBadge.tsx diff --git a/src/components/CommunityOnlyBadge.tsx b/src/components/CommunityOnlyBadge.tsx new file mode 100644 index 000000000..b23acc607 --- /dev/null +++ b/src/components/CommunityOnlyBadge.tsx @@ -0,0 +1,64 @@ +import {useState} from 'react' +import {Pressable, View} from 'react-native' +import {msg} from '@lingui/core/macro' +import {useLingui} from '@lingui/react' +import {Trans} from '@lingui/react/macro' + +import {atoms as a, useTheme} from '#/alf' +import * as Tooltip from '#/components/Tooltip' +import {Text} from '#/components/Typography' +import {ChevronBottom_Stroke2_Corner0_Rounded as ChevronDown} from '#/components/icons/Chevron' +import {Logo as BlackskyLogo} from '#/view/icons/Logo' + +const COMMUNITY_POST_COLLECTION = 'community.blacksky.feed.post' + +export function isCommunityPostUri(uri: string | undefined): boolean { + return !!uri && uri.includes(COMMUNITY_POST_COLLECTION) +} + +export function CommunityOnlyBadge() { + const t = useTheme() + const {_} = useLingui() + const [visible, setVisible] = useState(false) + + return ( + + + setVisible(v => !v)} + style={[ + a.flex_row, + a.align_center, + a.gap_xs, + a.px_sm, + a.py_2xs, + a.rounded_full, + {backgroundColor: t.palette.primary_500}, + ]}> + + + + + + + + Blacksky Only + + + + This post is only visible to members of the Blacksky community. + + + + + + ) +} diff --git a/src/components/Post/Embed/index.tsx b/src/components/Post/Embed/index.tsx index 914ffc65c..a6af0d808 100644 --- a/src/components/Post/Embed/index.tsx +++ b/src/components/Post/Embed/index.tsx @@ -371,6 +371,7 @@ export function QuoteEmbed({ moderation={moderation} showAvatar postHref={itemHref} + postUri={quote.uri} timestamp={quote.indexedAt} linkDisabled /> diff --git a/src/screens/Messages/components/MessageInputEmbed.tsx b/src/screens/Messages/components/MessageInputEmbed.tsx index 355a9c2fb..216d58291 100644 --- a/src/screens/Messages/components/MessageInputEmbed.tsx +++ b/src/screens/Messages/components/MessageInputEmbed.tsx @@ -232,6 +232,7 @@ function MessageInputPostEmbed({ moderation={moderation} timestamp={post.indexedAt} postHref={itemHref} + postUri={post.uri} linkDisabled />