22import * as React from 'react'
33import { Text , ScrollView , StyleSheet } from 'react-native'
44import { sendEmail } from '../../../components/send-email'
5+ import { callPhone } from '../../../components/call-phone'
56import { Cell , Section , TableView , SelectableCell } from '@frogpond/tableview'
67import moment from 'moment'
78import * as c from '@frogpond/colors'
@@ -34,18 +35,32 @@ function Information({job}: {job: JobType}) {
3435 < Cell cellStyle = "LeftDetail" detail = "Office" title = { job . office } />
3536 ) : null
3637
37- let contactName = job . contactName || job . contactEmail
38- const contact = contactName ? (
38+ const name = job . contactName
39+ const contactName = name ? (
40+ < Cell cellStyle = "LeftDetail" detail = "Contact" title = { name } />
41+ ) : null
42+
43+ const email = job . contactEmail
44+ const contactEmail = name ? (
3945 < Cell
40- accessory = { job . contactEmail ? 'DisclosureIndicator' : undefined }
46+ accessory = { email ? 'DisclosureIndicator' : undefined }
4147 cellStyle = "LeftDetail"
42- detail = "Contact "
48+ detail = "Email "
4349 onPress = { ( ) =>
44- job . contactEmail
45- ? sendEmail ( { to : [ job . contactEmail ] , subject : job . title , body : '' } )
46- : null
50+ email ? sendEmail ( { to : [ email ] , subject : job . title , body : '' } ) : null
4751 }
48- title = { contactName }
52+ title = { email }
53+ />
54+ ) : null
55+
56+ const contactNumber = job . contactPhone
57+ const contactPhone = contactNumber ? (
58+ < Cell
59+ accessory = { contactNumber ? 'DisclosureIndicator' : undefined }
60+ cellStyle = "LeftDetail"
61+ detail = "Phone"
62+ onPress = { ( ) => ( contactNumber ? callPhone ( contactNumber ) : null ) }
63+ title = { contactNumber }
4964 />
5065 ) : null
5166
@@ -66,13 +81,25 @@ function Information({job}: {job: JobType}) {
6681 < Cell cellStyle = "LeftDetail" detail = "Category" title = { job . type } />
6782 ) : null
6883
84+ const openPositions = job . openPositions ? (
85+ < Cell cellStyle = "LeftDetail" detail = "Positions" title = { job . openPositions } />
86+ ) : null
87+
88+ const year = job . year ? (
89+ < Cell cellStyle = "LeftDetail" detail = "Time Period" title = { job . year } />
90+ ) : null
91+
6992 return (
7093 < Section header = "INFORMATION" >
7194 { office }
72- { contact }
95+ { contactName }
96+ { contactEmail }
97+ { contactPhone }
7398 { hours }
7499 { amount }
100+ { year }
75101 { category }
102+ { openPositions }
76103 </ Section >
77104 )
78105}
@@ -101,6 +128,30 @@ function Comments({job}: {job: JobType}) {
101128 ) : null
102129}
103130
131+ function FirstYearAppropriate ( { job} : { job : JobType } ) {
132+ return job . goodForIncomingStudents ? (
133+ < Section header = "APPROPRIATE FOR FIRST-YEAR STUDENTS" >
134+ < SelectableCell text = { job . goodForIncomingStudents ? 'Yes' : 'No' } />
135+ </ Section >
136+ ) : null
137+ }
138+
139+ function Timeline ( { job} : { job : JobType } ) {
140+ return job . timeline ? (
141+ < Section header = "TIMELINE" >
142+ < SelectableCell text = { entities . decode ( job . timeline ) } />
143+ </ Section >
144+ ) : null
145+ }
146+
147+ function HowToApply ( { job} : { job : JobType } ) {
148+ return job . howToApply ? (
149+ < Section header = "HOW TO APPLY" >
150+ < SelectableCell text = { entities . decode ( job . howToApply ) } />
151+ </ Section >
152+ ) : null
153+ }
154+
104155function LastUpdated ( { when} : { when : string } ) {
105156 return when ? (
106157 < Text selectable = { true } style = { [ styles . footer , styles . lastUpdated ] } >
@@ -132,9 +183,12 @@ export class JobDetailView extends React.PureComponent<Props> {
132183 < Title selectable = { true } > { job . title } </ Title >
133184 < TableView >
134185 < Information job = { job } />
186+ < FirstYearAppropriate job = { job } />
135187 < Description job = { job } />
136188 < Skills job = { job } />
137189 < Comments job = { job } />
190+ < HowToApply job = { job } />
191+ < Timeline job = { job } />
138192 </ TableView >
139193 < LastUpdated when = { job . lastModified } />
140194 </ ScrollView >
0 commit comments