@@ -42,11 +42,16 @@ import { useGap } from "../api/gap";
42
42
import { StatList } from "./OSO/ImpactStats" ;
43
43
import { useOSO } from "../api/oso" ;
44
44
import { CheckIcon , ShoppingCartIcon } from "@heroicons/react/24/outline" ;
45
- import { Application , useDataLayer } from "data-layer" ;
45
+ import {
46
+ Application ,
47
+ BaseQuestion ,
48
+ Round ,
49
+ RoundApplicationQuestion ,
50
+ useDataLayer ,
51
+ } from "data-layer" ;
46
52
import { DefaultLayout } from "../common/DefaultLayout" ;
47
53
import {
48
54
mapApplicationToProject ,
49
- mapApplicationToRound ,
50
55
useApplication ,
51
56
} from "../projects/hooks/useApplication" ;
52
57
import { PassportWidget } from "../common/PassportWidget" ;
@@ -114,9 +119,9 @@ export default function ViewProjectDetails() {
114
119
} ,
115
120
dataLayer
116
121
) ;
122
+ const { round } = useRoundById ( Number ( chainId ) , roundId ) ;
117
123
118
124
const projectToRender = application && mapApplicationToProject ( application ) ;
119
- const round = application && mapApplicationToRound ( application ) ;
120
125
round && ( round . chainId = Number ( chainId ) ) ;
121
126
const isSybilDefenseEnabled =
122
127
round ?. roundMetadata ?. quadraticFundingConfig ?. sybilDefense === true ||
@@ -207,6 +212,7 @@ export default function ViewProjectDetails() {
207
212
< Detail text = { description } testID = "project-metadata" />
208
213
< ApplicationFormAnswers
209
214
answers = { projectToRender . grantApplicationFormAnswers }
215
+ round = { round }
210
216
/>
211
217
</ >
212
218
) : (
@@ -234,7 +240,7 @@ export default function ViewProjectDetails() {
234
240
) ,
235
241
} ,
236
242
] ,
237
- [ stats , grants , projectToRender , description , isLoading ]
243
+ [ stats , grants , projectToRender , description , round , impacts ]
238
244
) ;
239
245
240
246
const handleTabChange = ( tabIndex : number ) => {
@@ -460,9 +466,27 @@ function Detail(props: { text: string; testID: string }) {
460
466
461
467
function ApplicationFormAnswers ( props : {
462
468
answers : GrantApplicationFormAnswer [ ] ;
469
+ round : Round | undefined ;
463
470
} ) {
464
- // only show answers that are not empty and are not marked as hidden
465
- const answers = props . answers . filter ( ( a ) => ! ! a . answer && ! a . hidden ) ;
471
+ const roundQuestions = props . round ?. applicationQuestions as ( BaseQuestion &
472
+ RoundApplicationQuestion ) [ ] ;
473
+ if ( ! roundQuestions ) {
474
+ return null ;
475
+ }
476
+ let answers = roundQuestions
477
+ . filter ( ( q ) => ! q . hidden && ! q . encrypted )
478
+ . map ( ( q ) => ( {
479
+ ...props . answers . find (
480
+ ( a ) =>
481
+ a . questionId === q . id && a . question === q . title && a . type === q . type
482
+ ) ,
483
+ question : q . title ,
484
+ } ) )
485
+ . filter ( ( a ) : a is GrantApplicationFormAnswer => ! ! a . answer ) ;
486
+
487
+ if ( answers . length === 0 ) {
488
+ answers = props . answers . filter ( ( a ) => ! ! a . answer && ! a . hidden ) ;
489
+ }
466
490
467
491
if ( answers . length === 0 ) {
468
492
return null ;
0 commit comments