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
109 changes: 70 additions & 39 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 @@ -170,7 +170,7 @@
: "text-muted hover:text-foreground"
}`}
>
{t === "stories" ? "Writer" : t === "portfolio" ? "Portfolio" : "Activity"}
{t === "stories" ? "Writer" : t === "portfolio" ? "Reader" : "Activity"}
</button>
))}
</div>
Expand Down Expand Up @@ -631,7 +631,7 @@
});

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

Check warning on line 634 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 @@ -756,7 +756,7 @@
}) {
const tokenAddr = storyline.token_address as Address;

const { data: priceInfo } = useQuery({

Check warning on line 759 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 @@ -1014,7 +1014,7 @@

const DONATION_PAGE_SIZE = 10;

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

Check warning on line 1017 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 @@ -1356,10 +1356,11 @@

return (
<div className="mt-6 space-y-4">
{/* Portfolio summary — structured grid */}
{/* Portfolio summary */}
{hasHoldings && (
<>
<p className="text-muted text-[10px] uppercase tracking-wider">Portfolio</p>
<div className="border-border rounded border px-4 py-3 text-xs">
<p className="text-muted mb-2 text-[10px] uppercase tracking-wider">Portfolio</p>
<div className="space-y-1">
<div>
<span className="text-muted">Value:</span>{" "}
Expand All @@ -1380,54 +1381,84 @@
)}
</div>
</div>
</>
)}

{/* Token holdings — structured cards */}
{hasHoldings && holdings!.map((h) => (
{/* Token holdings */}
{hasHoldings && (
<>
<p className="text-muted text-[10px] uppercase tracking-wider">Token Holdings</p>
{holdings!.map((h) => (
<div key={h.storyline.id} className="border-border rounded border text-xs">
{/* Title + genre */}
<div className="px-4 py-3 flex items-baseline gap-2">
{/* Moleskine book (left) + Info (right) */}
<div className="flex flex-col sm:flex-row gap-4 px-4 py-3">
<Link
href={`/story/${h.storyline.storyline_id}`}
className="font-body text-base font-bold text-accent hover:opacity-80 transition-opacity"
className="moleskine-notebook group relative block shrink-0 self-start"
style={{ width: "120px" }}
>
{h.storyline.title}
<div
className="notebook-cover relative z-10 flex flex-col overflow-hidden border border-[var(--border)]"
style={{
aspectRatio: "2/3",
borderRadius: "5px 12px 12px 5px",
backgroundColor: "#F5EFE6",
boxShadow: "2px 4px 8px rgba(44, 24, 16, 0.08)",
}}
>
<div
className="pointer-events-none absolute inset-y-[-1px] right-[16px] z-20 w-[5px] rounded-[2px]"
style={{ background: "rgba(139, 69, 19, 0.15)" }}
/>
<div className="relative z-10 px-2.5 pt-2.5">
<span className="rounded-sm bg-[var(--accent)]/10 px-1.5 py-0.5 text-[8px] font-semibold uppercase tracking-widest text-[var(--accent)]">
{h.storyline.genre || "Uncategorized"}
</span>
</div>
<div className="relative z-10 flex flex-1 items-center justify-center px-2.5 text-center">
<span className="font-heading text-xs font-bold leading-tight text-[var(--accent)]">
{h.storyline.title}
</span>
</div>
<div className="relative z-10 px-2.5 pb-2.5">
<span className="text-[8px] text-[var(--text-muted)]">
{h.storyline.plot_count} {h.storyline.plot_count === 1 ? "plot" : "plots"}
</span>
</div>
</div>
</Link>
{h.storyline.genre && (
<span className="bg-accent/10 text-accent rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0">{h.storyline.genre}</span>
)}
</div>
{/* Stats */}
<div className="border-t border-border px-4 py-3 space-y-1">
<div>
<span className="text-muted">Value:</span>{" "}
<span className="text-foreground font-medium">{formatPrice(formatUnits(h.value, h.reserveDecimals))} {RESERVE_LABEL}</span>
{plotUsd && <span className="text-muted"> ({formatUsdValue(Number(formatUnits(h.value, h.reserveDecimals)) * plotUsd)})</span>}
{h.priceChange !== null && (
<span className={`ml-2 font-medium ${h.priceChange >= 0 ? "text-accent" : "text-error"}`}>
{h.priceChange >= 0 ? "+" : ""}{h.priceChange.toFixed(1)}%
</span>
)}
</div>
<div><span className="text-muted">Balance:</span> <span className="text-foreground font-medium">{formatPrice(formatUnits(h.balance, 18))} tokens</span></div>
<div>
<span className="text-muted">Price:</span>{" "}
<span className="text-foreground font-medium">{formatPrice(formatUnits(h.price, 18))} {RESERVE_LABEL}</span>
{plotUsd != null && <span className="text-muted"> ({formatUsdValue(Number(formatUnits(h.price, 18)) * plotUsd)})</span>}
</div>
{h.entryPrice !== null && h.entryPrice > 0 && (
<div className="min-w-0 flex-1 space-y-1">
<div>
<span className="text-muted">Entry:</span>{" "}
<span className="text-foreground font-medium">{formatPrice(h.entryPrice)} {RESERVE_LABEL}</span>
{plotUsd != null && <span className="text-muted"> ({formatUsdValue(h.entryPrice * plotUsd)})</span>}
<span className="text-foreground font-medium">{formatPrice(formatUnits(h.value, h.reserveDecimals))} {RESERVE_LABEL}</span>
{plotUsd && <span className="text-muted"> ({formatUsdValue(Number(formatUnits(h.value, h.reserveDecimals)) * plotUsd)})</span>}
{h.priceChange !== null && (
<span className={`ml-2 font-medium ${h.priceChange >= 0 ? "text-accent" : "text-error"}`}>
{h.priceChange >= 0 ? "+" : ""}{h.priceChange.toFixed(1)}%
</span>
)}
</div>
)}
{h.lastTraded && (
<div><span className="text-muted">Traded:</span> <span className="text-foreground font-medium">{new Date(h.lastTraded).toLocaleDateString("en-US", { month: "short", day: "numeric" })}</span></div>
)}
<div><span className="text-muted">Balance:</span> <span className="text-foreground font-medium">{formatPrice(formatUnits(h.balance, 18))} tokens</span></div>
<div>
<span className="text-muted">Price:</span>{" "}
<span className="text-foreground font-medium">{formatPrice(formatUnits(h.price, 18))} {RESERVE_LABEL}</span>
{plotUsd != null && <span className="text-muted"> ({formatUsdValue(Number(formatUnits(h.price, 18)) * plotUsd)})</span>}
</div>
{h.entryPrice !== null && h.entryPrice > 0 && (
<div>
<span className="text-muted">Entry:</span>{" "}
<span className="text-foreground font-medium">{formatPrice(h.entryPrice)} {RESERVE_LABEL}</span>
{plotUsd != null && <span className="text-muted"> ({formatUsdValue(h.entryPrice * plotUsd)})</span>}
</div>
)}
{h.lastTraded && (
<div><span className="text-muted">Traded:</span> <span className="text-foreground font-medium">{new Date(h.lastTraded).toLocaleDateString("en-US", { month: "short", day: "numeric" })}</span></div>
)}
</div>
</div>
</div>
))}
</>
)}

{/* Donations — structured card */}
{(hasDonationsReceived || (isOwnProfile && hasDonationsGiven)) && (
Expand Down
Loading