fix: urls in notifications
This commit is contained in:
parent
303cef98db
commit
cbf2f3d1ee
|
|
@ -13,7 +13,7 @@ export const Comment: React.FC<{
|
|||
})
|
||||
|
||||
return (
|
||||
<div className={clsx("xlog-comment", "comment", className)}>
|
||||
<div className={clsx("xlog-comment", "comment", className)} id="comments">
|
||||
<div className="xlog-comment-count border-b pb-2 mb-6">
|
||||
<span>
|
||||
{comments.data?.count || "0"} Comment
|
||||
|
|
|
|||
|
|
@ -19,13 +19,14 @@ import { useRefCallback } from "@crossbell/util-hooks"
|
|||
import NextNProgress from "nextjs-progressbar"
|
||||
import { CharacterEntity, Network } from "crossbell.js"
|
||||
|
||||
import { IPFS_GATEWAY } from "~/lib/env"
|
||||
import { IPFS_GATEWAY, CSB_IO } from "~/lib/env"
|
||||
import { toGateway } from "~/lib/ipfs-parser"
|
||||
import { connectors, provider } from "~/lib/wallet-config"
|
||||
import { createIDBPersister } from "~/lib/persister.client"
|
||||
|
||||
import { NotificationModal } from "@crossbell/notification"
|
||||
import { getSiteLink } from "~/lib/helpers"
|
||||
import type { NoteEntity } from "crossbell.js"
|
||||
|
||||
Network.setIpfsGateway(IPFS_GATEWAY)
|
||||
|
||||
|
|
@ -60,13 +61,35 @@ try {
|
|||
const urlComposer: Partial<UrlComposer> = {
|
||||
characterUrl: ({ handle }) => getSiteLink({ subdomain: handle }),
|
||||
noteUrl: (note) => {
|
||||
const { character } = note as { character?: CharacterEntity }
|
||||
|
||||
if (character) {
|
||||
// ...
|
||||
let originalNote = note
|
||||
while (originalNote?.toNote) {
|
||||
originalNote = originalNote.toNote
|
||||
}
|
||||
|
||||
return ``
|
||||
if (originalNote.metadata?.content?.sources?.includes("xlog")) {
|
||||
const { character } = originalNote
|
||||
|
||||
if (character) {
|
||||
return (
|
||||
getSiteLink({
|
||||
subdomain: character.handle,
|
||||
}) +
|
||||
"/" +
|
||||
(
|
||||
originalNote.metadata?.content?.attributes?.find(
|
||||
(a: any) => a?.trait_type === "xlog_slug",
|
||||
)?.value ||
|
||||
(originalNote as any).metadata?.content?._xlog_slug ||
|
||||
(originalNote as any).metadata?.content?._crosslog_slug
|
||||
)?.toLowerCase?.() +
|
||||
(originalNote !== note ? `#comments` : "")
|
||||
)
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
} else {
|
||||
return `${CSB_IO}/notes/${note.characterId}-${note.noteId}`
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue