From b0d635bd6db85f138a2565e5fe77b3818c305296 Mon Sep 17 00:00:00 2001 From: Fabio Arazaki Date: Tue, 10 Dec 2024 00:03:09 -0300 Subject: [PATCH 1/2] feat: page switcher --- src/components/nav-element/PageSwitcher.tsx | 33 +++++++++++++++++++++ src/components/trades/Trades.tsx | 8 +++-- src/views/home/index.tsx | 2 ++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 src/components/nav-element/PageSwitcher.tsx 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/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

From 63fe074276041322995bb4ccc7e8db521cb1121a Mon Sep 17 00:00:00 2001 From: Fabio Arazaki Date: Tue, 10 Dec 2024 00:03:24 -0300 Subject: [PATCH 2/2] fix: replaced view wallet url --- src/pages/trades.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 = () => {