diff --git a/src/components/nav-element/PageSwitcher.tsx b/src/components/nav-element/PageSwitcher.tsx new file mode 100644 index 0000000..f99d4c4 --- /dev/null +++ b/src/components/nav-element/PageSwitcher.tsx @@ -0,0 +1,33 @@ +import Link from "next/link" +import { usePathname } from "next/navigation" + +const navItems = [ + { href: "/", label: "Leaderboard" }, + { href: "/trades", label: "Trades" }, +] + +export default function PageSwitcher({ className }: { className?: string }) { + const pathname = usePathname() + + return ( +
+
+ {navItems.map((item) => ( + + + {item.label} + + + ))} +
+
+ ) +} diff --git a/src/components/trades/Trades.tsx b/src/components/trades/Trades.tsx index 31356d9..b1df541 100644 --- a/src/components/trades/Trades.tsx +++ b/src/components/trades/Trades.tsx @@ -2,7 +2,8 @@ import { Suspense, useMemo, type FC } from "react" import Image from "next/image" import { AvatarWithFallback } from "../leaderboard/AvatarImage" import { TTrade, useGetTrades } from "@/services/useTrades" - +import { format } from "date-fns" +import PageSwitcher from "../nav-element/PageSwitcher" const TradeRow: FC<{ trade: TTrade }> = ({ trade }) => { const buyTransaction = trade.transactions.find( (transaction) => transaction.type === "buy" @@ -30,7 +31,9 @@ const TradeRow: FC<{ trade: TTrade }> = ({ trade }) => {
{trade.tokenName} - Swapped + + Swapped at {format(new Date(trade.createdAt), "h:mm a")} +
@@ -126,6 +129,7 @@ const Trades: FC = () => { return ( Loading...
}>
+

Marc's Trades

diff --git a/src/pages/trades.tsx b/src/pages/trades.tsx index 963057d..009422c 100644 --- a/src/pages/trades.tsx +++ b/src/pages/trades.tsx @@ -17,7 +17,7 @@ const TradesPage: NextPage = () => { diff --git a/src/views/home/index.tsx b/src/views/home/index.tsx index 43cb5c4..81ed829 100644 --- a/src/views/home/index.tsx +++ b/src/views/home/index.tsx @@ -4,6 +4,7 @@ import LeaderboardTotals from "../../components/leaderboard/LeaderboardTotals" import LeaderboardMedals from "../../components/leaderboard/LeaderboardMedals" import LeaderboardPartners from "../../components/leaderboard/LeaderboardPartners" import { useGetUsers } from "@/services/useUsers" +import PageSwitcher from "@/components/nav-element/PageSwitcher" export const HomeView: FC = () => { const { users, isLoading: isLoadingUsers } = useGetUsers({ @@ -20,6 +21,7 @@ export const HomeView: FC = () => { return (
+

Marc’s Trust Leaderboard