4
4
getChainById ,
5
5
renderToHTML ,
6
6
stringToBlobUrl ,
7
+ TToken ,
7
8
useParams ,
8
9
useValidateCredential ,
9
10
} from "common" ;
@@ -35,6 +36,10 @@ import { useProject, useProjectApplications } from "./hooks/useProject";
35
36
import NotFoundPage from "../common/NotFoundPage" ;
36
37
import { useCartStorage } from "../../store" ;
37
38
import { CartProject } from "../api/types" ;
39
+ import InfoModal from "../common/InfoModal" ;
40
+ import { Input } from "common/src/styles" ;
41
+ import { PayoutTokenDropdown } from "../round/ViewCartPage/PayoutTokenDropdown" ;
42
+ import { useAccount } from "wagmi" ;
38
43
39
44
const CalendarIcon = ( props : React . SVGProps < SVGSVGElement > ) => {
40
45
return (
@@ -58,6 +63,8 @@ const CalendarIcon = (props: React.SVGProps<SVGSVGElement>) => {
58
63
59
64
export default function ViewProject ( ) {
60
65
const [ selectedTab , setSelectedTab ] = useState ( 0 ) ;
66
+ const { chainId } = useAccount ( ) ;
67
+ const [ showDirectAllocationModal , setShowDirectAllocationModal ] = useState < boolean > ( false ) ;
61
68
62
69
const { projectId } = useParams ( ) ;
63
70
@@ -167,6 +174,13 @@ export default function ViewProject() {
167
174
setSelectedTab ( tabIndex ) ;
168
175
} ;
169
176
177
+
178
+ // const selectedPayoutToken = getVotingTokenForChain(chainId || 1);
179
+ // const payoutTokenOptions: TToken[] = getVotingTokenOptions(
180
+ // Number(chainId)
181
+ // ).filter((p) => p.canVote);
182
+
183
+
170
184
return (
171
185
< >
172
186
{ projectData !== undefined || isProjectDataLoading ? (
@@ -191,7 +205,17 @@ export default function ViewProject() {
191
205
</ div >
192
206
</ div >
193
207
< div className = "md:flex gap-4 flex-row-reverse" >
194
- < Sidebar projectApplications = { projectApplications } />
208
+ < 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 } />
218
+ </ div >
195
219
< div className = "flex-1" >
196
220
{ projectError === undefined ? (
197
221
< >
@@ -218,6 +242,40 @@ export default function ViewProject() {
218
242
< p > Couldn't load project data.</ p >
219
243
) }
220
244
</ div >
245
+ < InfoModal
246
+ title = "Donate!"
247
+ body = {
248
+ < div className = "flex gap-4" >
249
+ < p className = "mt-4 md:mt-3 text-xs md:text-sm amount-text font-medium" >
250
+ Amount
251
+ </ p >
252
+ < Input
253
+ aria-label = { "Donation amount for all projects " }
254
+ id = { "input-donationamount" }
255
+ min = "0"
256
+ type = "number"
257
+ value = { fixedDonation ?? "" }
258
+ onChange = { ( e : React . ChangeEvent < HTMLInputElement > ) => {
259
+ setFixedDonation ( e . target . value ) ;
260
+ } }
261
+ className = "w-16 lg:w-18"
262
+ />
263
+ < PayoutTokenDropdown
264
+ selectedPayoutToken = { selectedPayoutToken }
265
+ setSelectedPayoutToken = { ( token ) => {
266
+ setVotingTokenForChain ( chainId , token ) ;
267
+ } }
268
+ payoutTokenOptions = { payoutTokenOptions }
269
+ />
270
+ </ div >
271
+ }
272
+ isOpen = { showDirectAllocationModal }
273
+ cancelButtonAction = { ( ) => setShowDirectAllocationModal ( false ) }
274
+ continueButtonAction = { ( ) => setShowDirectAllocationModal ( false ) }
275
+ // disableContinueButton={true}
276
+ continueButtonText = { "Donate" }
277
+ setIsOpen = { setShowDirectAllocationModal }
278
+ />
221
279
</ div >
222
280
</ DefaultLayout >
223
281
) : (
0 commit comments