Skip to content

Commit 264125c

Browse files
committed
switch streams url to fp api
1 parent 490c5ab commit 264125c

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

source/views/streaming/streams/list.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ import {StreamRow} from './row'
1212
import toPairs from 'lodash/toPairs'
1313
import groupBy from 'lodash/groupBy'
1414
import moment from 'moment-timezone'
15-
import qs from 'querystring'
1615
import {toLaxTitleCase as titleCase} from 'titlecase'
1716
import type {StreamType} from './types'
1817
import delay from 'delay'
18+
import {API} from '../../../globals'
1919

2020
const CENTRAL_TZ = 'America/Winnipeg'
21-
const url = 'https://www.stolaf.edu/multimedia/api/collection'
2221

2322
const styles = StyleSheet.create({
2423
listContainer: {
@@ -74,31 +73,26 @@ export class StreamListView extends React.PureComponent<Props, State> {
7473
const dateFrom = date.format('YYYY-MM-DD')
7574
const dateTo = date
7675
.clone()
77-
.add(1, 'month')
76+
.add(2, 'month')
7877
.format('YYYY-MM-DD')
7978

8079
let params = {
81-
class: 'current',
8280
sort: 'ascending',
8381
// eslint-disable-next-line camelcase
8482
date_from: dateFrom,
8583
// eslint-disable-next-line camelcase
8684
date_to: dateTo,
8785
}
8886

89-
const streamsAPI = `${url}?${qs.stringify(params)}`
90-
const data = await fetchJson(streamsAPI)
91-
const streams = data.results
87+
const data = await fetchJson(API('/streams/upcoming', params))
9288

9389
// force title-case on the stream types, to prevent not-actually-duplicate headings
94-
const processed = streams
90+
const processed = data
9591
.filter(stream => stream.category !== 'athletics')
9692
.map(stream => {
9793
const date = moment(stream.starttime, 'YYYY-MM-DD HH:mm')
9894
const group =
99-
stream.status.toLowerCase() !== 'live'
100-
? date.format('dddd, MMMM Do')
101-
: 'Live'
95+
stream.status !== 'live' ? date.format('dddd, MMMM Do') : 'Live'
10296

10397
return {
10498
...stream,

source/views/streaming/streams/row.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {ListRow, Detail, Title} from '../../components/list'
77
import {Column, Row} from '../../components/layout'
88
import {getTrimmedTextWithSpaces, parseHtml} from '../../../lib/html'
99
import {trackedOpenUrl} from '../../components/open-url'
10+
import moment from 'moment'
1011
import type {StreamType} from './types'
1112

1213
const styles = StyleSheet.create({
@@ -30,9 +31,10 @@ function Info({item}: {item: StreamType}) {
3031
}
3132

3233
function Time({item}: {item: StreamType}) {
34+
const streamDate = moment(item.date)
3335
const showTime = item.status !== 'archived'
3436
return showTime ? (
35-
<Detail>{item.date.format('h:mm A – ddd, MMM. Do, YYYY')}</Detail>
37+
<Detail>{streamDate.format('h:mm A – ddd, MMM. Do, YYYY')}</Detail>
3638
) : null
3739
}
3840

source/views/streaming/streams/types.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// @flow
2-
import type momentT from 'moment'
3-
42
export type StreamType = {
53
category: string,
64
eid: string,
@@ -15,5 +13,5 @@ export type StreamType = {
1513
subtitle: ?string,
1614
thumb: string,
1715
title: string,
18-
date: momentT,
16+
date: string,
1917
}

0 commit comments

Comments
 (0)