[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`
This commit is contained in:
Ansh 2023-06-26 10:15:39 -07:00 committed by GitHub
parent 1666a747eb
commit b9abd444e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 320 additions and 145 deletions

View file

@ -155,3 +155,29 @@ export async function getFeedAsEmbed(
},
}
}
export async function getListAsEmbed(
store: RootStoreModel,
url: string,
): Promise<apilib.ExternalEmbedDraft> {
url = convertBskyAppUrlIfNeeded(url)
const [_0, user, _1, rkey] = url.split('/').filter(Boolean)
const list = makeRecordUri(user, 'app.bsky.graph.list', rkey)
const res = await store.agent.app.bsky.graph.getList({list})
return {
isLoading: false,
uri: list,
meta: {
url: list,
likelyType: LikelyType.AtpData,
title: res.data.list.name,
},
embed: {
$type: 'app.bsky.embed.record',
record: {
uri: res.data.list.uri,
cid: res.data.list.cid,
},
},
}
}

View file

@ -94,6 +94,20 @@ export function isBskyCustomFeedUrl(url: string): boolean {
return false
}
export function isBskyListUrl(url: string): boolean {
if (isBskyAppUrl(url)) {
try {
const urlp = new URL(url)
return /profile\/(?<name>[^/]+)\/lists\/(?<rkey>[^/]+)/i.test(
urlp.pathname,
)
} catch {
console.error('Unexpected error in isBskyListUrl()', url)
}
}
return false
}
export function convertBskyAppUrlIfNeeded(url: string): string {
if (isBskyAppUrl(url)) {
try {