Files
bsky-social-app/src/components/Post/Embed/FeedEmbed.tsx
T
Samuel Newman ae0750099f collapse the dual-world type layer and delete the widening shims
The types/bsky post/profile/starterPack unions drop their @atproto/api arms,
and dangerousIsType/validate go with the old-world guards they wrapped. The
moderation subjects.ts widening shim and rich-text-helpers' asSdkFacets both
existed only to bridge branded and unbranded views, so their 55 and 14 callers
now go straight to @bsky.app/sdk/moderation and the raw facets.

Boundary fallout: lexicon token defs are camelCase schema objects needing
.value, and the branded string slots that the widening used to absorb are now
cast or branded at their producers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 22:13:50 +03:00

54 lines
1.5 KiB
TypeScript

import {useMemo} from 'react'
import {moderateFeedGenerator} from '@bsky.app/sdk/moderation'
import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {atoms as a, useTheme} from '#/alf'
import * as FeedCard from '#/components/FeedCard'
import {ContentHider} from '#/components/moderation/ContentHider'
import {type EmbedType} from '#/types/bsky/post'
import {type CommonProps} from './types'
export function FeedEmbed({
embed,
}: CommonProps & {
embed: EmbedType<'feed'>
}) {
const t = useTheme()
return (
<FeedCard.Link
view={embed.view}
style={[a.border, t.atoms.border_contrast_low, a.p_sm, a.rounded_md]}>
<FeedCard.Outer>
<FeedCard.Header>
<FeedCard.Avatar src={embed.view.avatar} size={48} />
<FeedCard.TitleAndByline
title={embed.view.displayName}
creator={embed.view.creator}
uri={embed.view.uri}
/>
</FeedCard.Header>
</FeedCard.Outer>
</FeedCard.Link>
)
}
export function ModeratedFeedEmbed({
embed,
}: CommonProps & {
embed: EmbedType<'feed'>
}) {
const moderationOpts = useModerationOpts()
const moderation = useMemo(() => {
return moderationOpts
? moderateFeedGenerator(embed.view, moderationOpts)
: undefined
}, [embed.view, moderationOpts])
return (
<ContentHider
modui={moderation?.ui('contentList')}
childContainerStyle={[a.pt_xs]}>
<FeedEmbed embed={embed} />
</ContentHider>
)
}