From d85b36fe2a2776c0a0c885a95e71cbe4a69d207d Mon Sep 17 00:00:00 2001 From: Afo Date: Sat, 21 Sep 2024 10:00:53 -0700 Subject: [PATCH] polish endorsements showing --- .../client/src/components/Layout/Profile.tsx | 26 ++++--- .../client/src/views/Profile/Endorsements.tsx | 67 ++++++++++--------- .../client/src/views/Profile/Settings.tsx | 3 +- 3 files changed, 52 insertions(+), 44 deletions(-) diff --git a/packages/client/src/components/Layout/Profile.tsx b/packages/client/src/components/Layout/Profile.tsx index 91b0752..2a16800 100644 --- a/packages/client/src/components/Layout/Profile.tsx +++ b/packages/client/src/components/Layout/Profile.tsx @@ -2,19 +2,25 @@ import Link from "next/link"; import Image from "next/image"; + import { usePathname } from "next/navigation"; interface Link { title: string; icon: string; + path: string; action?: () => void; } const links: Link[] = [ - { title: "endorsements", icon: "/icons/chat-alt.svg" }, + { + title: "endorsements", + path: "/profile/endorsements", + icon: "/icons/chat-alt.svg", + }, // { title: "metrics", icon: "/icons/flag.svg" }, // { title: "criteria", icon: "/icons/newspaper.svg" }, - { title: "settings", icon: "/icons/adjustments.svg" }, + { title: "settings", path: "/profile", icon: "/icons/adjustments.svg" }, ]; export const ProfileLayout = ({ @@ -25,7 +31,7 @@ export const ProfileLayout = ({ const pathname = usePathname(); return ( -
+

My Reef

@@ -39,13 +45,10 @@ export const ProfileLayout = ({ {links.map((link) => ( profile navigation icon -

{children}
+
+

+ {links.find((link) => pathname === link.path)?.title} +

+ {children} +
); diff --git a/packages/client/src/views/Profile/Endorsements.tsx b/packages/client/src/views/Profile/Endorsements.tsx index 6aa61cf..1198d3b 100644 --- a/packages/client/src/views/Profile/Endorsements.tsx +++ b/packages/client/src/views/Profile/Endorsements.tsx @@ -14,44 +14,45 @@ export interface ProfileEndorsementsProps { const ProfileEndorsementsView: React.FC = () => { const { address } = useAccount(); - const { data: endorsements } = useQuery({ + const { data: endorsements, status } = useQuery({ queryKey: ["endorsements", address], queryFn: () => getUserEndorsements(address), }); + if (status === "pending") { + return null; + } + return ( -
-

Endorsements

-
- {endorsements?.length ? ( -
    - {endorsements.map((endorsement) => ( -
  • -

    - {endorsement.description} -

    -
    - {endorsement.created_at} - - View Attestation - -
    -
  • - ))} -
- ) : ( -

- No endorsements made yet, go support your favorite projects! -

- )} -
+
+ {endorsements?.length ? ( +
    + {endorsements.map((endorsement) => ( +
  • +

    + {endorsement.description} +

    +
    + {endorsement.created_at} + + View Attestation + +
    +
  • + ))} +
+ ) : ( +

+ No endorsements made yet, go support your favorite projects! +

+ )}
); }; diff --git a/packages/client/src/views/Profile/Settings.tsx b/packages/client/src/views/Profile/Settings.tsx index 964b17e..3bc89fd 100644 --- a/packages/client/src/views/Profile/Settings.tsx +++ b/packages/client/src/views/Profile/Settings.tsx @@ -27,8 +27,7 @@ const ProfileSettings: React.FC = ({ user }) => { // const address = user?.address; return ( -
-

Settings

+

Wallet Address