Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tokens metadata for creators token #4096

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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