"use client" import { useMemo, useRef, useState } from "react" import { useAccountState } from "@crossbell/connect-kit" import { PatronModal } from "~/components/common/PatronModal" import { Tooltip } from "~/components/ui/Tooltip" import { useTranslation } from "~/lib/i18n/client" import { noopArr } from "~/lib/noop" import { ExpandedCharacter, ExpandedNote } from "~/lib/types" import { cn } from "~/lib/utils" import { useGetTips } from "~/queries/site" import { AvatarStack } from "../ui/AvatarStack" import { Button } from "../ui/Button" export const ReactionTip = ({ characterId, noteId, site, page, vertical, }: { characterId?: number noteId?: number site?: ExpandedCharacter page?: ExpandedNote vertical?: boolean }) => { const { t } = useTranslation("common") const account = useAccountState((s) => s.computed.account) const [isTipOpen, setIsTipOpen] = useState(false) const tipRef = useRef(null) const tips = useGetTips({ toCharacterId: characterId, toNoteId: noteId, }) const isTip = useGetTips({ toCharacterId: characterId, toNoteId: noteId, characterId: account?.characterId || "0", }) const tip = () => { if (characterId && noteId) { setIsTipOpen(true) } } const showAvatarStack = !vertical const avatars = useMemo( () => tips.data?.pages?.[0]?.list ?.sort((a, b) => b.character?.metadata?.content?.avatars?.[0] ? 1 : -1, ) .slice(0, 3) .map((mint) => ({ images: mint.character?.metadata?.content?.avatars, name: mint.character?.metadata?.content?.name, })) || noopArr, [tips.data?.pages], ) return ( <>
{showAvatarStack && ( )}
) }