Add starter pack embeds to posts (#4699)
* starter pack embeds * revert test code * Types * add `BaseLink` * precache on click * rm log * add a comment * loading state * top margin --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
parent
a3d4fb652b
commit
aa7117edb6
10 changed files with 246 additions and 41 deletions
|
@ -96,7 +96,7 @@ export function createStarterPackUri({
|
|||
}: {
|
||||
did: string
|
||||
rkey: string
|
||||
}): string | null {
|
||||
}): string {
|
||||
return new AtUri(`at://${did}/app.bsky.graph.starterpack/${rkey}`).toString()
|
||||
}
|
||||
|
||||
|
|
|
@ -152,6 +152,30 @@ export function isBskyListUrl(url: string): boolean {
|
|||
return false
|
||||
}
|
||||
|
||||
export function isBskyStartUrl(url: string): boolean {
|
||||
if (isBskyAppUrl(url)) {
|
||||
try {
|
||||
const urlp = new URL(url)
|
||||
return /start\/(?<name>[^/]+)\/(?<rkey>[^/]+)/i.test(urlp.pathname)
|
||||
} catch {
|
||||
console.error('Unexpected error in isBskyStartUrl()', url)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export function isBskyStarterPackUrl(url: string): boolean {
|
||||
if (isBskyAppUrl(url)) {
|
||||
try {
|
||||
const urlp = new URL(url)
|
||||
return /starter-pack\/(?<name>[^/]+)\/(?<rkey>[^/]+)/i.test(urlp.pathname)
|
||||
} catch {
|
||||
console.error('Unexpected error in isBskyStartUrl()', url)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export function isBskyDownloadUrl(url: string): boolean {
|
||||
if (isExternalUrl(url)) {
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue