From 127a3465e84cd182b53c444e186598c3b8a4176c Mon Sep 17 00:00:00 2001 From: Crisgarner <@crisgarner> Date: Thu, 9 Jan 2025 13:43:48 -0600 Subject: [PATCH] feat(application-review): added card and updated review page --- .../components/ApplicationItem.tsx | 8 ++- .../components/ReviewApplicationDetails.tsx | 49 +++++++++++++++++++ .../projects/components/ProjectItem.tsx | 15 ++++-- packages/interface/src/utils/types.ts | 20 ++++++++ 4 files changed, 85 insertions(+), 7 deletions(-) diff --git a/packages/interface/src/features/applications/components/ApplicationItem.tsx b/packages/interface/src/features/applications/components/ApplicationItem.tsx index 8614edd5..96f61bf9 100644 --- a/packages/interface/src/features/applications/components/ApplicationItem.tsx +++ b/packages/interface/src/features/applications/components/ApplicationItem.tsx @@ -32,7 +32,11 @@ export const ApplicationItem = ({ const form = useFormContext(); - const { fundingSources = [], profileImageUrl } = metadata.data ?? {}; + const { profileImageUrl } = metadata.data ?? {}; + const bio = + metadata.data?.bio && metadata.data.bio.length > 140 + ? `${metadata.data.bio.substring(0, 140)}...` + : metadata.data?.bio; useEffect(() => { if (isApproved) { @@ -60,7 +64,7 @@ export const ApplicationItem = ({
-
{fundingSources.length} funding sources
+
{bio}
diff --git a/packages/interface/src/features/applications/components/ReviewApplicationDetails.tsx b/packages/interface/src/features/applications/components/ReviewApplicationDetails.tsx index d7977eaa..89adb9de 100644 --- a/packages/interface/src/features/applications/components/ReviewApplicationDetails.tsx +++ b/packages/interface/src/features/applications/components/ReviewApplicationDetails.tsx @@ -1,10 +1,12 @@ import clsx from "clsx"; import { useMemo, type ReactNode } from "react"; import { useFormContext } from "react-hook-form"; +import { Hex } from "viem"; import { Heading } from "~/components/ui/Heading"; import { Tag } from "~/components/ui/Tag"; import { impactCategories } from "~/config"; +import { ProjectItem } from "~/features/projects/components/ProjectItem"; import type { Application } from "../types"; @@ -122,6 +124,53 @@ export const ReviewApplicationDetails = (): JSX.Element => { title="Funding sources" /> + + Project Preview Card + +

This is how your project will look in the dashboard:

+ +
+ +
+ + {/*
+
+
+ + + +
+ +
+ + {application.name} + + +
+ {application.bio} +
+ + + + +
+
+
*/} ); }; diff --git a/packages/interface/src/features/projects/components/ProjectItem.tsx b/packages/interface/src/features/projects/components/ProjectItem.tsx index db4142ca..c6fd2000 100644 --- a/packages/interface/src/features/projects/components/ProjectItem.tsx +++ b/packages/interface/src/features/projects/components/ProjectItem.tsx @@ -34,6 +34,11 @@ export const ProjectItem = ({ }: IProjectItemProps): JSX.Element => { const metadata = useProjectMetadata(recipient.metadataUrl); const roundState = useRoundState({ pollId }); + const bannerImageUrl = recipient.bannerImageUrl ? recipient.bannerImageUrl : metadata.data?.bannerImageUrl; + const profileImageUrl = recipient.profileImageUrl ? recipient.profileImageUrl : metadata.data?.profileImageUrl; + const name = recipient.name ? recipient.name : metadata.data?.name; + const bio = recipient.bio ? recipient.bio : metadata.data?.bio; + const impactCategory = recipient.impactCategory ? recipient.impactCategory : metadata.data?.impactCategory; return (
- + - +
- {metadata.data?.name} + {name}
- {metadata.data?.bio} + {bio}
- + {!isLoading && state !== undefined && action && roundState === ERoundState.VOTING && ( diff --git a/packages/interface/src/utils/types.ts b/packages/interface/src/utils/types.ts index ab9a9a36..4661c100 100644 --- a/packages/interface/src/utils/types.ts +++ b/packages/interface/src/utils/types.ts @@ -241,6 +241,26 @@ export interface IRecipient { * Whether it was approved or not */ initialized?: boolean; + /** + * Banner Image Url, used only for preview of card + */ + bannerImageUrl?: string; + /** + * Profile Image Url, used only for preview of card + */ + profileImageUrl?: string; + /** + * Name of the recipient, used only for preview of card + */ + name?: string; + /** + * Bio of the recipient, used only for preview of card + */ + bio?: string; + /** + * Impact categories of the recipient, used only for preview of card + */ + impactCategory?: string[]; } /**