diff options
author | Ansh <anshnanda10@gmail.com> | 2023-06-26 10:15:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-26 12:15:39 -0500 |
commit | b9abd444e5c49420ba7a4e93bd781403349076ef (patch) | |
tree | 2f6c122d912921700ec3c98b70b579cb9b6eafe0 /src/view/com/composer/useExternalLinkFetch.ts | |
parent | 1666a747eb346e3d6f9d64866881da4404fb3f56 (diff) | |
download | voidsky-b9abd444e5c49420ba7a4e93bd781403349076ef.tar.zst |
[APP-657] Add share list functionality (#863)
* replace delete list button text with icon * fix mute list styling on desktop * add share button to nav bar on a list * fix styling when on profile * bug: add key to ImageHorzList * clean up code & refactor * fix styling for ListItems * create a reusable ListActions component for actions on a list * remove dead styles * add keys to ListActions * add helpers to set list embed * render list embeds * fix list sharing on web * make style prop optional in ListCard * update `@atproto/api` to `0.3.13`
Diffstat (limited to 'src/view/com/composer/useExternalLinkFetch.ts')
-rw-r--r-- | src/view/com/composer/useExternalLinkFetch.ts | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/view/com/composer/useExternalLinkFetch.ts b/src/view/com/composer/useExternalLinkFetch.ts index 91f4da059..6592ed572 100644 --- a/src/view/com/composer/useExternalLinkFetch.ts +++ b/src/view/com/composer/useExternalLinkFetch.ts @@ -3,9 +3,17 @@ import {useStores} from 'state/index' import {ImageModel} from 'state/models/media/image' import * as apilib from 'lib/api/index' import {getLinkMeta} from 'lib/link-meta/link-meta' -import {getPostAsQuote, getFeedAsEmbed} from 'lib/link-meta/bsky' +import { + getPostAsQuote, + getFeedAsEmbed, + getListAsEmbed, +} from 'lib/link-meta/bsky' import {downloadAndResize} from 'lib/media/manip' -import {isBskyPostUrl, isBskyCustomFeedUrl} from 'lib/strings/url-helpers' +import { + isBskyPostUrl, + isBskyCustomFeedUrl, + isBskyListUrl, +} from 'lib/strings/url-helpers' import {ComposerOpts} from 'state/models/ui/shell' import {POST_IMG_MAX} from 'lib/constants' @@ -60,6 +68,24 @@ export function useExternalLinkFetch({ setExtLink(undefined) }, ) + } else if (isBskyListUrl(extLink.uri)) { + getListAsEmbed(store, extLink.uri).then( + ({embed, meta}) => { + if (aborted) { + return + } + setExtLink({ + uri: extLink.uri, + isLoading: false, + meta, + embed, + }) + }, + err => { + store.log.error('Failed to fetch list for embedding', {err}) + setExtLink(undefined) + }, + ) } else { getLinkMeta(store, extLink.uri).then(meta => { if (aborted) { |