Skip to content

Commit e1d3e0c

Browse files
committed
update UI
1 parent f05cd14 commit e1d3e0c

File tree

3 files changed

+16884
-12592
lines changed

3 files changed

+16884
-12592
lines changed

packages/grant-explorer/src/features/common/GenericModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface InfoModalProps {
1111
}
1212

1313
export default function InfoModal({
14-
title = "Information Title",
14+
title = "",
1515
titleSize = "sm",
1616
isOpen = false,
1717
setIsOpen = () => {

packages/grant-explorer/src/features/projects/ViewProject.tsx

Lines changed: 76 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { ReactComponent as CartCircleIcon } from "../../assets/icons/cart-circle
2626
import { ReactComponent as CheckedCircleIcon } from "../../assets/icons/checked-circle.svg";
2727
import { ProjectBanner } from "../common/ProjectBanner";
2828
import Breadcrumb, { BreadcrumbItem } from "../common/Breadcrumb";
29-
import { Box, Skeleton, SkeletonText, Tab, Tabs } from "@chakra-ui/react";
29+
import { Box, Button, Skeleton, SkeletonText, Tab, Tabs } from "@chakra-ui/react";
3030
import {
3131
ProjectApplicationWithRoundAndProgram,
3232
useDataLayer,
@@ -37,7 +37,6 @@ import { useProject, useProjectApplications } from "./hooks/useProject";
3737
import NotFoundPage from "../common/NotFoundPage";
3838
import { useCartStorage } from "../../store";
3939
import { CartProject, ProgressStatus } from "../api/types";
40-
import InfoModal from "../common/InfoModal";
4140
import { Input } from "common/src/styles";
4241
import { PayoutTokenDropdown } from "../round/ViewCartPage/PayoutTokenDropdown";
4342
import { useAccount } from "wagmi";
@@ -47,6 +46,8 @@ import ProgressModal, { errorModalDelayMs } from "../common/ProgressModal";
4746
import { useDirectAllocation } from "./hooks/useDirectAllocation";
4847
import { getDirectAllocationPoolId } from "common/dist/allo/backends/allo-v2";
4948
import { zeroAddress } from "viem";
49+
import GenericModal from "../common/GenericModal";
50+
import { BoltIcon, EyeIcon } from "@heroicons/react/24/outline";
5051

5152
const CalendarIcon = (props: React.SVGProps<SVGSVGElement>) => {
5253
return (
@@ -255,8 +256,16 @@ export default function ViewProject() {
255256
<div className="mb-4">
256257
<Sidebar
257258
projectApplications={projectApplications}
258-
setShowDirectAllocationModal={setShowDirectAllocationModal}
259259
/>
260+
<button
261+
type="button"
262+
data-testid="direct-allocation-button"
263+
className="w-full block my-0 mx-1 bg-gitcoin-violet-100 py-2 text-center text-sm font-semibold leading-6 text-gitcoin-violet-400 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
264+
onClick={() => setShowDirectAllocationModal(true)}
265+
>
266+
<BoltIcon className="w-4 h-4 inline-block mr-1 mb-1" />
267+
Donate
268+
</button>
260269
</div>
261270
<div className="flex-1">
262271
{projectError === undefined ? (
@@ -296,42 +305,73 @@ export default function ViewProject() {
296305
function DirectDonationModals() {
297306
return (
298307
<>
299-
<InfoModal
300-
title="Donate!"
308+
<GenericModal
301309
body={
302-
<div className="flex gap-4">
303-
<p className="mt-4 md:mt-3 text-xs md:text-sm amount-text font-medium">
304-
Amount
305-
</p>
306-
<Input
307-
aria-label={"Donation amount for all projects "}
308-
id={"input-donationamount"}
309-
min="0"
310-
type="number"
311-
value={directDonationAmount}
312-
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
313-
setDirectDonationAmount(e.target.value);
314-
}}
315-
className="w-16 lg:w-18"
316-
/>
317-
<PayoutTokenDropdown
318-
selectedPayoutToken={payoutToken}
319-
setSelectedPayoutToken={(token) => {
320-
setPayoutToken(token);
310+
<>
311+
<div>
312+
<p className="mb-4">
313+
<BoltIcon className="w-4 h-4 mb-1 inline-block mr-2" />
314+
Donate now
315+
</p>
316+
</div>
317+
318+
<div className="mb-4 flex flex-col lg:flex-row justify-between sm:px-2 px-2 py-4 rounded-md">
319+
<div className="flex">
320+
<div className="flex relative overflow-hidden bg-no-repeat bg-cover mt-auto mb-auto">
321+
<img
322+
className="inline-block rounded-full w-10 my-auto mr-2"
323+
src={
324+
projectData?.project.metadata.logoImg
325+
? `${ipfsGateway}/ipfs/${projectData?.project.metadata.logoImg}`
326+
: DefaultLogoImage
327+
}
328+
alt={"Project Logo"}
329+
/>
330+
<p className="font-semibold text-md my-auto text-ellipsis line-clamp-1 max-w-[500px] 2xl:max-w-none">
331+
{projectData?.project?.metadata.title}
332+
</p>
333+
</div>
334+
</div>
335+
<div className="flex sm:space-x-4 space-x-2 h-16 sm:pl-4 pt-3 justify-center">
336+
337+
<p className="mt-4 md:mt-3 text-xs md:text-sm amount-text font-medium">
338+
Amount
339+
</p>
340+
<Input
341+
aria-label={"Donation amount for all projects "}
342+
id={"input-donationamount"}
343+
min="0"
344+
type="number"
345+
value={directDonationAmount}
346+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
347+
setDirectDonationAmount(e.target.value);
348+
}}
349+
className="w-16 lg:w-18"
350+
/>
351+
<PayoutTokenDropdown
352+
selectedPayoutToken={payoutToken}
353+
setSelectedPayoutToken={(token) => {
354+
setPayoutToken(token);
355+
}}
356+
payoutTokenOptions={payoutTokenOptions}
357+
/>
358+
</div>
359+
</div>
360+
361+
<button
362+
type="button"
363+
className="w-full font-normal bg-gitcoin-violet-400 text-white focus-visible:outline-indigo-600 py-2 leading-6"
364+
onClick={() => {
365+
setShowDirectAllocationModal(false);
366+
setOpenProgressModal(true);
367+
handleDonate();
321368
}}
322-
payoutTokenOptions={payoutTokenOptions}
323-
/>
324-
</div>
369+
>
370+
Submit your donation
371+
</button>
372+
</>
325373
}
326374
isOpen={showDirectAllocationModal}
327-
cancelButtonAction={() => setShowDirectAllocationModal(false)}
328-
continueButtonAction={() => {
329-
setShowDirectAllocationModal(false);
330-
setOpenProgressModal(true);
331-
handleDonate();
332-
}}
333-
// disableContinueButton={true}
334-
continueButtonText={"Donate"}
335375
setIsOpen={setShowDirectAllocationModal}
336376
/>
337377
<ProgressModal
@@ -565,7 +605,6 @@ function ProjectLogo({ logoImg }: { logoImg?: string }) {
565605

566606
function Sidebar(props: {
567607
projectApplications?: ProjectApplicationWithRoundAndProgram[];
568-
setShowDirectAllocationModal: React.Dispatch<React.SetStateAction<boolean>>;
569608
}) {
570609
const activeQFRoundApplications = props.projectApplications?.filter(
571610
(projectApplication) =>
@@ -579,13 +618,12 @@ function Sidebar(props: {
579618
<div className="min-w-[320px] h-fit mb-6 rounded-3xl bg-gray-50">
580619
<ProjectStats
581620
projectApplications={props.projectApplications}
582-
setShowDirectAllocationModal={props.setShowDirectAllocationModal}
583621
/>
584622
</div>
585623
{activeQFRoundApplications && activeQFRoundApplications?.length > 0 && (
586624
<h4 className="text-xl font-medium">Active rounds</h4>
587625
)}
588-
<div className="mt-4 max-w-[320px] h-fit mb-6 rounded-3xl ">
626+
<div className="mt-4 max-w-[320px] h-fit rounded-3xl ">
589627
{activeQFRoundApplications?.map((projectApplication) => (
590628
<ActiveRoundComponent
591629
key={projectApplication.id}
@@ -602,7 +640,6 @@ function Sidebar(props: {
602640

603641
export function ProjectStats(props: {
604642
projectApplications?: ProjectApplicationWithRoundAndProgram[];
605-
setShowDirectAllocationModal: React.Dispatch<React.SetStateAction<boolean>>;
606643
}) {
607644
const totalFundingReceived =
608645
props.projectApplications
@@ -646,16 +683,6 @@ export function ProjectStats(props: {
646683
rounds participated
647684
</Stat>
648685
</div>
649-
<div className="flex justify-center">
650-
<button
651-
type="button"
652-
data-testid="direct-allocation-button"
653-
className="w-[90%] block my-3 mx-1 rounded-3xl bg-indigo-600 py-2 px-3 text-center text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 disabled:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
654-
onClick={() => props.setShowDirectAllocationModal(true)}
655-
>
656-
Donate
657-
</button>
658-
</div>
659686
</div>
660687
);
661688
}

0 commit comments

Comments
 (0)