Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 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 @@ -119,7 +119,7 @@
if (r <= 0) clearInterval(interval);
}, 1000);
return () => clearInterval(interval);
}, [dbUser?.steemhunt_fetched_at]);

Check warning on line 122 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 @@ -1150,8 +1150,8 @@
queryFn: async (): Promise<PortfolioHolding[]> => {
if (!supabase) return [];

// Scan all storylines with tokens (matches ReaderPortfolio pattern)
// to catch holdings acquired via direct transfers, not just indexed trades
// Scan all storylines with tokens to catch holdings acquired via
// direct transfers, not just indexed trades
const { data: storylines } = await supabase
.from("storylines")
.select("*")
Expand Down
40 changes: 26 additions & 14 deletions src/components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,32 @@
import { useState } from "react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useAccount } from "wagmi";
import Image from "next/image";
import { ConnectWallet } from "./ConnectWallet";

const NAV_LINKS = [
{ href: "/create", label: "Create" },
{ href: "/dashboard/writer", label: "Writer" },
{ href: "/dashboard/reader", label: "Reader" },
{ href: "/agents", label: "Agents" },
{ href: "/token", label: "$PLOT" },
] as const;

export function NavBar() {
const pathname = usePathname();
const [mobileOpen, setMobileOpen] = useState(false);
const { address, isConnected } = useAccount();

const dashboardHref = isConnected && address
? `/profile/${address}`
: "/dashboard/writer";

const navLinks = [
{ href: "/create", label: "Create" },
{ href: dashboardHref, label: "Dashboard" },
{ href: "/agents", label: "Agents" },
{ href: "/token", label: "$PLOT" },
];

const isActive = (href: string, label: string) => {
if (label === "Dashboard") {
return pathname.startsWith("/profile/") || pathname.startsWith("/dashboard/");
}
return pathname === href || pathname.startsWith(href + "/");
};

return (
<nav className="fixed top-0 right-0 left-0 z-50 border-b border-[var(--border)] bg-[var(--bg)]/95 backdrop-blur-sm">
Expand All @@ -40,11 +52,11 @@ export function NavBar() {

{/* Desktop nav links */}
<div className="hidden items-center gap-1 md:flex">
{NAV_LINKS.map(({ href, label }) => {
const active = pathname === href || pathname.startsWith(href + "/");
{navLinks.map(({ href, label }) => {
const active = isActive(href, label);
return (
<Link
key={href}
key={label}
href={href}
className={`rounded px-2.5 py-1 text-xs font-medium transition-colors ${
active
Expand Down Expand Up @@ -96,11 +108,11 @@ export function NavBar() {
{mobileOpen && (
<div className="border-t border-[var(--border)] bg-[var(--bg)] px-4 pb-3 pt-2 md:hidden">
<div className="flex flex-col gap-1">
{NAV_LINKS.map(({ href, label }) => {
const active = pathname === href || pathname.startsWith(href + "/");
{navLinks.map(({ href, label }) => {
const active = isActive(href, label);
return (
<Link
key={href}
key={label}
href={href}
onClick={() => setMobileOpen(false)}
className={`rounded px-2.5 py-1.5 text-xs font-medium transition-colors ${
Expand Down
197 changes: 0 additions & 197 deletions src/components/ReaderPortfolio.tsx

This file was deleted.

8 changes: 6 additions & 2 deletions src/components/__tests__/NavBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ vi.mock("../ConnectWallet", () => ({
ConnectWallet: () => <button data-testid="connect-wallet">Connect</button>,
}));

vi.mock("wagmi", () => ({
useAccount: () => ({ address: undefined, isConnected: false }),
}));

describe("NavBar", () => {
it("renders logo linking to home", () => {
render(<NavBar />);
Expand All @@ -36,7 +40,7 @@ describe("NavBar", () => {
render(<NavBar />);
const createLinks = screen.getAllByText("Create");
expect(createLinks[0].closest("a")).toHaveAttribute("href", "/create");
expect(screen.getAllByText("Writer")[0].closest("a")).toHaveAttribute("href", "/dashboard/writer");
expect(screen.getAllByText("Reader")[0].closest("a")).toHaveAttribute("href", "/dashboard/reader");
expect(screen.getAllByText("Dashboard")[0].closest("a")).toHaveAttribute("href", "/dashboard/writer");
expect(screen.getAllByText("Agents")[0].closest("a")).toHaveAttribute("href", "/agents");
});
});
Loading