Skip to content

Commit 7f6e3a0

Browse files
authored
Merge pull request #2793 from StoDevX/streams-endpoint
Switch Streams endpoint to ccc-server
2 parents 113741e + 49cdd6c commit 7f6e3a0

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

source/views/streaming/streams/list.js

Lines changed: 7 additions & 13 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,27 +73,22 @@ 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',
83-
// eslint-disable-next-line camelcase
84-
date_from: dateFrom,
85-
// eslint-disable-next-line camelcase
86-
date_to: dateTo,
81+
dateFrom,
82+
dateTo,
8783
}
8884

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

9387
// force title-case on the stream types, to prevent not-actually-duplicate headings
94-
const processed = streams
88+
const processed = data
9589
.filter(stream => stream.category !== 'athletics')
9690
.map(stream => {
97-
const date = moment(stream.starttime, 'YYYY-MM-DD HH:mm')
91+
const date = moment(stream.starttime)
9892
const group =
9993
stream.status.toLowerCase() !== 'live'
10094
? date.format('dddd, MMMM Do')

source/views/streaming/streams/row.js

Lines changed: 2 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({
@@ -32,7 +33,7 @@ function Info({item}: {item: StreamType}) {
3233
function Time({item}: {item: StreamType}) {
3334
const showTime = item.status !== 'archived'
3435
return showTime ? (
35-
<Detail>{item.date.format('h:mm A – ddd, MMM. Do, YYYY')}</Detail>
36+
<Detail>{moment(item.date).format('h:mm A – ddd, MMM. Do, YYYY')}</Detail>
3637
) : null
3738
}
3839

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)