Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 30 additions & 33 deletions src/app/profile/[address]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { getFullUserProfile } from "../../../../lib/actions";
import { truncateAddress } from "../../../../lib/utils";
import { formatPrice, formatSupply } from "../../../../lib/format";
import { getTokenPrice, mcv2BondAbi, erc20Abi, type TokenPriceInfo, get24hPriceChange, getTokenTVL } from "../../../../lib/price";

Check warning on line 14 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

'TokenPriceInfo' is defined but never used
import { browserClient } from "../../../../lib/rpc";
import type { FarcasterProfile } from "../../../../lib/farcaster";
import type { AgentMetadata } from "../../../../lib/contracts/erc8004";
Expand Down Expand Up @@ -133,7 +133,7 @@
if (r <= 0) clearInterval(interval);
}, 1000);
return () => clearInterval(interval);
}, [dbUser?.steemhunt_fetched_at]);

Check warning on line 136 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

React Hook useEffect has a missing dependency: 'COOLDOWN_MS'. Either include it or remove the dependency array

const onCooldown = cooldownRemaining > 0;

Expand Down Expand Up @@ -658,7 +658,7 @@
});

// Claimable royalties (own profile only)
const { data: royaltyInfo } = useQuery({

Check warning on line 661 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

'royaltyInfo' is assigned a value but never used
queryKey: ["profile-royalties", address],
queryFn: async () => {
const [balance, claimed] = await browserClient.readContract({
Expand Down Expand Up @@ -798,7 +798,7 @@
}) {
const tokenAddr = storyline.token_address as Address;

const { data: priceInfo } = useQuery({

Check warning on line 801 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

'priceInfo' is assigned a value but never used
queryKey: ["profile-story-price", storyline.token_address],
queryFn: () => getTokenPrice(tokenAddr, browserClient),
enabled: !!storyline.token_address,
Expand Down Expand Up @@ -919,17 +919,17 @@
{/* Status + Created + Deadline */}
<div className="px-4 py-2 text-xs space-y-0.5">
<div className="flex items-center gap-2">
{storyline.sunset ? (
<span className="border-border text-muted rounded border px-1.5 py-0.5 text-[10px]">complete</span>
) : (
<span className="border border-green-700/30 text-green-700 rounded px-1.5 py-0.5 text-[10px]">active</span>
)}
{!storyline.sunset && storyline.last_plot_time && (
<>
<span className="text-muted">·</span>
<DeadlineCountdown lastPlotTime={storyline.last_plot_time} />
<span className="text-muted">·</span>
</>
)}
{storyline.sunset ? (
<span className="border-border text-muted rounded border px-1.5 py-0.5 text-[10px]">complete</span>
) : (
<span className="border border-green-700/30 text-green-700 rounded px-1.5 py-0.5 text-[10px]">active</span>
)}
</div>
<div>
<span className="text-muted">Created:</span>{" "}
Expand Down Expand Up @@ -1069,7 +1069,7 @@

const DONATION_PAGE_SIZE = 10;

function ProfileDonationHistory({ storylineId }: { storylineId: number }) {

Check warning on line 1072 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

'ProfileDonationHistory' is defined but never used
const { data: plotUsd } = usePlotUsdPrice();
const {
data,
Expand Down Expand Up @@ -1416,24 +1416,25 @@
<>
<p className="text-muted text-[10px] uppercase tracking-wider">Portfolio</p>
<div className="border-border rounded border px-4 py-3 text-xs">
<div className="space-y-1">
<div>
<span className="text-muted">Value:</span>{" "}
<span className="text-foreground font-medium">{formatPrice(formatUnits(totalValue, reserveDecimals))} {RESERVE_LABEL}</span>
{plotUsd && <span className="text-muted"> ({formatUsdValue(Number(formatUnits(totalValue, reserveDecimals)) * plotUsd)})</span>}
<div className="grid grid-cols-2 sm:grid-cols-4 gap-2">
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{formatPrice(formatUnits(totalValue, reserveDecimals))}</div>
<div className="text-muted text-[9px]">{RESERVE_LABEL}</div>
</div>
<div><span className="text-muted">Tokens:</span> <span className="text-foreground font-medium">{holdings!.length}</span></div>
{bestPick && bestPick.priceChange !== null && (
<div>
<span className="text-muted">Best 24h:</span>{" "}
<span className="text-foreground font-medium">
{bestPick.storyline.title.slice(0, 20)}{bestPick.storyline.title.length > 20 ? "..." : ""}
</span>
<span className={`ml-1 font-medium ${bestPick.priceChange >= 0 ? "text-accent" : "text-error"}`}>
{bestPick.priceChange >= 0 ? "+" : ""}{bestPick.priceChange.toFixed(1)}%
</span>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{plotUsd ? formatUsdValue(Number(formatUnits(totalValue, reserveDecimals)) * plotUsd) : "—"}</div>
<div className="text-muted text-[9px]">USD</div>
</div>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{holdings!.length}</div>
<div className="text-muted text-[9px]">Holdings</div>
</div>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className={`text-sm font-bold ${bestPick && bestPick.priceChange !== null ? (bestPick.priceChange >= 0 ? "text-accent" : "text-error") : "text-foreground"}`}>
{bestPick && bestPick.priceChange !== null ? `${bestPick.priceChange >= 0 ? "+" : ""}${bestPick.priceChange.toFixed(1)}%` : "—"}
</div>
)}
<div className="text-muted text-[9px]">Best 24h</div>
</div>
</div>
</div>
</>
Expand Down Expand Up @@ -1518,21 +1519,17 @@
{(hasDonationsReceived || (isOwnProfile && hasDonationsGiven)) && (
<div className="border-border rounded border px-4 py-3 text-xs">
<p className="text-muted mb-2 text-[10px] uppercase tracking-wider">Donations</p>
<div className="space-y-1">
<div className="grid grid-cols-2 gap-2">
{hasDonationsReceived && (
<div>
<span className="text-muted">Received:</span>{" "}
<span className="text-foreground font-medium">{formatPrice(formatUnits(donationsReceived!.total, 18))} {RESERVE_LABEL}</span>
{plotUsd != null && <span className="text-muted"> ({formatUsdValue(Number(formatUnits(donationsReceived!.total, 18)) * plotUsd)})</span>}
<span className="text-muted"> from {donationsReceived!.count} {donationsReceived!.count === 1 ? "donation" : "donations"}</span>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{formatPrice(formatUnits(donationsReceived!.total, 18))}</div>
<div className="text-muted text-[9px]">Received · {donationsReceived!.count}</div>
</div>
)}
{isOwnProfile && hasDonationsGiven && (
<div>
<span className="text-muted">Given:</span>{" "}
<span className="text-foreground font-medium">{formatPrice(formatUnits(totalDonated, 18))} {RESERVE_LABEL}</span>
{plotUsd != null && totalDonated > BigInt(0) && <span className="text-muted"> ({formatUsdValue(Number(formatUnits(totalDonated, 18)) * plotUsd)})</span>}
<span className="text-muted"> · {donationTotalCount} {donationTotalCount === 1 ? "donation" : "donations"}</span>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{formatPrice(formatUnits(totalDonated, 18))}</div>
<div className="text-muted text-[9px]">Given · {donationTotalCount}</div>
</div>
)}
</div>
Expand Down
Loading