From 99ec94dcf953a1856df2ffeba7521c202f9b1828 Mon Sep 17 00:00:00 2001 From: Dominik Stumpf Date: Wed, 10 Jul 2024 21:34:12 +0200 Subject: [PATCH] chore: pull UserGuildPins --- .../Notifications/Notifications.tsx | 24 ++--- .../components/UsersGuildPins.tsx | 99 +++++++++++++++++++ 2 files changed, 111 insertions(+), 12 deletions(-) create mode 100644 src/v2/components/Account/components/AccountModal/components/UsersGuildPins.tsx diff --git a/src/components/common/Layout/components/Account/components/Notifications/Notifications.tsx b/src/components/common/Layout/components/Account/components/Notifications/Notifications.tsx index beb0f5ca4a..977ce3b20d 100644 --- a/src/components/common/Layout/components/Account/components/Notifications/Notifications.tsx +++ b/src/components/common/Layout/components/Account/components/Notifications/Notifications.tsx @@ -1,5 +1,6 @@ import { usePostHogContext } from "@/components/Providers/PostHogProvider" import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager" +import { Button } from "@/components/ui/Button" import { Divider, Icon, @@ -16,7 +17,6 @@ import { ActivityLogProvider } from "components/[guild]/activity/ActivityLogCont import useUser from "components/[guild]/hooks/useUser" import useLocalStorage from "hooks/useLocalStorage" import dynamic from "next/dynamic" -import AccountButton from "../AccountButton" import WebInboxSkeleton from "../Web3Inbox/WebInboxSkeleton" import NotificationsActivityLog from "./components/NotificationsActivityLog" import NotificationsSection from "./components/NotificationsSection" @@ -51,22 +51,22 @@ const Notifications = () => { {({ isOpen }) => ( <> - { setClickedOnNotifications(true) if (isOpen) return captureEvent("opened UserActivityLogPopover") }} - sx={{ - "@keyframes notification": { - "0%": { transform: "rotate(0deg)" }, - "2.5%": { transform: "rotate(15deg)" }, - "5%": { transform: "rotate(-15deg)" }, - "7.5": { transform: "rotate(15deg)" }, - "10%": { transform: "rotate(0deg)" }, - }, - }} + // sx={{ + // "@keyframes notification": { + // "0%": { transform: "rotate(0deg)" }, + // "2.5%": { transform: "rotate(15deg)" }, + // "5%": { transform: "rotate(-15deg)" }, + // "7.5": { transform: "rotate(15deg)" }, + // "10%": { transform: "rotate(0deg)" }, + // }, + // }} > { : "notification 4s ease-in-out infinite" } /> - + { + const isAccountModalOpen = useAtomValue(accountModalAtom) + const { data, error, isValidating } = useUsersGuildPins(!isAccountModalOpen) + + return ( + <> + + + {error && ( + + + + There was an error while fetching your pins, some may not be visible. + + + )} + +
+
+ {isValidating ? ( + [...Array(3)].map((_, i) => ) + ) : data?.length ? ( + data.map((pin) => ( + attribute.trait_type === "guildId") + .value.toString()} + rank={pin.attributes + .find((attribute) => attribute.trait_type === "rank") + .value.toString()} + /> + )) + ) : ( +

You haven't minted any Guild Pins yet

+ )} +
+
+ + ) +} + +const GuildPin = ({ + name, + image, + guild, + rank, +}: { + name: string + image: string + guild: string + rank: string +}) => { + const setIsAccountModalOpen = useSetAtom(accountModalAtom) + + return ( + setIsAccountModalOpen(false)} + className="peer -ml-10 transition-transform first:ml-0 hover:scale-105 peer-hover:translate-x-8" + > +
+ {name} + +
+ + #{rank} + +
+
+ + ) +} + +const GuildPinSkeleton = () => ( +
+ +
+) + +export { UsersGuildPins }