Replace PostAlerts size prop with view prop

PostAlerts now takes view: 'expanded' | 'compact' (defaulting to
compact) instead of a raw pill size, mapping to lg/sm internally.
The additional labels pill only renders in expanded views, so feeds
and replies skip the label computation entirely; the thread anchor
is the one expanded surface.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Eric Bailey
2026-07-09 20:37:16 -05:00
parent cfbdb1ef4b
commit 2e3774d9e7
4 changed files with 16 additions and 11 deletions
+13 -6
View File
@@ -24,29 +24,36 @@ import * as Pills from '#/components/Pills'
export function PostAlerts({ export function PostAlerts({
post, post,
modui, modui,
size = 'sm', view = 'compact',
style, style,
additionalCauses, additionalCauses,
}: { }: {
post?: AppBskyFeedDefs.PostView post?: AppBskyFeedDefs.PostView
modui: ModerationUI modui: ModerationUI
size?: Pills.CommonProps['size'] /**
* Expanded views (e.g. the thread anchor post) render larger pills and
* surface the "+n" additional labels pill. Compact views (feeds, replies)
* keep the alerts minimal.
*/
view?: 'expanded' | 'compact'
includeMute?: boolean includeMute?: boolean
style?: StyleProp<ViewStyle> style?: StyleProp<ViewStyle>
additionalCauses?: ModerationCause[] | Pills.AppModerationCause[] additionalCauses?: ModerationCause[] | Pills.AppModerationCause[]
}) { }) {
const {currentAccount} = useSession() const {currentAccount} = useSession()
const size: Pills.CommonProps['size'] = view === 'expanded' ? 'lg' : 'sm'
const alerts = modui.alerts.filter(unique) const alerts = modui.alerts.filter(unique)
const informs = modui.informs.filter(unique) const informs = modui.informs.filter(unique)
/* /*
* The "+n" pill surfaces labels for the author to review and appeal, so it * The "+n" pill surfaces labels for the author to review and appeal, so it
* only applies when the viewer is the author. It renders even when no other * only applies when the viewer is the author, and only in expanded views.
* moderation is visible, since it may be the author's only entry point to * It renders even when no other moderation is visible, since it may be the
* appeal labels on their content. * author's only entry point to appeal labels on their content.
*/ */
const isOwnPost = !!post && post.author.did === currentAccount?.did const isOwnPost = !!post && post.author.did === currentAccount?.did
const allLabels: ComAtprotoLabelDefs.Label[] = isOwnPost const allLabels: ComAtprotoLabelDefs.Label[] =
isOwnPost && view === 'expanded'
? [...(post.labels ?? []), ...(post.author.labels ?? [])] ? [...(post.labels ?? []), ...(post.author.labels ?? [])]
: [] : []
/* /*
@@ -164,7 +164,6 @@ function DirectChatItem({
isWithinLeftPanel ? null : ( isWithinLeftPanel ? null : (
<PostAlerts <PostAlerts
modui={moderation.ui('contentList')} modui={moderation.ui('contentList')}
size="sm"
style={[a.pb_2xs, a.max_w_full, a.overflow_hidden]} style={[a.pb_2xs, a.max_w_full, a.overflow_hidden]}
/> />
) )
@@ -243,7 +243,6 @@ function MessageInputPostEmbed({
post={post} post={post}
modui={moderation.ui('contentView')} modui={moderation.ui('contentView')}
style={a.py_xs} style={a.py_xs}
size="sm"
/> />
{rt.text && ( {rt.text && (
<RichText <RichText
@@ -390,7 +390,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
<PostAlerts <PostAlerts
post={post} post={post}
modui={moderation.ui('contentView')} modui={moderation.ui('contentView')}
size="lg" view="expanded"
includeMute includeMute
style={[a.pb_sm]} style={[a.pb_sm]}
additionalCauses={additionalPostAlerts} additionalCauses={additionalPostAlerts}