@@ -41,9 +41,19 @@ export const getServerSideProps = compose<Record<'id' | 'tid', string>>(
4141 cache ( ) ,
4242 errorLogger ,
4343 async ( { params } ) => {
44+ if ( ! params ?. id || ! params ?. tid ) return { notFound : true , props : { } } ;
45+
4446 const activity = await new ActivityModel ( ) . getOne ( params ! . id ) ;
47+ const { appId, tableIdMap } = activity . databaseSchema || { } ;
4548
46- const { appId, tableIdMap } = activity . databaseSchema ;
49+ if (
50+ ! appId ||
51+ ! tableIdMap ?. Project ||
52+ ! tableIdMap ?. Agenda ||
53+ ! tableIdMap ?. Member ||
54+ ! tableIdMap ?. Product
55+ )
56+ return { notFound : true , props : { } } ;
4757
4858 const project = await new ProjectModel ( appId , tableIdMap . Project ) . getOne ( params ! . tid ) ;
4959
@@ -93,7 +103,7 @@ const ProjectPage: FC<ProjectPageProps> = observer(
93103 summary : activitySummary ,
94104 type : activityType ,
95105 } = activity ;
96- const { forms, formLinkMap } = databaseSchema ;
106+ const { forms } = databaseSchema ;
97107 const {
98108 name : displayName ,
99109 summary : description ,
@@ -105,8 +115,9 @@ const ProjectPage: FC<ProjectPageProps> = observer(
105115 } = project ;
106116 const creator = userOf ( createdBy ) ;
107117 const displayTitle = firstTextOf ( displayName ) || t ( 'projects' ) ;
118+ const projectDescription = textListOf ( description ) . join ( ' · ' ) ;
108119 const projectSummary = compactSummaryOf (
109- description ,
120+ projectDescription ,
110121 firstTextOf ( activitySummary ) || displayTitle ,
111122 140 ,
112123 ) ;
@@ -146,7 +157,7 @@ const ProjectPage: FC<ProjectPageProps> = observer(
146157 ( forms ?. Person || [ ] ) . filter ( isPublicForm ) [ 0 ] ||
147158 ( forms ?. Project || [ ] ) . filter ( isPublicForm ) [ 0 ] ||
148159 publicForms [ 0 ] ;
149- const scoreForm = Object . values ( formLinkMap ?. Evaluation || { } ) [ 0 ] ;
160+ const scoreForm = ( forms ?. Evaluation || [ ] ) . find ( isPublicForm ) ;
150161 const currentRoute = [
151162 { title : activityName as string , href : ActivityModel . getLink ( activity ) } ,
152163 { title : displayTitle } ,
@@ -172,7 +183,7 @@ const ProjectPage: FC<ProjectPageProps> = observer(
172183 rankText ? `#${ rankText } ` : '' ,
173184 scoreText ? `${ t ( 'score' ) } · ${ scoreText } ` : '' ,
174185 ] . filter ( Boolean ) ;
175- const creatorText = [ creator ?. name , creator ?. email ] . filter ( Boolean ) . join ( ' · ' ) ;
186+ const creatorText = creator ?. name || '' ;
176187 const heroPrimaryAction = primaryForm
177188 ? {
178189 label : t ( 'hackathon_register_now' ) ,
@@ -378,9 +389,9 @@ const ProjectPage: FC<ProjectPageProps> = observer(
378389 < article className = { styles . creatorCard } >
379390 < span className = { styles . creatorLabel } > { t ( 'created_by' ) } </ span >
380391 < h3 className = { styles . creatorValue } > { creator ?. name || '-' } </ h3 >
381- < p className = { styles . creatorText } > { creator ?. email || locationText } </ p >
392+ < p className = { styles . creatorText } > { locationText } </ p >
382393
383- { scoreText && scoreForm && (
394+ { scoreForm && (
384395 < Button className = { styles . scoreButton } onClick = { ( ) => setShowScoreModal ( true ) } >
385396 { t ( 'score' ) }
386397 </ Button >
@@ -407,7 +418,11 @@ const ProjectPage: FC<ProjectPageProps> = observer(
407418 </ Modal . Header >
408419 < Modal . Body >
409420 < Ratio aspectRatio = "16x9" >
410- < iframe className = "w-100 h-100 border-0" title = { t ( 'score' ) } src = { scoreForm } />
421+ < iframe
422+ className = "w-100 h-100 border-0"
423+ title = { t ( 'score' ) }
424+ src = { scoreForm ?. shared_url }
425+ />
411426 </ Ratio >
412427 </ Modal . Body >
413428 </ Modal >
0 commit comments