Skip to content

Commit 088628c

Browse files
authored
Merge pull request #3016 from StoDevX/student-work-field-updates
Student work field updates
2 parents 5526b90 + 5006d0e commit 088628c

File tree

3 files changed

+152
-35
lines changed

3 files changed

+152
-35
lines changed

source/views/sis/student-work/detail.android.js

Lines changed: 70 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import * as React from 'react'
33
import {Text, View, ScrollView, StyleSheet} from 'react-native'
44
import {sendEmail} from '../../../components/send-email'
5+
import {callPhone} from '../../../components/call-phone'
56
import {Card} from '../../../components/card'
67
import moment from 'moment'
78
import {openUrl} from '@frogpond/open-url'
@@ -58,23 +59,41 @@ function Title({job}: {job: JobType}) {
5859
) : null
5960
}
6061

61-
function Contact({job}: {job: JobType}) {
62-
let contactName = job.contactName || job.contactEmail
63-
64-
return job.office || contactName ? (
65-
<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>
62+
function ContactInformation({job}: {job: JobType}) {
63+
const contactName = job.contactName
64+
const contactEmail = job.contactEmail
65+
const contactNumber = job.contactPhone
66+
const contactOffice = job.office
67+
68+
return contactName || contactEmail || contactNumber || contactOffice ? (
69+
<Card header="Contact Information" style={styles.card}>
70+
<Text style={styles.cardBody}>{contactName}</Text>
71+
72+
{contactEmail ? (
73+
<Text
74+
onPress={() =>
75+
job.contactEmail
76+
? sendEmail({to: [contactEmail], subject: job.title, body: ''})
77+
: null
78+
}
79+
style={styles.cardBody}
80+
>
81+
{contactEmail}
82+
</Text>
83+
) : null}
84+
85+
{contactNumber ? (
86+
<Text
87+
onPress={() => (job.contactPhone ? callPhone(contactNumber) : null)}
88+
style={styles.cardBody}
89+
>
90+
{contactNumber}
91+
</Text>
92+
) : null}
93+
94+
{contactOffice ? (
95+
<Text style={styles.cardBody}>{contactOffice}</Text>
96+
) : null}
7897
</Card>
7998
) : null
8099
}
@@ -92,6 +111,20 @@ function Hours({job}: {job: JobType}) {
92111
) : null
93112
}
94113

114+
function JobInformation({job}: {job: JobType}) {
115+
return job.year || job.openPositions ? (
116+
<Card header="Job Information" style={styles.card}>
117+
<Text style={styles.cardBody}>
118+
{job.year ? `${job.year}\n\n` : null}
119+
{job.openPositions ? `Positions: ${job.openPositions}\n\n` : null}
120+
{job.goodForIncomingStudents
121+
? 'Appropriate for First Year Students'
122+
: 'Not Appropriate for First Year Students'}
123+
</Text>
124+
</Card>
125+
) : null
126+
}
127+
95128
function Description({job}: {job: JobType}) {
96129
return job.description ? (
97130
<Card header="Description" style={styles.card}>
@@ -116,6 +149,22 @@ function Comments({job}: {job: JobType}) {
116149
) : null
117150
}
118151

152+
function HowToApply({job}: {job: JobType}) {
153+
return job.howToApply ? (
154+
<Card header="How To Apply" style={styles.card}>
155+
<Text style={styles.cardBody}>{job.howToApply}</Text>
156+
</Card>
157+
) : null
158+
}
159+
160+
function Timeline({job}: {job: JobType}) {
161+
return job.timeline ? (
162+
<Card header="Timeline" style={styles.card}>
163+
<Text style={styles.cardBody}>{job.timeline}</Text>
164+
</Card>
165+
) : null
166+
}
167+
119168
function Links({job}: {job: JobType}) {
120169
const {links} = job
121170
return links.length ? (
@@ -158,11 +207,14 @@ export class JobDetailView extends React.PureComponent<Props> {
158207
return (
159208
<ScrollView>
160209
<Title job={job} />
161-
<Contact job={job} />
210+
<ContactInformation job={job} />
211+
<JobInformation job={job} />
162212
<Hours job={job} />
163213
<Description job={job} />
164214
<Skills job={job} />
165215
<Comments job={job} />
216+
<Timeline job={job} />
217+
<HowToApply job={job} />
166218
<Links job={job} />
167219
<LastUpdated when={job.lastModified} />
168220
</ScrollView>

source/views/sis/student-work/detail.ios.js

Lines changed: 75 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import * as React from 'react'
33
import {Text, ScrollView, StyleSheet} from 'react-native'
44
import {sendEmail} from '../../../components/send-email'
5+
import {callPhone} from '../../../components/call-phone'
56
import {Cell, Section, TableView, SelectableCell} from '@frogpond/tableview'
67
import moment from 'moment'
78
import * 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+
104162
function 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>
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
// @flow
22

33
export type JobType = {
4-
id: number,
54
comments: string,
65
contactEmail: string,
7-
contactFirstName: string,
8-
contactLastName: string,
96
contactName: string,
10-
contactPhone: number,
7+
contactPhone: string,
118
description: string,
9+
goodForIncomingStudents: boolean,
1210
hoursPerWeek: string,
11+
howToApply: string,
12+
id: number,
1313
lastModified: string,
1414
links: Array<string>,
1515
office: string,
16+
openPositions: string,
1617
skills: string,
18+
timeline: string,
1719
timeOfHours: string | number,
1820
title: string,
1921
type: string,
22+
year: string,
2023
}

0 commit comments

Comments
 (0)