fix: reused getRkey function in embed component (#6591)

This commit is contained in:
Aditya Mathur
2024-11-22 02:40:19 +05:30
committed by GitHub
parent 48cda1350e
commit f67e00a85c
+2 -3
View File
@@ -9,7 +9,6 @@ import {
AppBskyGraphDefs, AppBskyGraphDefs,
AppBskyGraphStarterpack, AppBskyGraphStarterpack,
AppBskyLabelerDefs, AppBskyLabelerDefs,
AtUri,
} from '@atproto/api' } from '@atproto/api'
import {ComponentChildren, h} from 'preact' import {ComponentChildren, h} from 'preact'
import {useMemo} from 'preact/hooks' import {useMemo} from 'preact/hooks'
@@ -437,14 +436,14 @@ function StarterPackEmbed({
// from #/lib/strings/starter-pack.ts // from #/lib/strings/starter-pack.ts
function getStarterPackImage(starterPack: AppBskyGraphDefs.StarterPackView) { function getStarterPackImage(starterPack: AppBskyGraphDefs.StarterPackView) {
const rkey = new AtUri(starterPack.uri).rkey const rkey = getRkey(starterPack.uri)
return `https://ogcard.cdn.bsky.app/start/${starterPack.creator.did}/${rkey}` return `https://ogcard.cdn.bsky.app/start/${starterPack.creator.did}/${rkey}`
} }
function getStarterPackHref( function getStarterPackHref(
starterPack: AppBskyGraphDefs.StarterPackViewBasic, starterPack: AppBskyGraphDefs.StarterPackViewBasic,
) { ) {
const rkey = new AtUri(starterPack.uri).rkey const rkey = getRkey(starterPack.uri)
const handleOrDid = starterPack.creator.handle || starterPack.creator.did const handleOrDid = starterPack.creator.handle || starterPack.creator.did
return `/starter-pack/${handleOrDid}/${rkey}` return `/starter-pack/${handleOrDid}/${rkey}`
} }