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'
@@ -29,26 +30,51 @@ const Title = glamorous.text({
2930 marginVertical : 10 ,
3031} )
3132
32- function Information ( { job} : { job : JobType } ) {
33+ function ContactInformation ( { job} : { job : JobType } ) {
3334 const office = job . office ? (
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
67+ return (
68+ < Section header = "CONTACT INFORMATION" >
69+ { office }
70+ { contactName }
71+ { contactEmail }
72+ { contactPhone }
73+ </ Section >
74+ )
75+ }
76+
77+ function JobInformation ( { job} : { job : JobType } ) {
5278 const ending = job . hoursPerWeek === 'Full-time' ? '' : ' hrs/week'
5379 const hours = job . hoursPerWeek ? (
5480 < Cell
@@ -66,13 +92,21 @@ function Information({job}: {job: JobType}) {
6692 < Cell cellStyle = "LeftDetail" detail = "Category" title = { job . type } />
6793 ) : null
6894
95+ const openPositions = job . openPositions ? (
96+ < Cell cellStyle = "LeftDetail" detail = "Positions" title = { job . openPositions } />
97+ ) : null
98+
99+ const year = job . year ? (
100+ < Cell cellStyle = "LeftDetail" detail = "Time Period" title = { job . year } />
101+ ) : null
102+
69103 return (
70- < Section header = "INFORMATION" >
71- { office }
72- { contact }
104+ < Section header = "JOB INFORMATION" >
73105 { hours }
74106 { amount }
107+ { year }
75108 { category }
109+ { openPositions }
76110 </ Section >
77111 )
78112}
@@ -101,6 +135,30 @@ function Comments({job}: {job: JobType}) {
101135 ) : null
102136}
103137
138+ function FirstYearAppropriate ( { job} : { job : JobType } ) {
139+ return job . goodForIncomingStudents ? (
140+ < Section header = "APPROPRIATE FOR FIRST-YEAR STUDENTS" >
141+ < SelectableCell text = { job . goodForIncomingStudents ? 'Yes' : 'No' } />
142+ </ Section >
143+ ) : null
144+ }
145+
146+ function Timeline ( { job} : { job : JobType } ) {
147+ return job . timeline ? (
148+ < Section header = "TIMELINE" >
149+ < SelectableCell text = { entities . decode ( job . timeline ) } />
150+ </ Section >
151+ ) : null
152+ }
153+
154+ function HowToApply ( { job} : { job : JobType } ) {
155+ return job . howToApply ? (
156+ < Section header = "HOW TO APPLY" >
157+ < SelectableCell text = { entities . decode ( job . howToApply ) } />
158+ </ Section >
159+ ) : null
160+ }
161+
104162function LastUpdated ( { when} : { when : string } ) {
105163 return when ? (
106164 < Text selectable = { true } style = { [ styles . footer , styles . lastUpdated ] } >
@@ -131,10 +189,14 @@ export class JobDetailView extends React.PureComponent<Props> {
131189 < ScrollView >
132190 < Title selectable = { true } > { job . title } </ Title >
133191 < TableView >
134- < Information job = { job } />
192+ < ContactInformation job = { job } />
193+ < JobInformation job = { job } />
194+ < FirstYearAppropriate job = { job } />
135195 < Description job = { job } />
136196 < Skills job = { job } />
137197 < Comments job = { job } />
198+ < HowToApply job = { job } />
199+ < Timeline job = { job } />
138200 </ TableView >
139201 < LastUpdated when = { job . lastModified } />
140202 </ ScrollView >
0 commit comments