@@ -3,20 +3,12 @@ import { TableCellLocation, TableFormView } from 'mobx-lark';
33import { observer } from 'mobx-react' ;
44import { cache , compose , errorLogger } from 'next-ssr-middleware' ;
55import { FC , useContext , useMemo , useState } from 'react' ;
6- import {
7- Breadcrumb ,
8- Button ,
9- Card ,
10- Col ,
11- Container ,
12- Modal ,
13- Ratio ,
14- Row ,
15- } from 'react-bootstrap' ;
6+ import { Breadcrumb , Button , Card , Col , Container , Modal , Ratio , Row } from 'react-bootstrap' ;
167
178import { CommentBox } from '../../../../components/Activity/CommentBox' ;
189import { buildCountdownUnitLabels } from '../../../../components/Activity/Hackathon/constant' ;
1910import { HackathonHero } from '../../../../components/Activity/Hackathon/Hero' ;
11+ import { useLiveCountdownState } from '../../../../components/Activity/Hackathon/useLiveCountdownState' ;
2012import {
2113 agendaTypeLabelOf ,
2214 compactDateKeyOf ,
@@ -26,7 +18,6 @@ import {
2618 formatPeriod ,
2719 isPublicForm ,
2820 relationNameOf ,
29- resolveCountdownState ,
3021 textListOf ,
3122 userOf ,
3223} from '../../../../components/Activity/Hackathon/utility' ;
@@ -74,7 +65,6 @@ export const getServerSideProps = compose<Record<'id' | 'tid', string>>(
7465 agenda,
7566 members,
7667 products,
77- agendaReferenceTime : Date . now ( ) ,
7868 } ,
7969 } ;
8070 } ,
@@ -86,11 +76,10 @@ interface ProjectPageProps {
8676 project : Project ;
8777 members : Member [ ] ;
8878 products : Product [ ] ;
89- agendaReferenceTime : number ;
9079}
9180
9281const ProjectPage : FC < ProjectPageProps > = observer (
93- ( { activity, agenda, project, members, products, agendaReferenceTime } ) => {
82+ ( { activity, agenda, project, members, products } ) => {
9483 const { t } = useContext ( I18nContext ) ;
9584 const [ showScoreModal , setShowScoreModal ] = useState ( false ) ;
9685
@@ -116,8 +105,11 @@ const ProjectPage: FC<ProjectPageProps> = observer(
116105 } = project ;
117106 const creator = userOf ( createdBy ) ;
118107 const displayTitle = firstTextOf ( displayName ) || t ( 'projects' ) ;
119- const projectSummary =
120- compactSummaryOf ( description , firstTextOf ( activitySummary ) || displayTitle , 140 ) ;
108+ const projectSummary = compactSummaryOf (
109+ description ,
110+ firstTextOf ( activitySummary ) || displayTitle ,
111+ 140 ,
112+ ) ;
121113 const locationText = ( location as TableCellLocation | undefined ) ?. full_address || '-' ;
122114 const eventRange = formatPeriod ( startTime , endTime ) || locationText ;
123115 const groupName = relationNameOf ( group ) ;
@@ -151,9 +143,9 @@ const ProjectPage: FC<ProjectPageProps> = observer(
151143 [ forms ] ,
152144 ) ;
153145 const primaryForm =
154- ( ( forms ?. Person || [ ] ) . filter ( isPublicForm ) [ 0 ] ||
155- ( forms ?. Project || [ ] ) . filter ( isPublicForm ) [ 0 ] ||
156- publicForms [ 0 ] ) ;
146+ ( forms ?. Person || [ ] ) . filter ( isPublicForm ) [ 0 ] ||
147+ ( forms ?. Project || [ ] ) . filter ( isPublicForm ) [ 0 ] ||
148+ publicForms [ 0 ] ;
157149 const scoreForm = Object . values ( formLinkMap ?. Evaluation || { } ) [ 0 ] ;
158150 const currentRoute = [
159151 { title : activityName as string , href : ActivityModel . getLink ( activity ) } ,
@@ -165,9 +157,8 @@ const ProjectPage: FC<ProjectPageProps> = observer(
165157 { href : '#works' , label : t ( 'team_works' ) } ,
166158 { href : '#creator' , label : t ( 'created_by' ) } ,
167159 ] ;
168- const { nextItem : nextAgendaItem , countdownTo } = resolveCountdownState (
160+ const { nextItem : nextAgendaItem , countdownTo } = useLiveCountdownState (
169161 agendaItems ,
170- agendaReferenceTime ,
171162 startTime ,
172163 endTime ,
173164 ) ;
@@ -224,7 +215,7 @@ const ProjectPage: FC<ProjectPageProps> = observer(
224215 title : compactSummaryOf ( projectSummary , displayTitle , 40 ) ,
225216 description : creatorText || locationText ,
226217 } }
227- visualChip = { groupName || ( ( activityType as string ) || t ( 'projects' ) ) }
218+ visualChip = { groupName || ( activityType as string ) || t ( 'projects' ) }
228219 visualCopy = { eventRange || locationText }
229220 visualKicker = { t ( 'main_visual' ) }
230221 visualTitle = { compactSummaryOf ( projectSummary , displayTitle , 52 ) }
@@ -258,7 +249,9 @@ const ProjectPage: FC<ProjectPageProps> = observer(
258249 { groupName && < li className = { styles . metaItem } > { groupName } </ li > }
259250 { prizeText && < li className = { styles . metaItem } > { prizeText } </ li > }
260251 { rankText && < li className = { styles . metaItem } > #{ rankText } </ li > }
261- { scoreText && < li className = { styles . metaItem } > { `${ t ( 'score' ) } · ${ scoreText } ` } </ li > }
252+ { scoreText && (
253+ < li className = { styles . metaItem } > { `${ t ( 'score' ) } · ${ scoreText } ` } </ li >
254+ ) }
262255 < li className = { styles . metaItem } > { locationText } </ li >
263256 </ ul >
264257 </ article >
0 commit comments