Skip to content

Commit

Permalink
fix: tokens metadata for creators token (#4096)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed Dec 3, 2023
2 parents e847884 + 375e8bb commit 3de5ede
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { POLYGONSCAN_URL } from '@hey/data/constants';
import type { Profile, RecipientDataOutput } from '@hey/lens';
import { useProfilesQuery } from '@hey/lens';
import formatAddress from '@hey/lib/formatAddress';
import getLennyURL from '@hey/lib/getLennyURL';
import getAvatar from '@hey/lib/getAvatar';
import getProfile from '@hey/lib/getProfile';
import getStampFyiURL from '@hey/lib/getStampFyiURL';
import Link from 'next/link';
Expand Down Expand Up @@ -54,11 +54,7 @@ const Splits: FC<SplitsProps> = ({ recipients }) => {
<>
<img
className="h-5 w-5 rounded-full border bg-gray-200 dark:border-gray-700"
src={
profile
? getLennyURL(profile.id)
: getStampFyiURL(address)
}
src={profile ? getAvatar(profile) : getStampFyiURL(address)}
alt="Avatar"
/>
{profile ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Slug from '@components/Shared/Slug';
import {
BanknotesIcon,
ClockIcon,
CurrencyDollarIcon,
PhotoIcon,
PuzzlePieceIcon,
RectangleStackIcon,
Expand All @@ -20,6 +21,7 @@ import type {
SimpleCollectOpenActionSettings
} from '@hey/lens';
import { FollowModuleType } from '@hey/lens';
import getAllTokens from '@hey/lib/api/getAllTokens';
import formatAddress from '@hey/lib/formatAddress';
import getAssetSymbol from '@hey/lib/getAssetSymbol';
import getProfile from '@hey/lib/getProfile';
Expand Down Expand Up @@ -47,6 +49,11 @@ const CollectModule: FC<CollectModuleProps> = ({ publication, openAction }) => {
? publication?.mirrorOn
: publication;

const { data: allowedTokens } = useQuery({
queryKey: ['getAllTokens'],
queryFn: () => getAllTokens()
});

const [showCollectorsModal, setShowCollectorsModal] = useState(false);
const [countOpenActions, setCountOpenActions] = useState(
targetPublication.stats.countOpenActions
Expand All @@ -66,6 +73,8 @@ const CollectModule: FC<CollectModuleProps> = ({ publication, openAction }) => {
const isMultirecipientFeeCollectModule =
collectModule.__typename === 'MultirecipientFeeCollectOpenActionSettings';
const percentageCollected = (countOpenActions / collectLimit) * 100;
const enabledTokens = allowedTokens?.map((t) => t.symbol);
const isTokenEnabled = enabledTokens?.includes(currency);

const { data: usdPrice } = useQuery({
queryKey: ['getRedstonePrice', currency],
Expand Down Expand Up @@ -108,18 +117,22 @@ const CollectModule: FC<CollectModuleProps> = ({ publication, openAction }) => {
</div>
{amount ? (
<div className="flex items-center space-x-1.5 py-2">
<img
className="h-7 w-7"
height={28}
width={28}
src={getTokenImage(currency)}
alt={currency}
title={currency}
/>
{isTokenEnabled ? (
<img
className="h-7 w-7"
height={28}
width={28}
src={getTokenImage(currency)}
alt={currency}
title={currency}
/>
) : (
<CurrencyDollarIcon className="text-brand-500 h-7 w-7" />
)}
<span className="space-x-1">
<span className="text-2xl font-bold">{amount}</span>
<span className="text-xs">{currency}</span>
{usdPrice ? (
{isTokenEnabled && usdPrice ? (
<>
<span className="ld-text-gray-500 px-0.5">·</span>
<span className="ld-text-gray-500 text-xs font-bold">
Expand Down

1 comment on commit 3de5ede

@vercel
Copy link

@vercel vercel bot commented on 3de5ede Dec 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web – ./

heyxyz.vercel.app
web-git-main-heyxyz.vercel.app
web-heyxyz.vercel.app
hey.xyz

Please sign in to comment.