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
75 changes: 48 additions & 27 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 @@ -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 @@ -679,14 +679,26 @@
<div className="mt-6 space-y-4">
{/* Writer Stats — title outside box */}
<p className="text-muted text-[10px] uppercase tracking-wider">Writer Stats</p>
<div className="border-border rounded border px-4 py-3 text-xs">
<div className="grid grid-cols-2 gap-x-4 gap-y-1">
<span><span className="text-muted">Stories:</span> <span className="text-foreground font-medium">{storylines.length}</span></span>
<span><span className="text-muted">Plots:</span> <span className="text-foreground font-medium">{totalPlots}</span></span>
<span><span className="text-muted">Holders:</span> <span className="text-foreground font-medium">{totalHolders !== undefined ? totalHolders : "—"}</span></span>
<span><span className="text-muted">Views:</span> <span className="text-foreground font-medium">{storylines.reduce((sum, s) => sum + (s.view_count ?? 0), 0)}</span></span>
<div className="border-border rounded border px-4 py-3 text-xs space-y-2">
<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">{storylines.length}</div>
<div className="text-muted text-[9px]">Stories</div>
</div>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{totalPlots}</div>
<div className="text-muted text-[9px]">Plots</div>
</div>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{totalHolders !== undefined ? totalHolders : "—"}</div>
<div className="text-muted text-[9px]">Holders</div>
</div>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{storylines.reduce((sum, s) => sum + (s.view_count ?? 0), 0)}</div>
<div className="text-muted text-[9px]">Views</div>
</div>
</div>
<div className="mt-1">
<div className="border-border rounded border px-3 py-1.5">
<span className="text-muted">Received:</span>{" "}
<span className="text-foreground font-medium">
{totalDonations > BigInt(0) ? `${formatPrice(formatUnits(totalDonations, 18))} ${RESERVE_LABEL}` : "—"}
Expand Down Expand Up @@ -756,7 +768,7 @@
}) {
const tokenAddr = storyline.token_address as Address;

const { data: priceInfo } = useQuery({

Check warning on line 771 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 @@ -804,11 +816,11 @@
<>
<div className="border-border rounded border divide-y divide-border text-xs">
{/* Moleskine book (left) + Info (right) */}
<div className="flex flex-row gap-4 px-4 py-3">
<div className="flex flex-row items-center gap-4 px-4 py-3">
{/* Moleskine book card */}
<Link
href={`/story/${storyline.storyline_id}`}
className="moleskine-notebook group relative block shrink-0 self-start w-[110px] sm:w-[150px]"
className="moleskine-notebook group relative block shrink-0 w-[130px] sm:w-[180px]"
>
<div
className="notebook-cover relative z-10 flex flex-col overflow-hidden border border-[var(--border)]"
Expand All @@ -828,8 +840,8 @@
{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)]">
<div className="relative z-10 flex flex-1 items-center justify-center px-3 text-center">
<span className="font-heading text-sm sm:text-base font-bold leading-tight text-[var(--accent)]">
{storyline.title}
</span>
</div>
Expand All @@ -843,20 +855,29 @@

{/* Info (right) */}
<div className="min-w-0 flex-1 space-y-1">
<div className="space-y-0.5">
<div>
<span className="text-muted">Plots:</span> <span className="text-foreground font-medium">{storyline.plot_count}</span>
<span className="text-muted ml-2">&middot;</span>
{storyline.sunset ? (
<span className="border-border text-muted ml-2 rounded border px-1.5 py-0.5 text-[10px]">complete</span>
) : (
<span className="border border-green-700/30 text-green-700 ml-2 rounded px-1.5 py-0.5 text-[10px]">active</span>
)}
<div className="grid grid-cols-2 gap-2">
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{storyline.plot_count}</div>
<div className="text-muted text-[9px]">Plots</div>
</div>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{holderCount ?? "—"}</div>
<div className="text-muted text-[9px]">Holders</div>
</div>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{formatViewCount(storyline.view_count)}</div>
<div className="text-muted text-[9px]">Views</div>
</div>
<div className="border-border rounded border px-2 py-1.5 text-center">
<div className="text-foreground text-sm font-bold">{storyline.block_timestamp ? new Date(storyline.block_timestamp).toLocaleDateString("en-US", { month: "short", day: "numeric" }) : "—"}</div>
<div className="text-muted text-[9px]">Created</div>
</div>
<div><span className="text-muted">Holders:</span> <span className="text-foreground font-medium">{holderCount ?? "—"}</span></div>
<div><span className="text-muted">Views:</span> <span className="text-foreground font-medium">{formatViewCount(storyline.view_count)}</span></div>
<div><span className="text-muted">Created:</span> <span className="text-foreground font-medium">{storyline.block_timestamp ? new Date(storyline.block_timestamp).toLocaleDateString("en-US", { month: "short", day: "numeric" }) : "—"}</span></div>
</div>
{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>
)}
{/* TVL + Donations (inline in info area) */}
{storyline.token_address && (
<>
Expand Down Expand Up @@ -1009,7 +1030,7 @@

const DONATION_PAGE_SIZE = 10;

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

Check warning on line 1033 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 @@ -1386,10 +1407,10 @@
{holdings!.map((h) => (
<div key={h.storyline.id} className="border-border rounded border text-xs">
{/* Moleskine book (left) + Info (right) */}
<div className="flex flex-row gap-4 px-4 py-3">
<div className="flex flex-row items-center gap-4 px-4 py-3">
<Link
href={`/story/${h.storyline.storyline_id}`}
className="moleskine-notebook group relative block shrink-0 self-start w-[110px] sm:w-[150px]"
className="moleskine-notebook group relative block shrink-0 w-[130px] sm:w-[180px]"
>
<div
className="notebook-cover relative z-10 flex flex-col overflow-hidden border border-[var(--border)]"
Expand All @@ -1409,8 +1430,8 @@
{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)]">
<div className="relative z-10 flex flex-1 items-center justify-center px-3 text-center">
<span className="font-heading text-sm sm:text-base font-bold leading-tight text-[var(--accent)]">
{h.storyline.title}
</span>
</div>
Expand Down
Loading