Add app.bsky.embed.gallery embed type support
Wires the new gallery embed (atproto PR #4827) through the display and compose pipelines while the lexicon is unpublished. Gallery posts render via the existing carousel for >4 items and grid for <=4. Compose now allows up to 10 images and auto-promotes images -> gallery above 4 (demotes back when count drops to <=4 so old clients still see legacy embeds when possible). Drafts persist as the new `embedGallery` field. Local shim types in `src/lib/api/gallery-embed-shim*.ts` mirror the lexicon shape; delete both files once @atproto/api ships the generated types.
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
AppBskyLabelerDefs,
|
||||
} from '@atproto/api'
|
||||
|
||||
import {AppBskyEmbedGallery} from '#/lib/api/gallery-embed-shim'
|
||||
|
||||
export type Embed =
|
||||
| {
|
||||
type: 'post'
|
||||
@@ -47,6 +49,10 @@ export type Embed =
|
||||
type: 'images'
|
||||
view: $Typed<AppBskyEmbedImages.View>
|
||||
}
|
||||
| {
|
||||
type: 'gallery'
|
||||
view: $Typed<AppBskyEmbedGallery.View>
|
||||
}
|
||||
| {
|
||||
type: 'link'
|
||||
view: $Typed<AppBskyEmbedExternal.View>
|
||||
@@ -122,6 +128,11 @@ export function parseEmbed(embed: AppBskyFeedDefs.PostView['embed']): Embed {
|
||||
type: 'images',
|
||||
view: embed,
|
||||
}
|
||||
} else if (AppBskyEmbedGallery.isView(embed)) {
|
||||
return {
|
||||
type: 'gallery',
|
||||
view: embed,
|
||||
}
|
||||
} else if (AppBskyEmbedExternal.isView(embed)) {
|
||||
return {
|
||||
type: 'link',
|
||||
|
||||
Reference in New Issue
Block a user