From a35300c4972cf0d2a9b1aa07163723fe63c0526d Mon Sep 17 00:00:00 2001 From: eagle Date: Tue, 18 Jun 2024 19:22:15 +0530 Subject: [PATCH] feat: move CardSkeleton --- .../features/common/ApplicationCard.test.tsx | 3 +- .../src/features/common/ApplicationCard.tsx | 41 +------------------ .../src/features/common/ProjectBanner.tsx | 37 +++++++++++++++++ .../discovery/PaginatedApplicationsList.tsx | 3 +- .../src/features/round/ViewRoundPage.tsx | 3 +- 5 files changed, 43 insertions(+), 44 deletions(-) diff --git a/packages/grant-explorer/src/features/common/ApplicationCard.test.tsx b/packages/grant-explorer/src/features/common/ApplicationCard.test.tsx index 630538debb..ea4aa08167 100644 --- a/packages/grant-explorer/src/features/common/ApplicationCard.test.tsx +++ b/packages/grant-explorer/src/features/common/ApplicationCard.test.tsx @@ -1,9 +1,10 @@ import { vi } from "vitest"; import { render, fireEvent, screen } from "@testing-library/react"; -import { ApplicationCard, CardSkeleton } from "./ApplicationCard"; +import { ApplicationCard } from "./ApplicationCard"; import { ApplicationSummary } from "data-layer"; import { zeroAddress } from "viem"; import { ChakraProvider } from "@chakra-ui/react"; +import { CardSkeleton } from "./ProjectBanner"; vi.mock("common/src/config", async () => { return { diff --git a/packages/grant-explorer/src/features/common/ApplicationCard.tsx b/packages/grant-explorer/src/features/common/ApplicationCard.tsx index 8304441e8f..1624b916bb 100644 --- a/packages/grant-explorer/src/features/common/ApplicationCard.tsx +++ b/packages/grant-explorer/src/features/common/ApplicationCard.tsx @@ -1,4 +1,3 @@ -import { Skeleton, SkeletonCircle, SkeletonText } from "@chakra-ui/react"; import { ReactComponent as CartCircleIcon } from "../../assets/icons/cart-circle.svg"; import { ReactComponent as CheckedCircleIcon } from "../../assets/icons/checked-circle.svg"; import { ApplicationSummary } from "data-layer"; @@ -10,47 +9,9 @@ import { CardHeader, } from "./styles"; import { applicationPath } from "common/src/routes/explorer"; -import { ProjectBanner } from "./ProjectBanner"; -import { createIpfsImageUrl } from "common/src/ipfs"; -import { getConfig } from "common/src/config"; +import { ProjectBanner, ProjectLogo } from "./ProjectBanner"; import { usePostHog } from "posthog-js/react"; -export function ProjectLogo(props: { - className?: string; - imageCid: string; - size: number; -}): JSX.Element { - const { - ipfs: { baseUrl: ipfsBaseUrl }, - } = getConfig(); - - const projectLogoImageUrl = createIpfsImageUrl({ - baseUrl: ipfsBaseUrl, - cid: props.imageCid, - height: props.size * 2, - }); - - return ( - Project Banner - ); -} - -export function CardSkeleton(): JSX.Element { - return ( -
- - - - -
- ); -} - export function ApplicationCard(props: { application: ApplicationSummary; inCart: boolean; diff --git a/packages/grant-explorer/src/features/common/ProjectBanner.tsx b/packages/grant-explorer/src/features/common/ProjectBanner.tsx index 180d68bf59..4667beb4be 100644 --- a/packages/grant-explorer/src/features/common/ProjectBanner.tsx +++ b/packages/grant-explorer/src/features/common/ProjectBanner.tsx @@ -1,3 +1,4 @@ +import { Skeleton, SkeletonCircle, SkeletonText } from "@chakra-ui/react"; import DefaultBannerImage from "../../assets/default_banner.jpg"; import { createIpfsImageUrl } from "common/src/ipfs"; import { getConfig } from "common/src/config"; @@ -31,3 +32,39 @@ export function ProjectBanner(props: { ); } + +export function ProjectLogo(props: { + className?: string; + imageCid: string; + size: number; +}): JSX.Element { + const { + ipfs: { baseUrl: ipfsBaseUrl }, + } = getConfig(); + + const projectLogoImageUrl = createIpfsImageUrl({ + baseUrl: ipfsBaseUrl, + cid: props.imageCid, + height: props.size * 2, + }); + + return ( + Project Banner + ); +} + +export function CardSkeleton(): JSX.Element { + return ( +
+ + + + +
+ ); +} diff --git a/packages/grant-explorer/src/features/discovery/PaginatedApplicationsList.tsx b/packages/grant-explorer/src/features/discovery/PaginatedApplicationsList.tsx index d8c789131f..dbbf2be2a7 100644 --- a/packages/grant-explorer/src/features/discovery/PaginatedApplicationsList.tsx +++ b/packages/grant-explorer/src/features/discovery/PaginatedApplicationsList.tsx @@ -1,8 +1,9 @@ import PlusIcon from "@heroicons/react/20/solid/PlusIcon"; import { LoadingRing } from "../common/Spinner"; -import { ApplicationCard, CardSkeleton } from "../common/ApplicationCard"; +import { ApplicationCard } from "../common/ApplicationCard"; import { ApplicationSummary } from "data-layer"; import { usePostHog } from "posthog-js/react"; +import { CardSkeleton } from "../common/ProjectBanner"; interface PaginatedApplicationsListProps { applications: ApplicationSummary[]; diff --git a/packages/grant-explorer/src/features/round/ViewRoundPage.tsx b/packages/grant-explorer/src/features/round/ViewRoundPage.tsx index ba52befa5d..91c7284f5f 100644 --- a/packages/grant-explorer/src/features/round/ViewRoundPage.tsx +++ b/packages/grant-explorer/src/features/round/ViewRoundPage.tsx @@ -36,7 +36,7 @@ import { getDaysLeft, isDirectRound, isInfiniteDate } from "../api/utils"; import { PassportWidget } from "../common/PassportWidget"; import NotFoundPage from "../common/NotFoundPage"; -import { ProjectBanner } from "../common/ProjectBanner"; +import { ProjectBanner, ProjectLogo } from "../common/ProjectBanner"; import RoundEndedBanner from "../common/RoundEndedBanner"; import { Spinner } from "../common/Spinner"; import { @@ -59,7 +59,6 @@ import { getAlloVersion } from "common/src/config"; import { ExclamationCircleIcon } from "@heroicons/react/24/solid"; import { DefaultLayout } from "../common/DefaultLayout"; import { getUnixTime } from "date-fns"; -import { ProjectLogo } from "../common/ApplicationCard"; import { Application, useDataLayer } from "data-layer"; import { useRoundApprovedApplications } from "../projects/hooks/useRoundApplications"; import {