Remove dependency Unidata (#473)
This commit is contained in:
@@ -38,7 +38,7 @@ export const AchievementItem: React.FC<{
|
||||
group: AchievementSection["groups"][number]
|
||||
layoutId: string
|
||||
size?: number
|
||||
characterId?: string
|
||||
characterId?: number
|
||||
isOwner: boolean
|
||||
}> = ({ group, layoutId, size, characterId, isOwner }) => {
|
||||
const date = useDate()
|
||||
|
||||
@@ -18,7 +18,7 @@ export const AchievementModal: React.FC<{
|
||||
group: AchievementSection["groups"][number]
|
||||
layoutId: string
|
||||
isOwner: boolean
|
||||
characterId?: string
|
||||
characterId?: number
|
||||
}> = ({ opened, setOpened, group, layoutId, isOwner, characterId }) => {
|
||||
const date = useDate()
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
@@ -3,24 +3,26 @@ import { useTranslation } from "next-i18next"
|
||||
import { Disclosure } from "@headlessui/react"
|
||||
|
||||
import { BlockchainIcon } from "~/components/icons/BlockchainIcon"
|
||||
import { CSB_SCAN, IPFS_GATEWAY } from "~/lib/env"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
import { toCid, toGateway, toIPFS } from "~/lib/ipfs-parser"
|
||||
import { Note, Profile } from "~/lib/types"
|
||||
import { ExpandedCharacter, ExpandedNote } from "~/lib/types"
|
||||
import { cn } from "~/lib/utils"
|
||||
import { useGetGreenfieldId } from "~/queries/site"
|
||||
|
||||
export const BlockchainInfo: React.FC<{
|
||||
site?: Profile | null
|
||||
page?: Note | null
|
||||
site?: ExpandedCharacter
|
||||
page?: ExpandedNote
|
||||
}> = ({ site, page }) => {
|
||||
const { t } = useTranslation(["common", "site"])
|
||||
|
||||
const ipfs = page
|
||||
? page.related_urls?.filter((url) => url.startsWith(IPFS_GATEWAY))?.[0]
|
||||
: site?.metadata?.uri
|
||||
const ipfs = (page ? page.metadata?.uri : site?.metadata?.uri) || ""
|
||||
const greenfieldId = useGetGreenfieldId(toCid(ipfs))
|
||||
|
||||
const type = page ? (page?.tags?.includes("post") ? "post" : "page") : "blog"
|
||||
const type = page
|
||||
? page?.metadata?.content?.tags?.includes("post")
|
||||
? "post"
|
||||
: "page"
|
||||
: "blog"
|
||||
|
||||
return (
|
||||
<div className="text-sm">
|
||||
@@ -54,46 +56,53 @@ export const BlockchainInfo: React.FC<{
|
||||
<div className="font-medium">{t("Owner")}</div>
|
||||
<div>
|
||||
<BlockchainInfoLink
|
||||
href={`${CSB_SCAN}/address/${
|
||||
page?.metadata?.owner || site?.metadata?.owner
|
||||
}`}
|
||||
key={page?.metadata?.owner || site?.metadata?.owner}
|
||||
href={`${CSB_SCAN}/address/${page?.owner || site?.owner}`}
|
||||
key={page?.owner || site?.owner}
|
||||
>
|
||||
{page?.metadata?.owner || site?.metadata?.owner}
|
||||
{page?.owner || site?.owner}
|
||||
</BlockchainInfoLink>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div className="font-medium">{t("Transaction Hash")}</div>
|
||||
<div>
|
||||
{page
|
||||
? page?.related_urls
|
||||
?.filter((url) => url.startsWith(CSB_SCAN + "/tx/"))
|
||||
.map((url, index) => {
|
||||
return (
|
||||
<BlockchainInfoLink href={url} key={url}>
|
||||
{t(index === 0 ? "Creation" : "Last Update")}{" "}
|
||||
{url
|
||||
.replace(CSB_SCAN + "/tx/", "")
|
||||
.slice(0, 10)}
|
||||
...
|
||||
{url.replace(CSB_SCAN + "/tx/", "").slice(-10)}
|
||||
</BlockchainInfoLink>
|
||||
)
|
||||
})
|
||||
: site?.metadata?.transactions.map(
|
||||
(hash: string, index: number) => {
|
||||
return (
|
||||
<BlockchainInfoLink
|
||||
href={`${CSB_SCAN}/tx/${hash}`}
|
||||
key={hash}
|
||||
>
|
||||
{t(index === 0 ? "Creation" : "Last Update")}{" "}
|
||||
{hash.slice(0, 10)}...{hash.slice(-10)}
|
||||
</BlockchainInfoLink>
|
||||
)
|
||||
},
|
||||
)}
|
||||
{page ? (
|
||||
<>
|
||||
<BlockchainInfoLink
|
||||
href={`${CSB_SCAN}/tx/${page?.transactionHash}`}
|
||||
key={page?.transactionHash}
|
||||
>
|
||||
{t("Creation")} {page?.transactionHash.slice(0, 10)}
|
||||
...{page?.transactionHash.slice(-10)}
|
||||
</BlockchainInfoLink>
|
||||
<BlockchainInfoLink
|
||||
href={`${CSB_SCAN}/tx/${page?.updatedTransactionHash}`}
|
||||
key={page?.updatedTransactionHash}
|
||||
>
|
||||
{t("Last Update")}{" "}
|
||||
{page?.updatedTransactionHash.slice(0, 10)}...
|
||||
{page?.updatedTransactionHash.slice(-10)}
|
||||
</BlockchainInfoLink>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<BlockchainInfoLink
|
||||
href={`${CSB_SCAN}/tx/${site?.transactionHash}`}
|
||||
key={site?.transactionHash}
|
||||
>
|
||||
{t("Creation")} {site?.transactionHash.slice(0, 10)}
|
||||
...{site?.transactionHash.slice(-10)}
|
||||
</BlockchainInfoLink>
|
||||
<BlockchainInfoLink
|
||||
href={`${CSB_SCAN}/tx/${site?.updatedTransactionHash}`}
|
||||
key={site?.updatedTransactionHash}
|
||||
>
|
||||
{t("Last Update")}{" "}
|
||||
{site?.updatedTransactionHash.slice(0, 10)}...
|
||||
{site?.updatedTransactionHash.slice(-10)}
|
||||
</BlockchainInfoLink>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { FollowingCount } from "~/components/common/FollowingCount"
|
||||
import { Titles } from "~/components/common/Titles"
|
||||
import { Avatar } from "~/components/ui/Avatar"
|
||||
import { useDate } from "~/hooks/useDate"
|
||||
import type { Profile } from "~/lib/types"
|
||||
import type { ExpandedCharacter } from "~/lib/types"
|
||||
import { cn } from "~/lib/utils"
|
||||
import * as siteModel from "~/models/site.model"
|
||||
|
||||
@@ -28,7 +28,7 @@ export const CharacterCard: React.FC<{
|
||||
style,
|
||||
}) => {
|
||||
const [firstOpen, setFirstOpen] = useState("")
|
||||
const [site, setSite] = useState<Profile>()
|
||||
const [site, setSite] = useState<ExpandedCharacter>()
|
||||
const date = useDate()
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
@@ -39,9 +39,7 @@ export const CharacterCard: React.FC<{
|
||||
if (siteId) {
|
||||
siteModel.getSite(siteId).then((site) => setSite(site))
|
||||
} else if (address) {
|
||||
siteModel
|
||||
.getUserSites({ address })
|
||||
.then((sites) => setSite(sites?.[0]))
|
||||
siteModel.getSiteByAddress(address).then((site) => setSite(site))
|
||||
}
|
||||
} else {
|
||||
setSite(undefined)
|
||||
@@ -64,7 +62,11 @@ export const CharacterCard: React.FC<{
|
||||
{site ? (
|
||||
<>
|
||||
<span className="flex items-center justify-between">
|
||||
<Avatar images={site?.avatars || []} name={site?.name} size={45} />
|
||||
<Avatar
|
||||
images={site?.metadata?.content?.avatars || []}
|
||||
name={site?.metadata?.content?.name}
|
||||
size={45}
|
||||
/>
|
||||
{!hideFollowButton && (
|
||||
<FollowingButton
|
||||
site={site}
|
||||
@@ -75,30 +77,31 @@ export const CharacterCard: React.FC<{
|
||||
</span>
|
||||
<span className="flex items-center space-x-1">
|
||||
<span className="font-bold text-base text-zinc-800">
|
||||
{site?.name}
|
||||
{site?.metadata?.content?.name}
|
||||
</span>
|
||||
<Titles characterId={+(site.metadata?.proof || "")} />
|
||||
<span className="text-gray-600">@{site?.username}</span>
|
||||
<Titles characterId={+(site?.characterId || "")} />
|
||||
<span className="text-gray-600">@{site?.handle}</span>
|
||||
</span>
|
||||
{site?.description && (
|
||||
{site?.metadata?.content?.bio && (
|
||||
<span className="text-gray-600 line-clamp-4">
|
||||
{site?.description}
|
||||
{site?.metadata?.content?.bio}
|
||||
</span>
|
||||
)}
|
||||
{!simple && (
|
||||
<span className="block">
|
||||
<FollowingCount siteId={site.username} disableList={true} />
|
||||
<FollowingCount
|
||||
characterId={site.characterId}
|
||||
disableList={true}
|
||||
/>
|
||||
</span>
|
||||
)}
|
||||
{!simple && site?.date_created && (
|
||||
{!simple && site?.createdAt && (
|
||||
<span className="block text-gray-500">
|
||||
<time dateTime={date.formatToISO(site.date_created)}>
|
||||
<time dateTime={date.formatToISO(site.createdAt)}>
|
||||
{t("joined ago", {
|
||||
time: date.dayjs
|
||||
.duration(
|
||||
date
|
||||
.dayjs(site.date_created)
|
||||
.diff(date.dayjs(), "minute"),
|
||||
date.dayjs(site.createdAt).diff(date.dayjs(), "minute"),
|
||||
"minute",
|
||||
)
|
||||
.humanize(),
|
||||
|
||||
@@ -3,6 +3,7 @@ import React, { useCallback, useState } from "react"
|
||||
import { Virtuoso } from "react-virtuoso"
|
||||
|
||||
import { Modal } from "~/components/ui/Modal"
|
||||
import { ExpandedCharacter } from "~/lib/types"
|
||||
|
||||
import { Button } from "../ui/Button"
|
||||
import CharacterListItem from "./CharacterListItem"
|
||||
@@ -53,7 +54,8 @@ export const CharacterList: React.FC<{
|
||||
}}
|
||||
data={flattenList}
|
||||
itemContent={(index, sub) => {
|
||||
const character = sub?.character || sub?.fromCharacter
|
||||
const character: ExpandedCharacter =
|
||||
sub?.character || sub?.fromCharacter || sub?.toCharacter
|
||||
return (
|
||||
<CharacterListItem
|
||||
key={index}
|
||||
|
||||
@@ -5,13 +5,14 @@ import { BlockchainIcon } from "~/components/icons/BlockchainIcon"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
import { getSiteLink } from "~/lib/helpers"
|
||||
import { noopArr } from "~/lib/noop"
|
||||
import { ExpandedCharacter } from "~/lib/types"
|
||||
|
||||
import { Avatar } from "../ui/Avatar"
|
||||
import { UniLink } from "../ui/UniLink"
|
||||
import { FollowingButton } from "./FollowingButton"
|
||||
|
||||
const CharacterListItem: React.FC<{
|
||||
character: any
|
||||
character: ExpandedCharacter
|
||||
sub: any
|
||||
}> = ({ character, sub }) => {
|
||||
return (
|
||||
@@ -43,17 +44,7 @@ const CharacterListItem: React.FC<{
|
||||
<BlockchainIcon />
|
||||
</UniLink>
|
||||
</div>
|
||||
<FollowingButton
|
||||
site={
|
||||
{
|
||||
username: character?.handle,
|
||||
metadata: {
|
||||
proof: character?.characterId,
|
||||
},
|
||||
} as any
|
||||
}
|
||||
size="sm"
|
||||
/>
|
||||
<FollowingButton site={character} size="sm" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,16 +3,17 @@ import { Virtuoso } from "react-virtuoso"
|
||||
|
||||
import { CommentInput } from "~/components/common/CommentInput"
|
||||
import { CommentItem } from "~/components/common/CommentItem"
|
||||
import { Note } from "~/lib/types"
|
||||
import { ExpandedNote } from "~/lib/types"
|
||||
import { cn } from "~/lib/utils"
|
||||
import { useGetComments } from "~/queries/page"
|
||||
|
||||
export const Comment: React.FC<{
|
||||
page?: Note | null
|
||||
page?: ExpandedNote
|
||||
className?: string
|
||||
}> = ({ page, className }) => {
|
||||
const comments = useGetComments({
|
||||
pageId: page?.id,
|
||||
characterId: page?.characterId,
|
||||
noteId: page?.noteId,
|
||||
})
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
@@ -37,7 +38,7 @@ export const Comment: React.FC<{
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<CommentInput pageId={page?.id} />
|
||||
<CommentInput characterId={page?.characterId} noteId={page?.noteId} />
|
||||
|
||||
<Virtuoso
|
||||
className="xlog-comment-list"
|
||||
@@ -51,7 +52,8 @@ export const Comment: React.FC<{
|
||||
p?.list?.map((comment, idx) => (
|
||||
<CommentItem
|
||||
className="mt-6"
|
||||
originalId={page?.id}
|
||||
originalCharacterId={page?.characterId}
|
||||
originalNoteId={page?.noteId}
|
||||
comment={comment}
|
||||
key={comment.transactionHash}
|
||||
depth={0}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { CharacterEntity, NoteEntity } from "crossbell.js"
|
||||
import { useTranslation } from "next-i18next"
|
||||
import { useRouter } from "next/router"
|
||||
import { useEffect, useState } from "react"
|
||||
import { useEffect } from "react"
|
||||
import { useForm } from "react-hook-form"
|
||||
|
||||
import { useAccountState } from "@crossbell/connect-kit"
|
||||
@@ -10,34 +9,32 @@ import { Popover } from "@headlessui/react"
|
||||
import { Avatar } from "~/components/ui/Avatar"
|
||||
import { Button } from "~/components/ui/Button"
|
||||
import { Input } from "~/components/ui/Input"
|
||||
import { Profile } from "~/lib/types"
|
||||
import { useCommentPage, useUpdateComment } from "~/queries/page"
|
||||
import { useAccountSites } from "~/queries/site"
|
||||
|
||||
import { EmojiPicker } from "./EmojiPicker"
|
||||
|
||||
export const CommentInput: React.FC<{
|
||||
pageId?: string
|
||||
originalId?: string
|
||||
characterId?: number
|
||||
noteId?: number
|
||||
originalCharacterId?: number
|
||||
originalNoteId?: number
|
||||
onSubmitted?: () => void
|
||||
comment?: NoteEntity & {
|
||||
character?: CharacterEntity | null
|
||||
}
|
||||
}> = ({ pageId, originalId, onSubmitted, comment }) => {
|
||||
}> = ({
|
||||
characterId,
|
||||
noteId,
|
||||
originalCharacterId,
|
||||
originalNoteId,
|
||||
onSubmitted,
|
||||
comment,
|
||||
}) => {
|
||||
const account = useAccountState((s) => s.computed.account)
|
||||
const userSites = useAccountSites()
|
||||
const commentPage = useCommentPage()
|
||||
const updateComment = useUpdateComment()
|
||||
const router = useRouter()
|
||||
const [viewer, setViewer] = useState<Profile | null>(null)
|
||||
const { t } = useTranslation(["common", "site"])
|
||||
|
||||
useEffect(() => {
|
||||
if (userSites.isSuccess && userSites.data?.length) {
|
||||
setViewer(userSites.data[0])
|
||||
}
|
||||
}, [userSites, router])
|
||||
|
||||
const form = useForm({
|
||||
defaultValues: {
|
||||
content: comment?.metadata?.content?.content || "",
|
||||
@@ -45,24 +42,26 @@ export const CommentInput: React.FC<{
|
||||
})
|
||||
|
||||
const handleSubmit = form.handleSubmit(async (values) => {
|
||||
if (pageId) {
|
||||
if (characterId && noteId) {
|
||||
if (comment) {
|
||||
if (values.content) {
|
||||
updateComment.mutate({
|
||||
pageId,
|
||||
content: values.content,
|
||||
externalUrl: window.location.href,
|
||||
originalId,
|
||||
characterId: comment.characterId,
|
||||
noteId: comment.noteId,
|
||||
originalCharacterId,
|
||||
originalNoteId,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
commentPage.mutate({
|
||||
pageId: pageId,
|
||||
characterId,
|
||||
noteId,
|
||||
content: values.content,
|
||||
externalUrl: window.location.href,
|
||||
originalId: originalId,
|
||||
originalCharacterId,
|
||||
originalNoteId,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -79,8 +78,8 @@ export const CommentInput: React.FC<{
|
||||
<div className="xlog-comment-input flex">
|
||||
<Avatar
|
||||
className="align-middle mr-3"
|
||||
images={viewer?.avatars || []}
|
||||
name={viewer?.name}
|
||||
images={account?.character?.metadata?.content?.avatars || []}
|
||||
name={account?.character?.metadata?.content?.name}
|
||||
size={45}
|
||||
/>
|
||||
<form className="w-full" onSubmit={handleSubmit}>
|
||||
@@ -88,12 +87,8 @@ export const CommentInput: React.FC<{
|
||||
<Input
|
||||
id="content"
|
||||
isBlock
|
||||
required={
|
||||
!!account && userSites.isSuccess && !!userSites.data?.length
|
||||
}
|
||||
disabled={
|
||||
!account || !userSites.isSuccess || !userSites.data?.length
|
||||
}
|
||||
required={!!account?.character}
|
||||
disabled={!account?.character}
|
||||
multiline
|
||||
maxLength={600}
|
||||
className="mb-2"
|
||||
@@ -125,21 +120,14 @@ export const CommentInput: React.FC<{
|
||||
</Popover>
|
||||
<Button
|
||||
type="submit"
|
||||
isLoading={
|
||||
userSites.isLoading ||
|
||||
commentPage.isLoading ||
|
||||
updateComment.isLoading
|
||||
}
|
||||
isLoading={commentPage.isLoading || updateComment.isLoading}
|
||||
isDisabled={
|
||||
!!account &&
|
||||
userSites.isSuccess &&
|
||||
!!userSites.data?.length &&
|
||||
form.watch("content").trim().length === 0
|
||||
!!account?.character && form.watch("content").trim().length === 0
|
||||
}
|
||||
>
|
||||
{t(
|
||||
account
|
||||
? userSites.isSuccess && !userSites.data?.length
|
||||
? !account.character
|
||||
? "Create Character"
|
||||
: comment
|
||||
? "Confirm Modification"
|
||||
|
||||
@@ -22,10 +22,11 @@ export const CommentItem: React.FC<{
|
||||
comment: NoteEntity & {
|
||||
character?: CharacterEntity | null
|
||||
}
|
||||
originalId?: string
|
||||
originalCharacterId?: number
|
||||
originalNoteId?: number
|
||||
depth: number
|
||||
className?: string
|
||||
}> = ({ comment, originalId, depth, className }) => {
|
||||
}> = ({ comment, originalCharacterId, originalNoteId, depth, className }) => {
|
||||
const [replyOpen, setReplyOpen] = useState(false)
|
||||
const [editOpen, setEditOpen] = useState(false)
|
||||
|
||||
@@ -108,7 +109,8 @@ export const CommentItem: React.FC<{
|
||||
>
|
||||
<ReactionLike
|
||||
size="sm"
|
||||
pageId={`${comment.characterId}-${comment.noteId}`}
|
||||
characterId={comment.characterId}
|
||||
noteId={comment.noteId}
|
||||
/>
|
||||
</div>
|
||||
{depth < 2 && (
|
||||
@@ -137,8 +139,10 @@ export const CommentItem: React.FC<{
|
||||
{replyOpen && (
|
||||
<div className="pt-6">
|
||||
<CommentInput
|
||||
originalId={originalId}
|
||||
pageId={`${comment.characterId}-${comment.noteId}`}
|
||||
originalCharacterId={originalCharacterId}
|
||||
originalNoteId={originalNoteId}
|
||||
characterId={comment.characterId}
|
||||
noteId={comment.noteId}
|
||||
onSubmitted={() => setReplyOpen(false)}
|
||||
/>
|
||||
</div>
|
||||
@@ -146,8 +150,10 @@ export const CommentItem: React.FC<{
|
||||
{editOpen && (
|
||||
<div className="pt-6">
|
||||
<CommentInput
|
||||
originalId={originalId}
|
||||
pageId={`${comment.characterId}-${comment.noteId}`}
|
||||
originalCharacterId={originalCharacterId}
|
||||
originalNoteId={originalNoteId}
|
||||
characterId={comment.characterId}
|
||||
noteId={comment.noteId}
|
||||
onSubmitted={() => setEditOpen(false)}
|
||||
comment={comment}
|
||||
/>
|
||||
@@ -164,7 +170,8 @@ export const CommentItem: React.FC<{
|
||||
},
|
||||
) => (
|
||||
<CommentItem
|
||||
originalId={originalId}
|
||||
originalCharacterId={originalCharacterId}
|
||||
originalNoteId={originalNoteId}
|
||||
comment={subcomment}
|
||||
key={subcomment.transactionHash}
|
||||
depth={depth + 1}
|
||||
|
||||
@@ -32,7 +32,6 @@ import { Menu } from "~/components/ui/Menu"
|
||||
import { SITE_URL } from "~/lib/env"
|
||||
import { getSiteLink } from "~/lib/helpers"
|
||||
import { cn } from "~/lib/utils"
|
||||
import { useAccountSites } from "~/queries/site"
|
||||
|
||||
import { UniLink } from "../ui/UniLink"
|
||||
|
||||
@@ -90,8 +89,6 @@ export const ConnectButton: React.FC<{
|
||||
const selectCharactersModal = useSelectCharactersModal()
|
||||
const walletMintNewCharacterModal = useWalletMintNewCharacterModal()
|
||||
|
||||
const userSites = useAccountSites()
|
||||
|
||||
const showNotificationModal = useShowNotificationModal()
|
||||
const { isAllRead } = useNotifications()
|
||||
|
||||
@@ -112,12 +109,12 @@ export const ConnectButton: React.FC<{
|
||||
}, [balance])
|
||||
|
||||
const dropdownLinks: HeaderLinkType[] = [
|
||||
userSites.data?.[0]?.username
|
||||
account?.character
|
||||
? {
|
||||
icon: "icon-[mingcute--home-1-line]",
|
||||
label: t("My xLog") || "",
|
||||
url: getSiteLink({
|
||||
subdomain: userSites.data?.[0]?.username,
|
||||
subdomain: account?.character?.handle || "",
|
||||
}),
|
||||
}
|
||||
: {
|
||||
@@ -219,115 +216,107 @@ export const ConnectButton: React.FC<{
|
||||
className="relative flex items-center -mr-2"
|
||||
style={{ height: avatarSize + "px" }}
|
||||
>
|
||||
{userSites.isSuccess ? (
|
||||
{!hideNotification && (
|
||||
<>
|
||||
{!hideNotification && (
|
||||
<>
|
||||
{isAllRead ? (
|
||||
<BellIcon
|
||||
className={`${
|
||||
size === "base" ? "w-6 h-6" : "w-5 h-5"
|
||||
} text-zinc-500 cursor-pointer sm:hover:animate-buzz-out`}
|
||||
onClick={showNotificationModal}
|
||||
/>
|
||||
) : (
|
||||
<BellAlertIcon
|
||||
className={`${
|
||||
size === "base" ? "w-6 h-6" : "w-5 h-5"
|
||||
} text-accent cursor-pointer sm:hover:animate-buzz-out`}
|
||||
onClick={showNotificationModal}
|
||||
/>
|
||||
)}
|
||||
<div className="h-full w-[2px] py-1 ml-3">
|
||||
<div className="w-full h-full bg-zinc-200 rounded-full"></div>
|
||||
</div>
|
||||
</>
|
||||
{isAllRead ? (
|
||||
<BellIcon
|
||||
className={`${
|
||||
size === "base" ? "w-6 h-6" : "w-5 h-5"
|
||||
} text-zinc-500 cursor-pointer sm:hover:animate-buzz-out`}
|
||||
onClick={showNotificationModal}
|
||||
/>
|
||||
) : (
|
||||
<BellAlertIcon
|
||||
className={`${
|
||||
size === "base" ? "w-6 h-6" : "w-5 h-5"
|
||||
} text-accent cursor-pointer sm:hover:animate-buzz-out`}
|
||||
onClick={showNotificationModal}
|
||||
/>
|
||||
)}
|
||||
<Menu
|
||||
placement="bottom-end"
|
||||
target={
|
||||
<button
|
||||
className="flex items-center w-full hover:bg-hover transition-colors py-1 px-2 rounded-lg ml-1"
|
||||
type="button"
|
||||
aria-label="connector"
|
||||
>
|
||||
<Avatar
|
||||
className="align-middle"
|
||||
images={userSites.data?.[0]?.avatars || []}
|
||||
name={userSites.data?.[0]?.name}
|
||||
size={avatarSize}
|
||||
/>
|
||||
{!hideName && (
|
||||
<>
|
||||
<div
|
||||
className={`flex-1 flex-col min-w-0 ml-2 max-w-[100px] ${
|
||||
mobileSimplification ? "hidden sm:flex" : "flex"
|
||||
<div className="h-full w-[2px] py-1 ml-3">
|
||||
<div className="w-full h-full bg-zinc-200 rounded-full"></div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<Menu
|
||||
placement="bottom-end"
|
||||
target={
|
||||
<button
|
||||
className="flex items-center w-full hover:bg-hover transition-colors py-1 px-2 rounded-lg ml-1"
|
||||
type="button"
|
||||
aria-label="connector"
|
||||
>
|
||||
<Avatar
|
||||
className="align-middle"
|
||||
images={account.character?.metadata?.content?.avatars || []}
|
||||
name={account.character?.metadata?.content?.name}
|
||||
size={avatarSize}
|
||||
/>
|
||||
{!hideName && (
|
||||
<>
|
||||
<div
|
||||
className={`flex-1 flex-col min-w-0 ml-2 max-w-[100px] ${
|
||||
mobileSimplification ? "hidden sm:flex" : "flex"
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
className={`text-left leading-none font-medium truncate ${
|
||||
InsufficientBalance
|
||||
? "text-red-600"
|
||||
: "text-gray-600"
|
||||
} ${size === "base" ? "text-base" : "text-sm"}`}
|
||||
style={{ marginBottom: "0.15rem" }}
|
||||
>
|
||||
{account.character?.metadata?.content?.name ||
|
||||
getAccountDisplayName(account)}
|
||||
</span>
|
||||
{account.character?.handle && (
|
||||
<span
|
||||
className={`text-left leading-none ${
|
||||
sizeDecrease === "sm" ? "text-sm" : "text-xs"
|
||||
} truncate ${
|
||||
InsufficientBalance
|
||||
? "text-red-400"
|
||||
: "text-gray-400"
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
className={`text-left leading-none font-medium truncate ${
|
||||
InsufficientBalance
|
||||
? "text-red-600"
|
||||
: "text-gray-600"
|
||||
} ${size === "base" ? "text-base" : "text-sm"}`}
|
||||
style={{ marginBottom: "0.15rem" }}
|
||||
>
|
||||
{userSites.data?.[0]?.name ||
|
||||
getAccountDisplayName(account)}
|
||||
</span>
|
||||
{userSites.data?.[0]?.username && (
|
||||
<span
|
||||
className={`text-left leading-none ${
|
||||
sizeDecrease === "sm" ? "text-sm" : "text-xs"
|
||||
} truncate ${
|
||||
InsufficientBalance
|
||||
? "text-red-400"
|
||||
: "text-gray-400"
|
||||
}`}
|
||||
>
|
||||
{"@" + userSites.data?.[0]?.username ||
|
||||
getAccountDisplayName(account)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<i className="icon-[mingcute--down-line] text-xl ml-[2px]" />
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
}
|
||||
dropdown={
|
||||
<div
|
||||
className={`text-gray-600 bg-white rounded-lg ring-1 ring-border min-w-[140px] shadow-md py-2 ${
|
||||
size === "base" ? "text-base" : "text-sm"
|
||||
} mt-1`}
|
||||
>
|
||||
{dropdownLinks.map((link, i) => {
|
||||
return (
|
||||
<UniLink
|
||||
key={i}
|
||||
href={link.url}
|
||||
onClick={link.onClick}
|
||||
className={`${
|
||||
size === "base"
|
||||
? "pl-5 pr-6 h-11"
|
||||
: "pl-4 pr-5 h-9"
|
||||
} flex items-center w-full whitespace-nowrap hover:bg-hover`}
|
||||
aria-label={link.label}
|
||||
>
|
||||
<span className="mr-2 flex justify-center">
|
||||
<i className={cn(link.icon, "text-base")} />
|
||||
</span>
|
||||
{link.label}
|
||||
</UniLink>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{"@" + account.character?.handle ||
|
||||
getAccountDisplayName(account)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<i className="icon-[mingcute--down-line] text-xl ml-[2px]" />
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
}
|
||||
dropdown={
|
||||
<div
|
||||
className={`text-gray-600 bg-white rounded-lg ring-1 ring-border min-w-[140px] shadow-md py-2 ${
|
||||
size === "base" ? "text-base" : "text-sm"
|
||||
} mt-1`}
|
||||
>
|
||||
{dropdownLinks.map((link, i) => {
|
||||
return (
|
||||
<UniLink
|
||||
key={i}
|
||||
href={link.url}
|
||||
onClick={link.onClick}
|
||||
className={`${
|
||||
size === "base" ? "pl-5 pr-6 h-11" : "pl-4 pr-5 h-9"
|
||||
} flex items-center w-full whitespace-nowrap hover:bg-hover`}
|
||||
aria-label={link.label}
|
||||
>
|
||||
<span className="mr-2 flex justify-center">
|
||||
<i className={cn(link.icon, "text-base")} />
|
||||
</span>
|
||||
{link.label}
|
||||
</UniLink>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
})()}
|
||||
|
||||
@@ -6,17 +6,16 @@ import { Button } from "~/components/ui/Button"
|
||||
import type { Variant } from "~/components/ui/Button"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { SITE_URL } from "~/lib/env"
|
||||
import { Profile } from "~/lib/types"
|
||||
import { ExpandedCharacter } from "~/lib/types"
|
||||
import { cn } from "~/lib/utils"
|
||||
import {
|
||||
useAccountSites,
|
||||
useGetSubscription,
|
||||
useSubscribeToSite,
|
||||
useUnsubscribeFromSite,
|
||||
} from "~/queries/site"
|
||||
|
||||
export const FollowingButton: React.FC<{
|
||||
site: Profile | undefined | null
|
||||
site?: ExpandedCharacter
|
||||
variant?: Variant
|
||||
className?: string
|
||||
size?: "sm" | "xl"
|
||||
@@ -24,27 +23,25 @@ export const FollowingButton: React.FC<{
|
||||
}> = ({ site, variant, className, size, loadingStatusChange }) => {
|
||||
const subscribeToSite = useSubscribeToSite()
|
||||
const unsubscribeFromSite = useUnsubscribeFromSite()
|
||||
const userSite = useAccountSites()
|
||||
const characterId = site?.metadata?.proof ? Number(site.metadata.proof) : null
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
const handleClickSubscribe = () => {
|
||||
if (characterId) {
|
||||
if (site?.characterId) {
|
||||
if (subscription.data) {
|
||||
unsubscribeFromSite.mutate({
|
||||
characterId,
|
||||
siteId: site?.username,
|
||||
characterId: site?.characterId,
|
||||
siteId: site?.handle,
|
||||
} as any)
|
||||
} else {
|
||||
subscribeToSite.mutate({
|
||||
characterId,
|
||||
siteId: site?.username,
|
||||
characterId: site?.characterId,
|
||||
siteId: site?.handle,
|
||||
} as any)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const subscription = useGetSubscription(site?.username)
|
||||
const subscription = useGetSubscription(site?.characterId)
|
||||
|
||||
useEffect(() => {
|
||||
if (subscribeToSite.isError) {
|
||||
@@ -99,8 +96,7 @@ export const FollowingButton: React.FC<{
|
||||
isLoading={
|
||||
subscription.data
|
||||
? unsubscribeFromSite.isLoading || subscribeToSite.isLoading
|
||||
: userSite.isLoading ||
|
||||
unsubscribeFromSite.isLoading ||
|
||||
: unsubscribeFromSite.isLoading ||
|
||||
subscribeToSite.isLoading ||
|
||||
subscription.isLoading
|
||||
}
|
||||
|
||||
@@ -9,18 +9,18 @@ import {
|
||||
} from "~/queries/site"
|
||||
|
||||
export const FollowingCount: React.FC<{
|
||||
siteId?: string
|
||||
characterId?: number
|
||||
disableList?: boolean
|
||||
}> = ({ siteId, disableList }) => {
|
||||
}> = ({ characterId, disableList }) => {
|
||||
let [isFollowListOpen, setIsFollowListOpen] = useState(false)
|
||||
let [isToFollowListOpen, setIsToFollowListOpen] = useState(false)
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
const subscriptions = useGetSiteSubscriptions({
|
||||
siteId: siteId || "",
|
||||
characterId,
|
||||
})
|
||||
const toSubscriptions = useGetSiteToSubscriptions({
|
||||
siteId: siteId || "",
|
||||
characterId,
|
||||
})
|
||||
|
||||
return (
|
||||
@@ -34,7 +34,7 @@ export const FollowingCount: React.FC<{
|
||||
onClick={() => setIsFollowListOpen(true)}
|
||||
>
|
||||
<span className="font-medium text-zinc-700 pr-[2px]">
|
||||
{subscriptions.data?.pages?.[0]?.total || 0}
|
||||
{subscriptions.data?.pages?.[0]?.count || 0}
|
||||
</span>{" "}
|
||||
{t("Followers")}
|
||||
</Button>
|
||||
@@ -47,7 +47,7 @@ export const FollowingCount: React.FC<{
|
||||
onClick={() => setIsToFollowListOpen(true)}
|
||||
>
|
||||
<span className="font-medium text-zinc-700 pr-[2px]">
|
||||
{toSubscriptions.data?.pages?.[0]?.total || 0}
|
||||
{toSubscriptions.data?.pages?.[0]?.count || 0}
|
||||
</span>{" "}
|
||||
{t("Followings")}
|
||||
</Button>
|
||||
|
||||
@@ -3,11 +3,11 @@ import { useState } from "react"
|
||||
|
||||
import { PatronModal } from "~/components/common/PatronModal"
|
||||
import { Button } from "~/components/ui/Button"
|
||||
import { Profile } from "~/lib/types"
|
||||
import { ExpandedCharacter } from "~/lib/types"
|
||||
import { cn } from "~/lib/utils"
|
||||
|
||||
export const PatronButton: React.FC<{
|
||||
site: Profile | undefined | null
|
||||
site?: ExpandedCharacter
|
||||
className?: string
|
||||
size?: "sm" | "xl"
|
||||
loadingStatusChange?: (status: boolean) => void
|
||||
|
||||
@@ -11,8 +11,7 @@ import { Button } from "~/components/ui/Button"
|
||||
import { Modal } from "~/components/ui/Modal"
|
||||
import { CSB_SCAN, MIRA_LINK } from "~/lib/env"
|
||||
import { getSiteLink } from "~/lib/helpers"
|
||||
import { Note, Profile } from "~/lib/types"
|
||||
import { parsePageId } from "~/models/page.model"
|
||||
import { ExpandedCharacter, ExpandedNote } from "~/lib/types"
|
||||
import { useGetTips, useTipCharacter } from "~/queries/site"
|
||||
|
||||
import { Tabs } from "../ui/Tabs"
|
||||
@@ -20,17 +19,23 @@ import { UniLink } from "../ui/UniLink"
|
||||
import { CharacterFloatCard } from "./CharacterFloatCard"
|
||||
|
||||
export const PatronModal: React.FC<{
|
||||
site: Profile | undefined | null
|
||||
page?: Note | null
|
||||
site?: ExpandedCharacter
|
||||
page?: ExpandedNote
|
||||
open: boolean
|
||||
setOpen: (open: boolean) => void
|
||||
}> = ({ site, page, open, setOpen }) => {
|
||||
const { t } = useTranslation("common")
|
||||
const tipCharacter = useTipCharacter()
|
||||
const tips = useGetTips({
|
||||
toCharacterId: site?.metadata?.proof,
|
||||
toNoteId: parsePageId(page?.id || "").noteId,
|
||||
})
|
||||
const tips = useGetTips(
|
||||
page
|
||||
? {
|
||||
toCharacterId: page?.characterId,
|
||||
toNoteId: page?.noteId,
|
||||
}
|
||||
: {
|
||||
toCharacterId: site?.characterId,
|
||||
},
|
||||
)
|
||||
const connectModal = useConnectModal()
|
||||
|
||||
const radios = [
|
||||
@@ -66,12 +71,12 @@ export const PatronModal: React.FC<{
|
||||
)
|
||||
|
||||
const submit = () => {
|
||||
if (currentCharacterId && site?.metadata?.proof && parseInt(value)) {
|
||||
if (currentCharacterId && site?.characterId && parseInt(value)) {
|
||||
tipCharacter.mutate({
|
||||
fromCharacterId: currentCharacterId,
|
||||
toCharacterId: site?.metadata?.proof,
|
||||
toCharacterId: site?.characterId,
|
||||
amount: parseInt(value),
|
||||
noteId: parsePageId(page?.id || "").noteId,
|
||||
noteId: page?.noteId,
|
||||
})
|
||||
} else {
|
||||
setOpen(false)
|
||||
@@ -100,7 +105,7 @@ export const PatronModal: React.FC<{
|
||||
tipCharacter.reset()
|
||||
}
|
||||
}
|
||||
}, [tipCharacter.isSuccess, t, site?.name])
|
||||
}, [tipCharacter.isSuccess, t])
|
||||
|
||||
useEffect(() => {
|
||||
if (tipCharacter.isError) {
|
||||
@@ -112,10 +117,10 @@ export const PatronModal: React.FC<{
|
||||
const title =
|
||||
(page
|
||||
? t("Tip the post: {{name}}", {
|
||||
name: page.title,
|
||||
name: page.metadata?.content?.title,
|
||||
})
|
||||
: t("Become a patron of {{name}}", {
|
||||
name: site?.name,
|
||||
name: site?.metadata?.content?.name,
|
||||
})) || ""
|
||||
|
||||
return (
|
||||
@@ -135,17 +140,21 @@ export const PatronModal: React.FC<{
|
||||
<div className="px-5 py-4 space-y-4 text-center">
|
||||
<div className="space-y-1">
|
||||
<span className="flex items-center justify-center">
|
||||
<Avatar images={site?.avatars || []} name={site?.name} size={100} />
|
||||
<Avatar
|
||||
images={site?.metadata?.content?.avatars || []}
|
||||
name={site?.metadata?.content?.name}
|
||||
size={100}
|
||||
/>
|
||||
</span>
|
||||
<span className="block">
|
||||
<span className="font-bold text-lg text-zinc-800">
|
||||
{site?.name}
|
||||
{site?.metadata?.content?.name}
|
||||
</span>
|
||||
<span className="ml-1 text-gray-600">@{site?.username}</span>
|
||||
<span className="ml-1 text-gray-600">@{site?.handle}</span>
|
||||
</span>
|
||||
{site?.description && (
|
||||
{site?.metadata?.content?.bio && (
|
||||
<span className="text-gray-600 text-sm line-clamp-4">
|
||||
{site?.description}
|
||||
{site?.metadata?.content?.bio}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,6 @@ import { Tooltip } from "~/components/ui/Tooltip"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
import { cn } from "~/lib/utils"
|
||||
import { parsePageId } from "~/models/page.model"
|
||||
import {
|
||||
useCheckLike,
|
||||
useGetLikeCounts,
|
||||
@@ -21,8 +20,9 @@ import { Button } from "../ui/Button"
|
||||
|
||||
export const ReactionLike: React.FC<{
|
||||
size?: "sm" | "base"
|
||||
pageId?: string
|
||||
}> = ({ size, pageId }) => {
|
||||
characterId?: number
|
||||
noteId?: number
|
||||
}> = ({ size, characterId, noteId }) => {
|
||||
const toggleLikePage = useToggleLikePage()
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
@@ -30,29 +30,44 @@ export const ReactionLike: React.FC<{
|
||||
const [isLikeListOpen, setIsLikeListOpen] = useState(false)
|
||||
const likeRef = useRef<HTMLButtonElement>(null)
|
||||
|
||||
const [likes, likesMutation] = useGetLikes({ pageId })
|
||||
const [likeStatus] = useCheckLike({
|
||||
pageId,
|
||||
const [likes, likesMutation] = useGetLikes({
|
||||
characterId,
|
||||
noteId,
|
||||
})
|
||||
const [likeStatus] = useCheckLike({
|
||||
characterId,
|
||||
noteId,
|
||||
})
|
||||
const { data: likeCount = 0 } = useGetLikeCounts({
|
||||
characterId,
|
||||
noteId,
|
||||
})
|
||||
const { data: likeCount = 0 } = useGetLikeCounts({ pageId })
|
||||
|
||||
const [isUnlikeOpen, setIsUnlikeOpen] = useState(false)
|
||||
|
||||
const like = () => {
|
||||
if (pageId) {
|
||||
if (characterId && noteId) {
|
||||
if (likeStatus.isLiked) {
|
||||
setIsLikeOpen(true)
|
||||
} else {
|
||||
toggleLikePage.mutate({ ...parsePageId(pageId), action: "link" })
|
||||
toggleLikePage.mutate({
|
||||
characterId,
|
||||
noteId,
|
||||
action: "link",
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const unlike = () => {
|
||||
if (pageId) {
|
||||
if (characterId && noteId) {
|
||||
setIsUnlikeOpen(false)
|
||||
if (likeStatus.isLiked) {
|
||||
toggleLikePage.mutate({ ...parsePageId(pageId), action: "unlink" })
|
||||
toggleLikePage.mutate({
|
||||
noteId,
|
||||
characterId,
|
||||
action: "unlink",
|
||||
})
|
||||
} // else do nothing
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { UniLink } from "~/components/ui/UniLink"
|
||||
import { CSB_SCAN, CSB_XCHAR } from "~/lib/env"
|
||||
import { noopArr } from "~/lib/noop"
|
||||
import { cn } from "~/lib/utils"
|
||||
import { parsePageId } from "~/models/page.model"
|
||||
import { useCheckMint, useGetMints, useMintPage } from "~/queries/page"
|
||||
|
||||
import { AvatarStack } from "../ui/AvatarStack"
|
||||
@@ -20,8 +19,9 @@ import { Button } from "../ui/Button"
|
||||
|
||||
export const ReactionMint: React.FC<{
|
||||
size?: "sm" | "base"
|
||||
pageId?: string
|
||||
}> = ({ size, pageId }) => {
|
||||
noteId?: number
|
||||
characterId?: number
|
||||
}> = ({ size, noteId, characterId }) => {
|
||||
const mintPage = useMintPage()
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
@@ -32,17 +32,24 @@ export const ReactionMint: React.FC<{
|
||||
const mintRef = useRef<HTMLButtonElement>(null)
|
||||
|
||||
const mints = useGetMints({
|
||||
pageId: pageId,
|
||||
characterId,
|
||||
noteId,
|
||||
includeCharacter: size !== "sm",
|
||||
})
|
||||
const isMint = useCheckMint(pageId)
|
||||
const isMint = useCheckMint({
|
||||
characterId,
|
||||
noteId,
|
||||
})
|
||||
|
||||
const mint = () => {
|
||||
if (pageId) {
|
||||
if (characterId && noteId) {
|
||||
if (isMint.data?.count) {
|
||||
setIsMintOpen(true)
|
||||
} else {
|
||||
mintPage.mutate(parsePageId(pageId))
|
||||
mintPage.mutate({
|
||||
characterId,
|
||||
noteId,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,11 +84,11 @@ export const ReactionMint: React.FC<{
|
||||
const avatars = useMemo(
|
||||
() =>
|
||||
mints.data?.pages?.[0]?.list
|
||||
?.sort((a, b: any) =>
|
||||
?.sort((a, b) =>
|
||||
b.character?.metadata?.content?.avatars?.[0] ? 1 : -1,
|
||||
)
|
||||
.slice(0, 3)
|
||||
.map((mint: any) => ({
|
||||
.map((mint) => ({
|
||||
images: mint.character?.metadata?.content?.avatars,
|
||||
name: mint.character?.metadata?.content?.name,
|
||||
})) || noopArr,
|
||||
|
||||
@@ -6,18 +6,18 @@ import { useAccountState } from "@crossbell/connect-kit"
|
||||
import { PatronModal } from "~/components/common/PatronModal"
|
||||
import { Tooltip } from "~/components/ui/Tooltip"
|
||||
import { noopArr } from "~/lib/noop"
|
||||
import { Note, Profile } from "~/lib/types"
|
||||
import { parsePageId } from "~/models/page.model"
|
||||
import { ExpandedCharacter, ExpandedNote } from "~/lib/types"
|
||||
import { useGetTips } from "~/queries/site"
|
||||
|
||||
import { AvatarStack } from "../ui/AvatarStack"
|
||||
import { Button } from "../ui/Button"
|
||||
|
||||
export const ReactionTip: React.FC<{
|
||||
pageId?: string
|
||||
site?: Profile | null
|
||||
page?: Note | null
|
||||
}> = ({ pageId, site, page }) => {
|
||||
characterId?: number
|
||||
noteId?: number
|
||||
site?: ExpandedCharacter
|
||||
page?: ExpandedNote
|
||||
}> = ({ characterId, noteId, site, page }) => {
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
const account = useAccountState((s) => s.computed.account)
|
||||
@@ -25,7 +25,6 @@ export const ReactionTip: React.FC<{
|
||||
const [isTipOpen, setIsTipOpen] = useState(false)
|
||||
const tipRef = useRef<HTMLButtonElement>(null)
|
||||
|
||||
const { characterId, noteId } = parsePageId(pageId || "")
|
||||
const tips = useGetTips({
|
||||
toCharacterId: characterId,
|
||||
toNoteId: noteId,
|
||||
@@ -37,7 +36,7 @@ export const ReactionTip: React.FC<{
|
||||
})
|
||||
|
||||
const tip = () => {
|
||||
if (pageId) {
|
||||
if (characterId && noteId) {
|
||||
setIsTipOpen(true)
|
||||
}
|
||||
}
|
||||
@@ -45,11 +44,11 @@ export const ReactionTip: React.FC<{
|
||||
const avatars = useMemo(
|
||||
() =>
|
||||
tips.data?.pages?.[0]?.list
|
||||
?.sort((a, b: any) =>
|
||||
?.sort((a, b) =>
|
||||
b.character?.metadata?.content?.avatars?.[0] ? 1 : -1,
|
||||
)
|
||||
.slice(0, 3)
|
||||
.map((mint: any) => ({
|
||||
.map((mint) => ({
|
||||
images: mint.character?.metadata?.content?.avatars,
|
||||
name: mint.character?.metadata?.content?.name,
|
||||
})) || noopArr,
|
||||
|
||||
Reference in New Issue
Block a user