22import * as React from 'react'
33import { Text , View , ScrollView , StyleSheet } from 'react-native'
44import { sendEmail } from '../../../components/send-email'
5+ import { callPhone } from '../../../components/call-phone'
56import { Card } from '../../../components/card'
67import moment from 'moment'
78import { openUrl } from '@frogpond/open-url'
@@ -59,22 +60,37 @@ function Title({job}: {job: JobType}) {
5960}
6061
6162function Contact ( { job} : { job : JobType } ) {
62- let contactName = job . contactName || job . contactEmail
63+ const contactName = job . contactName
64+ const contactEmail = job . contactEmail
65+ const contactNumber = job . contactPhone
6366
6467 return job . office || contactName ? (
6568 < Card header = "Contact" style = { styles . card } >
66- < Text
67- onPress = { ( ) =>
68- job . contactEmail
69- ? sendEmail ( { to : [ job . contactEmail ] , subject : job . title , body : '' } )
70- : null
71- }
72- style = { styles . cardBody }
73- >
74- { contactName } { job . title ? `(${ job . title } )` : '' }
75- { '\n' }
76- { job . office }
77- </ Text >
69+ < Text style = { styles . cardBody } > { contactName } </ Text >
70+
71+ { contactEmail ? (
72+ < Text
73+ onPress = { ( ) =>
74+ job . contactEmail
75+ ? sendEmail ( { to : [ contactEmail ] , subject : job . title , body : '' } )
76+ : null
77+ }
78+ style = { styles . cardBody }
79+ >
80+ { contactEmail }
81+ </ Text >
82+ ) : null }
83+
84+ { contactNumber ? (
85+ < Text
86+ onPress = { ( ) => ( job . contactPhone ? callPhone ( contactNumber ) : null ) }
87+ style = { styles . cardBody }
88+ >
89+ { contactNumber }
90+ </ Text >
91+ ) : null }
92+
93+ { job . office ? < Text style = { styles . cardBody } > { job . office } </ Text > : null }
7894 </ Card >
7995 ) : null
8096}
@@ -92,6 +108,20 @@ function Hours({job}: {job: JobType}) {
92108 ) : null
93109}
94110
111+ function GeneralInfo ( { job} : { job : JobType } ) {
112+ return job . year || job . openPositions ? (
113+ < Card header = "General" style = { styles . card } >
114+ < Text style = { styles . cardBody } >
115+ { job . year ? `${ job . year } \n\n` : null }
116+ { job . openPositions ? `Positions: ${ job . openPositions } \n\n` : null }
117+ { job . goodForIncomingStudents
118+ ? 'Appropriate for First Year Students'
119+ : 'Not Appropriate for First Year Students' }
120+ </ Text >
121+ </ Card >
122+ ) : null
123+ }
124+
95125function Description ( { job} : { job : JobType } ) {
96126 return job . description ? (
97127 < Card header = "Description" style = { styles . card } >
@@ -116,6 +146,22 @@ function Comments({job}: {job: JobType}) {
116146 ) : null
117147}
118148
149+ function HowToApply ( { job} : { job : JobType } ) {
150+ return job . howToApply ? (
151+ < Card header = "How To Apply" style = { styles . card } >
152+ < Text style = { styles . cardBody } > { job . howToApply } </ Text >
153+ </ Card >
154+ ) : null
155+ }
156+
157+ function Timeline ( { job} : { job : JobType } ) {
158+ return job . timeline ? (
159+ < Card header = "Timeline" style = { styles . card } >
160+ < Text style = { styles . cardBody } > { job . timeline } </ Text >
161+ </ Card >
162+ ) : null
163+ }
164+
119165function Links ( { job} : { job : JobType } ) {
120166 const { links} = job
121167 return links . length ? (
@@ -159,10 +205,13 @@ export class JobDetailView extends React.PureComponent<Props> {
159205 < ScrollView >
160206 < Title job = { job } />
161207 < Contact job = { job } />
208+ < GeneralInfo job = { job } />
162209 < Hours job = { job } />
163210 < Description job = { job } />
164211 < Skills job = { job } />
165212 < Comments job = { job } />
213+ < Timeline job = { job } />
214+ < HowToApply job = { job } />
166215 < Links job = { job } />
167216 < LastUpdated when = { job . lastModified } />
168217 </ ScrollView >
0 commit comments