@@ -40,6 +40,7 @@ import InfoModal from "../common/InfoModal";
40
40
import { Input } from "common/src/styles" ;
41
41
import { PayoutTokenDropdown } from "../round/ViewCartPage/PayoutTokenDropdown" ;
42
42
import { useAccount } from "wagmi" ;
43
+ import { getVotingTokenOptions } from "../api/utils" ;
43
44
44
45
const CalendarIcon = ( props : React . SVGProps < SVGSVGElement > ) => {
45
46
return (
@@ -64,7 +65,19 @@ const CalendarIcon = (props: React.SVGProps<SVGSVGElement>) => {
64
65
export default function ViewProject ( ) {
65
66
const [ selectedTab , setSelectedTab ] = useState ( 0 ) ;
66
67
const { chainId } = useAccount ( ) ;
67
- const [ showDirectAllocationModal , setShowDirectAllocationModal ] = useState < boolean > ( false ) ;
68
+ const [ showDirectAllocationModal , setShowDirectAllocationModal ] =
69
+ useState < boolean > ( false ) ;
70
+ const [ fixedDonation , setFixedDonation ] = useState < string | undefined > (
71
+ undefined
72
+ ) ;
73
+
74
+ const payoutTokenOptions : TToken [ ] = getVotingTokenOptions (
75
+ Number ( chainId )
76
+ ) . filter ( ( p ) => p . canVote ) ;
77
+
78
+ const [ payoutToken , setPayoutToken ] = useState < TToken | undefined > (
79
+ payoutTokenOptions [ 0 ]
80
+ ) ;
68
81
69
82
const { projectId } = useParams ( ) ;
70
83
@@ -174,13 +187,6 @@ export default function ViewProject() {
174
187
setSelectedTab ( tabIndex ) ;
175
188
} ;
176
189
177
-
178
- // const selectedPayoutToken = getVotingTokenForChain(chainId || 1);
179
- // const payoutTokenOptions: TToken[] = getVotingTokenOptions(
180
- // Number(chainId)
181
- // ).filter((p) => p.canVote);
182
-
183
-
184
190
return (
185
191
< >
186
192
{ projectData !== undefined || isProjectDataLoading ? (
@@ -206,15 +212,10 @@ export default function ViewProject() {
206
212
</ div >
207
213
< div className = "md:flex gap-4 flex-row-reverse" >
208
214
< div className = "mb-4" >
209
- < button
210
- type = "button"
211
- data-testid = "direct-allocation-button"
212
- className = "w-full block m-3 rounded-md 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"
213
- onClick = { ( ) => setShowDirectAllocationModal ( true ) }
214
- >
215
- Donate
216
- </ button >
217
- < Sidebar projectApplications = { projectApplications } />
215
+ < Sidebar
216
+ projectApplications = { projectApplications }
217
+ setShowDirectAllocationModal = { setShowDirectAllocationModal }
218
+ />
218
219
</ div >
219
220
< div className = "flex-1" >
220
221
{ projectError === undefined ? (
@@ -261,9 +262,9 @@ export default function ViewProject() {
261
262
className = "w-16 lg:w-18"
262
263
/>
263
264
< PayoutTokenDropdown
264
- selectedPayoutToken = { selectedPayoutToken }
265
+ selectedPayoutToken = { payoutToken }
265
266
setSelectedPayoutToken = { ( token ) => {
266
- setVotingTokenForChain ( chainId , token ) ;
267
+ setPayoutToken ( token ) ;
267
268
} }
268
269
payoutTokenOptions = { payoutTokenOptions }
269
270
/>
@@ -445,6 +446,7 @@ function ProjectLogo({ logoImg }: { logoImg?: string }) {
445
446
446
447
function Sidebar ( props : {
447
448
projectApplications ?: ProjectApplicationWithRoundAndProgram [ ] ;
449
+ setShowDirectAllocationModal : React . Dispatch < React . SetStateAction < boolean > > ;
448
450
} ) {
449
451
const activeQFRoundApplications = props . projectApplications ?. filter (
450
452
( projectApplication ) =>
@@ -456,7 +458,10 @@ function Sidebar(props: {
456
458
return (
457
459
< div className = "flex flex-col" >
458
460
< div className = "min-w-[320px] h-fit mb-6 rounded-3xl bg-gray-50" >
459
- < ProjectStats projectApplications = { props . projectApplications } />
461
+ < ProjectStats
462
+ projectApplications = { props . projectApplications }
463
+ setShowDirectAllocationModal = { props . setShowDirectAllocationModal }
464
+ />
460
465
</ div >
461
466
{ activeQFRoundApplications && activeQFRoundApplications ?. length > 0 && (
462
467
< h4 className = "text-xl font-medium" > Active rounds</ h4 >
@@ -478,6 +483,7 @@ function Sidebar(props: {
478
483
479
484
export function ProjectStats ( props : {
480
485
projectApplications ?: ProjectApplicationWithRoundAndProgram [ ] ;
486
+ setShowDirectAllocationModal : React . Dispatch < React . SetStateAction < boolean > > ;
481
487
} ) {
482
488
const totalFundingReceived =
483
489
props . projectApplications
@@ -505,20 +511,32 @@ export function ProjectStats(props: {
505
511
const totalRoundsParticipated = props . projectApplications ?. length ?? 0 ;
506
512
507
513
return (
508
- < div className = "rounded-3xl flex-auto p-3 md:p-4 gap-4 flex flex-col text-blue-800" >
509
- < h4 className = "text-2xl" > All-time stats</ h4 >
510
- < Stat isLoading = { false } value = { `$${ totalFundingReceived } ` } >
511
- funding received
512
- </ Stat >
513
- < Stat isLoading = { false } value = { totalContributions } >
514
- contributions
515
- </ Stat >
516
- < Stat isLoading = { false } value = { totalUniqueDonors } >
517
- unique contributors
518
- </ Stat >
519
- < Stat isLoading = { false } value = { totalRoundsParticipated } >
520
- rounds participated
521
- </ Stat >
514
+ < div className = "flex flex-col" >
515
+ < div className = "rounded-3xl flex-auto p-3 md:p-4 gap-4 flex flex-col text-blue-800" >
516
+ < h4 className = "text-2xl" > All-time stats</ h4 >
517
+ < Stat isLoading = { false } value = { `$${ totalFundingReceived } ` } >
518
+ funding received
519
+ </ Stat >
520
+ < Stat isLoading = { false } value = { totalContributions } >
521
+ contributions
522
+ </ Stat >
523
+ < Stat isLoading = { false } value = { totalUniqueDonors } >
524
+ unique contributors
525
+ </ Stat >
526
+ < Stat isLoading = { false } value = { totalRoundsParticipated } >
527
+ rounds participated
528
+ </ Stat >
529
+ </ div >
530
+ < div className = "flex justify-center" >
531
+ < button
532
+ type = "button"
533
+ data-testid = "direct-allocation-button"
534
+ 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"
535
+ onClick = { ( ) => props . setShowDirectAllocationModal ( true ) }
536
+ >
537
+ Donate
538
+ </ button >
539
+ </ div >
522
540
</ div >
523
541
) ;
524
542
}
0 commit comments